How to Fix Sudo User in Mythbuntu 12.04


I have no idea how it was corrupted or the group membership lost but it was and I found myself with a system I could not do any administration with. Frustrating to say the least. When looking on the web for answers, I came across many posts for using visudo command. But to use it you need to be able to sudo in the first place. Finally I ran across this post on Psychocats. Very nice work and lots of screen shots on this site. But I ran into a small (big) problem. The first command to enable the root file system to be read/write did not work and resulted in error. This is the errant command from the recovery mode root prompt:

#mount -o remount,rw /

It is the / part that is in error here. Simply put it turns out to be the wrong syntax. I was able to discover that answer here and a big thanks goes to SirCharlo for posting.

This is the command I used to make the file system read/write:

#mount -o remount,rw /dev/sda1

This worked and I was able to follow the instructions on Psychocats and fix my sudo group membership. The next reboot I tested and it worked as expected. To recap, if you find your user can no longer sudo, take these steps:

  1. Boot to Recovery Menu by holding the shift key at boot.
  2. Choose the root shell prompt option.
  3. Make the file system r/w using mount -o remount,rw /dev/sda1  (change sda1 to match your root partition).
  4. Add user to sudo group with adduser user sudo  (change user to your user name).
  5. Exit and reboot.

This will fix Ubuntu type systems based on version 12.04 and up at the time of this posting. For other versions please refer to the excellent instructions on Psychocats. Once again an issue gets solved via the awesome community surrounding Linux and in this case Ubuntu in particular.

penguin2sm3

Leave a Reply