I lately updated my dapper box to edgy eft. As edgy eft is unstable and had just been started up, it happens to get surprise.
Today, update-manager stopped to work. When I was clicking on the icon, the update-manager never showed up… due to sudo. Here is how I sorted my way out.
Well, on ubuntu boxes, root doesn’t have its own account. In order to gain root access, you need to run sudo.
This permits your normal user to run administrative tasks by simply giving its password when asked.
Programs such as update-manager actually use sudo to install updates, today, the password box nerver showed up to me.
In the first place I thought that update-manager was messed up and open a terminal to:
sudo apt-get dist-upgrade
and here is what I had instead of a password prompt:
>>> sudoers file: syntax error, line 2 <<< >>> sudoers file: syntax error, line 16 <<< >>> sudoers file: syntax error, line 18 <<< >>> sudoers file: syntax error, line 19 <<< >>> sudoers file: syntax error, line 20 <<< sudo: parse error in /etc/sudoers near line 2
Well, that is quite annoying!!! If you can’t sudo in the first place, you can’t edit /etc/sudoers, neither you can update your system and cross your finger wishing that the system won’t be broken anymore 😉 .
There is still a chance: booting up on a live cd or in recovery mode (single user, runlevel 1). This way, you can access your hard-drive and edit the required file.
So I restarted my box and booted up on runlevel 1 (recovery mode from grub).
Warning: you usually need to mount your partitions once you get a prompt. It happened to be allready mounted when I logged in.
Once I had root prompt, I went to check /etc/sudoers . It happened to have no syntax error :s. Therefore I should find a way to be able to logging as root.
In a previous article, Ubuntu default root password or the sudo way, I explain how you could create a usable root account under ubuntu. Simply type:
and simply supply your new password. Now, you can use root account. Restart your box and do a normal boot. Log in a your normal user, open a terminal and type:
Enter the root password you defined previously and you should get a # prompt. There you are, you are root.
I was the able to update my box running:
apt-get update apt-get dist-upgrade
Luckily, sudo was one of the package that had to be updated. After my distro upgraded, I was again able to sudo.
Hey, this is what happen when you play with unstable distros, It might break up, but luckily you can find a way to rescue it :).