[Home]  [Links]  [grouch] 


Restoring Lilo

You just had to reinstall that other operating system on your dual-boot box. Now, mysteriously, you no longer receive that familiar Lilo: prompt. All is not lost. You just need to re-install Lilo to the MBR (master boot record) of your drive.

You must be 'root' to do the following.

Overview:

  1. Boot Linux using your boot disk, a rescue disk or your installation CDROM.
  2. Mount the / partition from the hard drive to your current directory tree.
  3. Run /sbin/lilo -r <where you mounted />.
  4. umount <where you mounted /> (Notice that's not "unmount").
  5. Reboot.
Details:
  1. Boot linux.

    1. Your boot disk. Your distribution should have given you the opportunity to create a boot disk during installation. It's time to test it. You may have to alter the BIOS settings of your computer to change the boot sequence to A:,C:,CDROM. Try just popping the boot disk into your A: drive and restarting your computer. If it ignores the boot disk and reboots that other operating system from the hard drive, change the BIOS settings.
    2. A rescue disk. You can create a rescue disk using, for example, Tom's Root/Boot. Instructions for creating this are on the site. Other rescue disks may be obtained from http://metalab.unc.edu/pub/Linux/system/recovery/!INDEX.html. Sometimes the system on a rescue disk is old compared to your installed system.
    3. Your installation CDROM. Again, you may have to adjust your BIOS settings to allow the CDROM to boot. Almost all distributions allow you to 'jump' to a command line console before any actual installation takes place. Usually, this is just after you select the language and keyboard to be used. At that time you should be able to use Alt Ctrl Fn where Fn is one of the function keys. This should get you to a command prompt. Run mount to see if the Linux partition on your hard drive is mounted yet. Run fdisk -l /dev/hda to see the names of the partitions and their types, assuming you are using an IDE drive and your Linux partition is on the first or only drive (/dev/hda).

  2. Mount your / partition from your hard drive.

    1. See what is already mounted: mount
    2. See what directories are available: ls / 
    3. See the names and types of partitions: fdisk -l /dev/hda
    4. Mount your Linux / partition to your current directory tree:
      mount -t ext2 <partition name> <directory to mount to>

    NOTE: if you have a separate partition for /boot, this must also be mounted. Example: if you mount your / partition to /tmp you would need to mount your partition for /boot to /tmp/boot.

  3. Run /sbin/lilo -r <where you mounted />
    That -r switch is important. Normally, your lilo.conf configuration file is at /etc/lilo.conf. But if you mounted your / partition at /tmp, for example, the full path is now /tmp/etc/lilo.conf. The -r switch tells lilo to chroot (change root) to the directory specified and seek its configuration file from there.

    So, if you mounted your Linux partition to /tmp, then you would run /sbin/lilo -r /tmp. If the system you booted (boot disk, rescue disk, CDROM) does not have /sbin/lilo, you would run /tmp/sbin/lilo -r /tmp instead.

  4. umount <where you mounted />
    You should make sure you umount any of your hard drive partitions that you have mounted. umount them in reverse order that you mounted them.

  5. Reboot. You should be able to issue shutdown -r now and reboot. If you get a message such as "shutdown: command not found", try using Alt Ctrl Del to reboot. If that fails, hit the reset switch.

An alternative

The FreeBSD bootloader can be installed from a DOS prompt. If your partition tables are not too weird, it will detect all bootable partitions and present you with a simple, cryptic menu at boot. You select the partition to boot using the function keys. It is available at ftp://ftp.freebsd.org/pub/FreeBSD/tools/
Download bootinst.exe and boot.bin then, from a true DOS prompt (restart in DOS mode) run bootinst.exe boot.bin

When you reboot, you should see the FreeBSD bootloader's little menu. Be quick to select or it will boot the one by the F1 label.