How To Solve “Sudo must be owned by uid 0 and have the setuid bit set” In Manjaro/Ubuntu.

If you’ve ever come across this error “/usr/bin/sudo must be owned by uid 0 and have the setuid bit set“. It is usually caused by you somehow changing the permission settings in the /usr/bin/sudo file, and in the process locking yourself out of sudo or root command actions.

The solution is quite simple, though I have come across forums giving the advice of a “nuclear option”, in other words re-installing your system. Feel free to take that route if your heart desires it. So lets start with the simple solution, starting with. . .

  • Manjaro/Arch
    1. Logout of your system, and during reboot Tap ESC or hold SHIFT on boot to show the GRUB menu..(By default GRUB is hidden unless there is more than one boot entry to choose from.)
    2. Tap e for EDIT and find the line that begins with LINUX . . . (the default kernel), and add a SPACE and the NUMBER 3 to the end of that line.
    3. Tap CTRL + X to save and reboot your system. When the system reboots it will be into a text based login system TTY, here you can login as user: root and password: ******* (your root password).
    4. Once done you will be presented with a root command prompt or #, here is where the magic happens, type the following line into this command prompt
    5. chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
    6. Logout of root or just Reboot you system, and log back in as youself (user), you should now have access to sudo. To test this, you could open a terminal and type sudo -i which you will then be asked for your password and presented with a root command prompt.
  • Ubuntu/Debian
    1. First restart your PC/Laptop, and tap the ESC or hold SHIFT key while Ubuntu is booting. This will bring you up the boot menu.
    2. Select Advanced Options.
    3. Select your OS version in (recovery mode), and press Enter Key. (Example : Ubuntu 21.04 (recovery mode)).
    4. On the next screen select “Drop to root shell prompt” and press Enter. You will now see a command line at the bottom of the screen.
    5. Now run each of the following commands.
      1. mount -o remount,rw /
      2. mount –all
      3. chown root:root /usr/bin/sudo
      4. chmod 4755 /usr/bin/sudo
    6. Now restart/reboot your PC/Laptop. Once you log in, you will find that you can use the sudo command again .

I hope this may help some of us who don’t learn all about permissions before attempting any changes in the root usr or shared directories. Further reading can be found at Arch Linux’s File Permissions and Attributes. And the excellent Ubuntu articles at DevAnswers which also includes a comprehensive Numeric Meanings, (you know 777, 775, 600, etc. . .).

Comments Help Make Zuphoria Better, Please Leave One:

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.