by Pleiades

So you've done something and now you don't even get the LILO prompt (for me, it was installing Windows 2000* after installing Linux, and not having a boot floppy). You may or may not be able to boot another OS, but you know that there is simply no way of getting LILO going. Re-install? Nope. Run Windows? NEVER! Just do the following.

You will need:

  • A method for booting to a shell. Could be your installation CD, could be someone elses installation CD, could be a boot disk of some description (try ). I have successfully rescued my SuSE 8.0 installation with both a SuSE 8.0 disk and a Mandrake 8.2 disk, but could not do the same with a Red Hat 7.1 disk.
  • At least a simple understanding of your Linux file structure, and perhaps your lilo.conf file.
  • Beverages, preferably brewed by Coopers (, served chilled.

Before we get going, a few conventions. If I tell you to "do" or "run" something, I mean type in, at a command line, the text in italics, and then hit Enter. Commands and file names are in italics, commands are preceded with aforementioned "run" or "do".

  • Boot your machine from your boot media. If it is your installation disk, or one from another distro, you will be presented with a few options, one of which should be 'Rescue', or a variation thereof ('Rescue Mode', etc). You want 'Rescue' (I haven't tried from the floppy. Floppies are so 80`s). This will bring you to a shell. Take a sip of beverage.

  • Do an ls to see what you have. You may or may not need to ls /, as it seems that some rescue disks take you straight to the / directory. Anyway, run ls or ls / and you should see your /mnt directory, amongst others. Run ls /mnt and check what is there, for no other reason than to save you the bother of trying to create an already existant directory. We'll make a directory to mount our root partition now. Run mkdir mnt/root_partition, or whatever you would like to call it (for the rest of the PET, we're assuming that we have called it /mnt/root_partition).

  • Now to mount the root partition. Run mount /dev/hda5 /mnt/root_partition . You will need to change the hda5 to whereever your root partition lies. If you don't know where your root partition lives, then start at the beginning (/dev/hda1) and work your way through the partitions till you get to your root partition. For each incorrect attempt, you will need to umount /dev/hda* (where * is the partition you currently have mounted) before attempting to mount the next partition at /mnt/root_partition

  • Once you've found the partition that holds your root directory, and it is mounted, you'll need to chroot to it. chroot takes you to the specified directory, and makes it the / directory. So, run chroot /mnt/root_partition, and you're halfway there. What was /mnt/root_partition has become /

  • Now, before we run lilo, we need to check that kernel is pointing to the correct root device. We do this with rdev. To do this, you'll need to know where your kernel is. Mine is at /boot/vmlinuz, so that's the example I'll be using. To check that the kernel at /boot/vmlinuz is pointing to the correct root device, run rdev /boot/vmlinuz. This will produce output similar to Root Device /dev/hda5 . If this is incorrect (as it was for me), and your root device is elsewhere (mine is /dev/hda), then you need to tell rdev to fix this. You do this by running rdev /boot/vmlinuz /dev/hda , changing the /dev/hda to suit your installation. To work out which is your root device, look in /etc/lilo.conf, and you will see a line boot = *, where * is your root device. rdev wont produce any output when run with arguments, so just to be sure, run rdev /boot/vmlinuz again, to check that the root device has indeed been changed.

  • So we're almost ready to run lilo. If you need to make any changes to /etc/lilo.conf, do it now, then run lilo . Assuming that everything has gone roughly to plan, you should get the normal messages from lilo (this is what I get):

added linux * added linux_failsafe added windows
and lilo will have been re-installed to your MBR, or where ever you told lilo to put it.
  • Remove your installation media, reboot your machine, and enjoy Linux

Windows is there solely for Return to Castle Wolfenstein, honest!