2

Yesterday I was using my computer normally, but, today, when I turned it on, this problem suddenly appears.

I understand that there's quite a few things to do to try to fix this issue.

When I run the following command:

sudo apt-get update

sudo gets an error:

/usr/bin/sudo must be owned by uid 0 and have the setuid bit set

My question isn't about how to fix this, but how and why this happened?

2
  • 2
    You ran sudo chown something-or-the-other
    – muru
    Jul 21, 2017 at 12:09
  • Or just something like "sudo nautilus" and something slipped. Obs.: Never do that! Use sudo -H nautilus if you must open it with root permissions.
    – user692175
    Jul 21, 2017 at 12:15

2 Answers 2

5

Is it possible that you ran a recursive chmod command at the root level recently? Accidentally or otherwise? Resetting chmod to a standard value like 0755 will remove all setuid bits.

There are dozens of files on your filesystem that require special permissions to work correctly and for which a simple permission like 0755 or even 0777 won't work.

There isn't a reliable way to undo this without reinstalling, since this is a lossy operation: there's no way to revert each file to the permissions it was previously.

4
  • Perfect. I did ran chmod at root level yesterday. Now I understand (:
    – Matheus
    Jul 21, 2017 at 12:21
  • @MatheusCirillo how did you fixed your issue I am having the same issue now. can you please write the answer. Sep 20, 2017 at 15:01
  • @thomasrutter I am working on windows Cygwin,with AWS ubuntu in my case do I need to reinstall the Cygwin or create a new instance for ubuntu.? Sep 20, 2017 at 15:05
  • @AbdulWaheed Unfortunately I had to reinstall ubuntu. In your case, you'll probably have to create a new instance, since there isn't a reliable way to undo this.
    – Matheus
    Sep 23, 2017 at 17:01
-1

Its because of Permission issue.

 $ su
 Password: <type your user password>

Switch to root user and run the command

# pkexec chmod a=rx,u+ws /usr/bin/sudo

Then check it by typing from the user

$sudo -l

It works fine for me.

7
  • 1
    There is no root password by default on Ubuntu... Of course you can set one, but it is not recommended and not that many people do it.
    – xenoid
    Sep 19, 2018 at 7:02
  • 1
    are you mad ? i say type your root password not type root as password... Sep 19, 2018 at 7:04
  • No I am not. User root has no password on Ubuntu (/etc/shadow contains: root:!:17264:0:99999:7:::). You can't su to root like on other Unixen. You can only sudo.
    – xenoid
    Sep 19, 2018 at 7:12
  • okay i'll change it Sep 19, 2018 at 7:16
  • 1
    @KevalMangukiya Still not OK, su needs the target user password. You can use another means to get a root prompt in Ubuntu. In this case, the rescue prompt would be likely the right one.
    – Melebius
    Sep 19, 2018 at 11:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .