I could not use sudo function in my rasbian and when i try to update or upgrade using my terminal i am incurring following error

pi@raspberrypi:~ $ sudo 
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

pi@raspberrypi:~ $ apt-get update
Err http://archive.raspberrypi.org jessie InRelease

Err http://archive.raspberrypi.org jessie Release.gpg
  Could not resolve 'archive.raspberrypi.org'

Following is the result of permissions for Sudo

pi@raspberrypi:~ $ ls -l /usr/bin/sudo 
-rwxr-xr-x 1 pi pi 139584 Jan 11 2016 /usr/bin/sudo

kindly let me know what is the issue with my Raspberry

  • Two different questions - perhaps break them up? What is the result of ls -l /usr/bin/sudo? – SiKing Nov 29 '16 at 16:50
  • @SiKing: this is the output ---> pi@raspberrypi:~ $ ls -l /usr/bin/sudo -rwxr-xr-x 1 pi pi 139584 Jan 11 2016 /usr/bin/sudo – DevanDevak Nov 29 '16 at 18:30
  • Please update the original question with the additional information. – SiKing Nov 29 '16 at 18:38

From the output of your ls, it appears that you (or someone) messed with the system files on your Pi and broke things.

The permissions on sudo should be something like:

-r-s--x--x  1 root  wheel  168448 May  4  2016 /usr/bin/sudo

The "s" in the above is the "setuid bit" as per the error message, and the "root" is the "owned by uid 0" as per the error message.

Since you do not have sudo working, and you need sudo to fix this problem, the fix will be difficult. You could plug in the SD card into a Linux system and then fix the permissions, but I suspect there may be other things broken.

The simplest solution would be:

  1. backup anything important
  2. reinstall the OS
  3. restore your backup
  4. don't mess with the system files again, unless you know what your are doing
  • How should i reinstall the os, should i format my sd card again, also i would like to mention that i have edited conf file in /etc directory of rasbian, will this be a problem ?, how to install rasbian more accurately – DevanDevak Nov 29 '16 at 18:59
  • You should update your question with contents from your edited conf file. I would just reinstall the image on your SD card and start over. – dbmitch Nov 29 '16 at 19:13
  • @DevanDevak Installing Raspbian is documented here: raspberrypi.org/documentation/installation/installing-images Anything else, you are doing custom work and you will need to describe what it is you are trying to achieve. That is probably a new question. – SiKing Nov 29 '16 at 19:27
  • I am trying to install raspbian using laptop with ubuntu 16.04 LTS , i followed all the instructions, but i could not install the rasbian with the procedure cited in the link – DevanDevak Nov 29 '16 at 19:30
  • I am getting a strange error, when i put sd card on micro card reader , and type df -h , my computer could not recognize new device, the new sd card is empty, i have formatted it – DevanDevak Nov 29 '16 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.