Error using sudo

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
Deleted User 7758

Error using sudo

Post 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
User avatar
Joulinar
Posts: 2561
Joined: Sat Nov 16, 2019 12:49 am

Re: Error using sudo

Post 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
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Deleted User 7758

Re: Error using sudo

Post by Deleted User 7758 »

thank you - got response so all should be good
User avatar
Joulinar
Posts: 2561
Joined: Sat Nov 16, 2019 12:49 am

Re: Error using sudo

Post by Joulinar »

what kind of response did you got?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Deleted User 7758

Re: Error using sudo

Post by Deleted User 7758 »

I didn't :lol:
User avatar
Joulinar
Posts: 2561
Joined: Sat Nov 16, 2019 12:49 am

Re: Error using sudo

Post by Joulinar »

ah ok :lol:
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
trendy
Posts: 148
Joined: Tue Feb 25, 2020 2:54 pm

Re: Error using sudo

Post by trendy »

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