Home > linux > chroot, lilo and a lost password…

chroot, lilo and a lost password…

February 3rd, 2004 osterday

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!

Categories: linux Tags:
  1. Youllneverknow
    February 26th, 2004 at 13:56 | #1

    whassup slacker, it’s been almost a month since you posted anything. get with it…

  2. March 3rd, 2004 at 16:57 | #2

    Well, “Youllneverknow”, I’m guessing you’re Sarah. The tone sounds like you. You and Carol have Fuse/ZoomTown and your IP address you posted from is a Fuse/ZoomTown one – and everyone else I know has RoadRunner. Also, I don’t think any one reads my blog! If not, oh well, glad to see someone’s reading it!

  3. dsfe
    April 18th, 2004 at 20:02 | #3

    On RH, it’s even easier than that. all you need is the generic boot.img, find out where / is, boot into single user, as you did, edit passwd file, sync, reboot.

  4. dsfe
    April 18th, 2004 at 20:03 | #4

    I should have said RH7.3 does not ask for a root password as some distro’s do when booting from a floppy so you can mount the root filesystem and edit files.

Comments are closed.