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 /
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:
- Boot to Recovery Menu by holding the shift key at boot.
- Choose the root shell prompt option.
- Make the file system r/w using mount -o remount,rw /dev/sda1 (change sda1 to match your root partition).
- Add user to sudo group with adduser user sudo (change user to your user name).
- 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.