Error using sudo

I have added a user for myself after installing DietPi and thought I had correctly added myself to the sudo group but I have just received this error and would like to clear this up before proceeding.

jon@Odroid:~$ sudo apt update && apt upgrade -y
Ign:1 stretch InRelease
Get:2 stretch-updates InRelease [91.0 kB]
Get:3 stretch/updates InRelease [94.3 kB]         
Get:4 stretch-backports InRelease [91.8 kB]                     
Hit:5 stretch Release                                                                 
Get:6 all InRelease [19.4 kB]                               
Hit:7 stretch InRelease                                           
Get:9 all InRelease [19.4 kB]                      
Fetched 316 kB in 4s (68.6 kB/s)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

Any help appreciated,

HC1 Dude


many thanks for your report. Basically you would need to logoff / logon with the user once you assigned sudo rights to have it activated. To check if your user is able to run sudo, you could do following

sudo -v

if everything is working fine, you will get nothing back. If you don’t have sudo permission, you will receive following

Sorry, user <USER> may not run sudo on <HOST>

To add sudo permission to a user, login as user root and run following command.

adduser <USER> sudo

Afterwads sudo should be working for the user

thank you - got response so all should be good

what kind of response did you got?

I didn’t :rofl:

ah ok :rofl:

Sudo works fine for you, you forgot to add another sudo after the && for the apt upgrade.