Dec 22

Adventures in accidental chown

So earlier today I had to get Virtualbox up and running, and it was complaining about permissions not being set right.  For some reason, the permissions on my /usr directory were slightly messed up and not owned by root.  So, I did:

sudo chown root:root /usr

That didn’t fix the problem.  Going into the /usr directory, I also noticed that a few of the other folders weren’t owned by root.  So, let’s just go fix everything at once:

sudo chown -R root:root /usr

Okay, now let’s try starting Virtualbox!

Virtualbox now complains about not being setuid.  Okay, fine.  Let’s reinstall virtualbox, since it says that should fix it.

sudo dpkg -i virtualbox.deb
sudo: must be setuid root



Turns out, doing the chroot dropped the setuid bit from all binaries in the /usr directory.

To fix this, you’ll have to boot from a rescue disk/CD of some kind, and change the permissions on sudo:

chmod 4755 /path/to/mounted/filesystem/usr/bin/sudo

Other programs will also be messed up at that point, but now that you have sudo you can change the permissions to what they should be, and/or reinstall. 🙂