LILO is the Linux Loader, the most popular boot loader for Linux. (For some background on boot loaders, see Choosing a Boot Loader) It is used to load Linux into memory and start the operating system. On a machine with multiple operating systems, LILO can be configured to boot the other systems as well.
Normally LILO is initially configured for you during the Linux installation process. However, you may find that default configuration is not correct, or you wish to customize it. And there may even come a time when you need to remove LILO from your computer. Here are some instructions that should help you on your quest.
As with many Linux utilities, LILO can be customized with a configuration file in the /etc directory. The lilo.conf file has its own man page which is quite thorough. In fact, it may be a little too thorough for simple configuration. So here's the lowdown on your basic lilo.conf file.
The sample lilo.conf file shown below is for a typical dual-boot
configuration, with Windows installed on the first partition and Linux
on the second. You can probably use this as-is, except for the
image= line and possibly the root= line,
depending on where Linux was installed. Detailed explanation follows.
boot=/dev/hda map=/boot/map install=/boot/boot.b compact prompt timeout=50 image=/boot/vmlinuz-2.0.36 label=linux root=/dev/hda2 read-only other=/dev/hda1 label=win
boot=/dev/hda:map=/boot/map:install=/boot/boot.b:compact:prompt:timeout=50:prompt is specified, otherwise boots the default immediately).
image=/boot/vmlinuz-2.0.36:label=linux:root=/dev/hda2:root= parameter. In my case, Linux is installed in the
second primary partition.
read-only:other=/dev/hda1:other tells LILO to boot an
operating system
other than Linux. It is given the value of the partition where this
other operating system lives. LILO will simply load and execute the
boot sector of this partition at boot time.
label=win:By copying this basic layout, you should be able to get LILO to boot Windows or any new Linux kernels you build. Before you begin editing, make sure you create a backup copy of the original lilo.conf just in case something goes wrong. And don't forget to apply your changes!
Anytime you edit the /etc/lilo.conf, or if you move or
rename any of the files used by LILO, including the Linux
kernel itself (the vmlinuz file), you must apply your changes
before they will take effect. Failing to do so might cause LILO to be
unable to boot Linux!
To apply changes, run the following command (you will need to be SuperUser):
/sbin/lilo
You should get a response that looks like this:
Added linux * Added win
The asterisk (*) indicates the default boot image. If you see anything other than this, something went wrong. Go back through your lilo.conf and read the man page to see what it was.
If you reinstall DOS or Windows after installing LILO, you may find that the LILO: boot prompt no longer appears. This might also occur if certain disk utilities or anti-virus utilities attempt to "repair" your master boot record. (Some anti-virus programs will see LILO as a virus!)
To fix this, you just need to reinstall LILO. That means you have to boot into Linux some other way, either using Loadlin or a Linux boot floppy. (See Choosing a Boot Loader). At the Linux command prompt just type /sbin/lilo as described under Applying Changes. When you reboot, LILO will be back where it belongs!
If you have LILO installed as your master boot record and you decide to uninstall Linux or upgrade your hard drive, you will need to remove LILO from the master boot record before you remove it's files from the hard drive. LILO makes a backup copy of your original master boot record before it installs itself. To remove LILO and return to the original, issue this command:
/sbin/lilo -u
If this fails for some reason, consult the LILO documentation for alternatives.
If the LILO files have already been removed, or you are unable to coax LILO into removing itself, try using the DOS fdisk program to rebuild the master boot record with this command (from a DOS boot floppy):
fdisk /mbr
At boot time, LILO will present you with a boring prompt:
LILO:
If you do nothing, LILO will wait the amount of time specified in its configuration file and then boot the default operating system image. You can choose an operating system image to boot by typing its label here. If you can't remember what the labels are, press the TAB key to see a list. The default image is normally labelled "linux". If your lilo.conf was built by the Linux setup program, you may also have one called "dos" that boots the DOS or Windows partition.
If you need to pass special parameters to the Linux kernel, you can do it by typing them after the image name. For example, if you need to login to Linux in single-user mode to repair a damaged system (or because you forgot the root password), you can type:
linux single
Or if that fails, try:
linux 1
See the BootPrompt How-To for more neat things you can do at the LILO: prompt.
man pages: lilo, lilo.conf
Documentation: /usr/doc/lilo-*/ contains a very thorough, printable postscript User Guide, with source.
The LILO mini-How-to
© Copyright 1998-2008 by Vincent Veselosky.
Unless otherwise noted, the text content of this work is licensed under the Creative Commons Attribution-Share Alike 2.5 License.
Please see the Control-Escape License page
for details.