Booting Linux with LILO

Booting Linux with LILO

When you start using Linux, you probably want your old operating system left there, to use if you get struck in some problem. You won't need another operating system because Linux can't do something. Linux can do everything, it's just a matter of configuration and time :-) Anyway, if you want your old system as a backup, a smart way of doing this, is to install Linux to another partition, and use LILO to choose the operating system you want to run at the moment, at system boot. For more detailed information than this text gives you, check the lilo man page. 'man lilo' and 'man lilo.conf'

How LILO works

LILO (LInux LOader), places itself in a boot sector of your hard disk. It could be the MASTER boot record of your hard disk, ie the first sector of the disk, making it execute as the first thing the BIOS does after checking things are OK. It could also be a partition boot record, ie the start of a partition, making it execute when another boot loader, perhaps the OS/2 Bootmanager, passes the control to it. This way, you could have a more fancy boot loader there for your mother to choose from, and then LILO will do the Linux boot.

LILO has a configuration file, called /etc/lilo.conf, where you tell it how to behave. I'll give you an example of such a file in the next section. After you've written your lilo.conf, run the command 'lilo' and it will write the boot sector, or give you an error message if you've done something wrong. It's really important that you have a boot, because if you do something wrong you have to edit the lilo.conf file, and try doing that when you can't start Linux ! Installing some operating systems (Win95 for example) will erase the information lilo writes to the Master Boot Record, and you'll have to boot Linux with a boot disk to be able to reexecute lilo to rewrite the information.

An example lilo.conf file, for a computer with win95 and Linux installed.

I'll give an example here, basically copied from the lilo man page, how to setup lilo for a computer with windows 95 on the first primary partition, and Linux on the first logical partition. All text after a '#' is comments.

# example /etc/lilo.conf
boot  =  /dev/hda     # place lilo in MBR of first disk
delay = 40            # Wait 4 seconds for user to press Ctrl or Shift 
                      # This way your mother won't have to do anything to 
                      # boot her windows 95
other = /dev/hda1     # The windows 95 partition
    label = windows
    table = /dev/hda

image = /boot/zImage-2.0.33 # A Linux kernel, located in the /boot directory
     root  = /dev/hda2     # The partition that will be mounted as root
     label = linux         # The name you should type in to boot this kernel.
After entering that into your /etc/lilo.conf, run the command lilo. If everything is what it should be, it should respond with Added windows * Added linux The star indicates that windows is the default alternative, that will boot if you do nothing.

When you reboot (remember having a rescue disk if something goes wrong), lilo will print 'LILO' at your screen, wait for seconds for you to do something, and then boot windows 95. If you push down shift or Control, LILO will give you a prompt, where you can enter 'linux' and push enter, then it will boot the linux kernel you've specified. I hope it'll work for you !