Page 1 of 1

Error using sudo

Posted: Sun May 03, 2020 2:51 pm
by Deleted User 7758
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.

Code: Select all

jon@Odroid:~$ sudo apt update && apt upgrade -y
Ign:1 https://deb.debian.org/debian stretch InRelease
Get:2 https://deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Get:3 https://deb.debian.org/debian-security stretch/updates InRelease [94.3 kB]         
Get:4 https://deb.debian.org/debian stretch-backports InRelease [91.8 kB]                     
Hit:5 https://deb.debian.org/debian stretch Release                                                                 
Get:6 http://fuzon.co.uk/meveric all InRelease [19.4 kB]                               
Hit:7 http://fuzon.co.uk/meveric stretch InRelease                                           
Get:9 https://oph.mdrjr.net/meveric 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

Re: Error using sudo

Posted: Sun May 03, 2020 9:38 pm
by Joulinar
Hi,

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

Code: Select all

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

Code: Select all

Sorry, user <USER> may not run sudo on <HOST>
To add sudo permission to a user, login as user root and run following command.

Code: Select all

adduser <USER> sudo
Afterwads sudo should be working for the user

Re: Error using sudo

Posted: Mon May 04, 2020 9:11 am
by Deleted User 7758
thank you - got response so all should be good

Re: Error using sudo

Posted: Mon May 04, 2020 3:24 pm
by Joulinar
what kind of response did you got?

Re: Error using sudo

Posted: Tue May 05, 2020 2:39 am
by Deleted User 7758
I didn't :lol:

Re: Error using sudo

Posted: Tue May 05, 2020 10:46 am
by Joulinar
ah ok :lol:

Re: Error using sudo

Posted: Tue May 05, 2020 1:27 pm
by trendy
Sudo works fine for you, you forgot to add another sudo after the && for the apt upgrade.