It seems I never quite learn. I like a clean system, so when I get a chance I remove unused packages. This practice has gotten me in trouble before. It got me in trouble again just the other day.
My now second machine used to be my primary. When it was demoted I left GNOME installed on it since you never know when it might come in handy. Over the last few months I’ve had no use for a GUI on it at all so last Friday I decided to remove GNOME. That got me in trouble because
sudo is installed as a dependency of GNOME’s, and it’s marked “automatic” in
aptitude. Couple that with my habit of locking the
root account and I ended up with a system that I don’t have full access to anymore. Not good!
My immediate thought was to boot a live CD,
chroot to the root filesystem of the installed system and unlock the
root password. Except the damn box refused to boot from CD. I tried all my live and install CDs, Ubuntu (Breezy and Dapper), Knoppix, STD, Debian install (Woody and Sarge). Nothing worked.
A short search later and I found muLinux. A one-floppy live system that on paper seemed capable of doing what I needed. Now I had another problem, where do I get a floppy nowadays? The system admins downstairs had one they could spare. Good! Next problem—where to find a machine with a floppy drive that I can use to create the floppy?
That’s when it hit me. This plan wasn’t the best one, it just happened to be the first one that popped into my mind. I had been too focused on my first idea to take the time to stop and think of other ways of getting my
root account back.
In the end I didn’t need to use a live CD/floppy, I could just use the system already present on the box:
- Boot straight into
init=/bin/bashon the boot line in GRUB
- Remount the root filesystem,
mount -o remount,rw /
- Unlock the password,
passwd -u root