Hack 52 Repair Lilo

 < Day Day Up > 

figs/moderate.gif figs/hack52.gif

Use Knoppix to restore lilo to the Master Boot Record (MBR) .

A common tech-support problem you see on Linux forums is something along the lines of "Help I upgraded my kernel and didn't keep the old kernel in my lilo.conf , and the new kernel won't boot!", or "Help I installed Windows after Linux and now I can't get back to lilo." Whatever the reason, all of us have run into situations where we have needed to restore lilo on a system that won't boot. This is one situation where Knoppix can come to the rescue.

To restore lilo to the MBR, you must reference the /etc/lilo.conf file that was used previously, as well as the original version of lilo . Knoppix comes with a version of lilo itself; however, it's best to use the same version of lilo that is installed on your system. The first step to restore lilo to your MBR is to find your root partition. Open the different partitions you see on your desktop until you find one that contains an /etc directory with your lilo.conf , as well as an /sbin directory that contains lilo . For these examples, the root Linux partition is /dev/hda1 .

If you need to make changes to your lilo.conf (for instance, if you need to add an old kernel or change the default root partition), then now is the time to mount the partition read/write and edit the file.


To properly run your installation's version of lilo , you must make lilo think that /mnt/hda1 (or whatever your root partition is) is actually / . You can do this with a chroot environment. By default, Knoppix mounts these partitions without the dev option, which means that none of the character or block special devices on the filesystem are interpreted. Lilo needs this option to work correctly, so if the filesystem is not yet mounted, mount it with:

 knoppix@tty1[knoppix] $  sudo mount -o dev /mnt/  hda1   

If the filesystem is already mounted, then remount it with:

 knoppix@tty1[knoppix] $  sudo mount -o remount,dev /mnt/  hda1   

Once the filesystem is mounted, restore lilo with the following command:

 knoppix@tty1[hda1] $  sudo chroot /mnt/  hda1    lilo  

You should see output for the boot options that lilo has added and should be able to reboot with lilo fully restored.

 < Day Day Up > 


Knoppix Hacks. 100 Tips and Tricks
Knoppix Hacks. 100 Tips and Tricks
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 166

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net