[Cialug] Locking your keys in the car

Nathan Stien nathanism at gmail.com
Wed Nov 28 16:30:03 CST 2007


Hello Luggers,

I have an instance of Debian unstable that was working just fine until
I decided to play some russian roulette.  That is, I ran "apt-get -u
dist-upgrade" to get latest on everything.  And now find myself in an
interesting situation.  (Luckily it's just a testing sandbox in
vmware, and not at all mission critical.)

The machine has mysteriously lost the ability to resolve its own
hostname.  This is a problem because sudo for whatever reason needs to
resolve the hostname in order to let me do anything.  This machine has
an ubuntu-style setup with respect to sudo -- the root account is
locked.  I can't just "su root".

OK, I says to myself, I'll just add the hostname to /etc/hosts and
move on with life.

nathan at lildeb:~$ sudo vi /etc/hosts
sudo: unable to resolve host lildeb

Ohhhhh, yeeeaaahhh.  D'oh.

So I ended up doing a ctrl-alt-del to get it to reboot, then I hit 'e'
at the grub menu to edit the boot params to include "init=/bin/bash".
I did "init=/bin/bash" because Debian regular single user mode still
requires a root password, which does not exist.

Then booted and remounted the root as writable:

mount / -o remount,rw

Then did my vi /etc/hosts business.

Then put things back how I found them:

mount / -o remount,ro
sync
reboot

This all seems pretty terrible, hackish, and old-timey.  What more
elegant methods, if any, might I have used to fix this situation?
What if I had not been local and able to ctrl-alt-del?  Is there
something I might have done to avoid rebooting at all?  Is it just
unforgivably stupid to lock your root account?

- Nathan


More information about the Cialug mailing list