shwango! blog
life, love and some other stuff…

Archive for February, 2004

chroot, lilo and a lost password…

The other day I had to work on a RedHat 7.3 box that nobody knew the root password - and no rescue floppy was made. Also, box was setup to use lilo with the prompt disabled - so “linux single” was not at option at that point.

So I got out my trusty tomsrtbt floppy (aka “Tom’s Root Boot” disk) to at least try to get to the file system. I was able to find out that /dev/sda1 had /boot and /dev/sda3 had /. So far so good.

I mounted /dev/sda3 to get to /etc/lilo.conf. I edited the file appropriately using vi and saved off lilo.conf. But, unlike grub - where I could just edit the grub.conf file, I would need to run the lilo command to reinstall lilo in the boot sector. I saw that tomsrtbt had lilo so I ran it. I knew I had to specify the location of the lilo.conf, but I still got “‘map segment is too big”. Turns out, lilo is version specific, so the one installed and the one on tomsrtbt are different. I tried a few more things, like using the lilo from the mounted file system, and then Googled for a solution…

That’s when I found the glory of “chroot”. I learned that chroot allowed you to change the root filesystem location for a command. Here’s what worked…

cd /mnt
mkdir v
mount /dev/sda3 /mnt/v
mount /dev/sda1 /mnt/v/boot
chroot /mnt/v /sbin/lilo

That installed my new lilo settings and I could then enter “linux single” at the lilo prompt. Change the root password, and get things working!

Doesn’t make sense…

I haven’t posted a lot because I’ve got too much stuff to post about! OK, I know it doesn’t quite make sense, but trust me - it’s the truth… hopefully a real post will soon follow…