-->
Previous Table of Contents Next


Chapter 4
Using LILO

by Kamran Husain

In This Chapter
•   Installing LILO
•   Linux and hard disk layouts
•   The boot sector
•   The boot process
•   The map installer
•   Boot images
•   Removing or disabling LILO
•   Troubleshooting LILO

LILO (which means LInux LOader) is the boot loader used by Linux to load the operating system kernel. LILO is versatile: It can boot Linux kernels from any type of file system, including floppy disk as well as from other operating systems.

This chapter looks at LILO, the way hard disks are laid out with Linux, the boot process, and the most common boot processes and the interactions of LILO with each. This should help you install and use LILO efficiently and effectively.

There are several versions of LILO available. Most current versions support one of two different directory structures. The more traditional (and older) structure resides in the /etc/lilo directory. The newer structure has files scattered in several directories including /etc, /sbin, and /boot. Because the older /etc/lilo structure is the most common, it is used for examples in this chapter. If you are using the new structure (check for the existence of /etc/lilo), substitute the new pathnames as necessary.

Installing LILO

Most systems have LILO already installed and configured. If your system already has LILO installed, you can skip this section unless you want to update your version.

A quick installation procedure is available with most versions of Linux to install a minimum set of files required for LILO. This is described in the file QuickInst.old or QuickInst.new, in some versions of Linux (but not all). The QuickInst routines can be used only for a first-time LILO installation or to replace an existing LILO set. They should not be used for updates as any existing configuration information is overwritten.


Note:  
Before LILO can be compiled for use, the kernel has to be configured by executing makeconfig. All kernel header files must be in the directory /usr/include/linux for LILO to compile properly. The LILO installation and compilation process should be run from a Bourne shell (or complete compatible). Problems have been reported with versions of the Korn shell when LILO is compiled, so use /bin/sh or /bin/bash.

A full installation of LILO requires that all the files in the LILO distribution archive (usually called lilo.xxx.tar.gz where xxx is the version number) are extracted into a directory other than /etc/lilo. (This is because the installation will fail if the final destination is the same as the source directory.) After the distribution files are located in a temporary directory, follow these steps:

1.  Check the Makefile for valid configuration information (see the later “LILO Makefile” section).
2.  Compile LILO. If you want to use the older /etc/lilo directory structure, issue the first command that follows. If you want to use the new directory structure, issue the second command.

make -f Makefile.old

make -f Makefile.new

3.  Copy all the LILO files to the target directory with one of the following commands, depending on whether the new or old directory structure is selected:

make -f Makefile.old install

make -f Makefile.new install

4.  Check the lilo directories. You should see the following files: any_d.b, boot.b, chain.b, disktab, lilo, os2_d.b.

If the files do not exist or errors are generated in the process, restart the installation. You should check the Makefile for accurate information. After LILO has been installed properly, you can use it to install a boot process.

Handling Disk Problems

Some systems may have difficulty with hard disks that do not allow the disk parameters (heads, sectors per track, and cylinders) to be read. If error messages about “bad geometry” are generated or the LILO installation fails with disk errors, the disk parameters are a likely source of trouble. This is especially true with SCSI disks and hard disks with a capacity of 1GB or more.

In this case, the disk parameters must be manually entered into the file disktab. This is discussed in more detail in the section “Disk Parameter Table” later in this chapter. Edit the disktab file as explained to include the disk parameters, then follow these steps to test the new LILO configuration by copying it to a floppy disk and booting from it:

1.  Open the LILO directory (usually /etc/lilo).
2.  Execute the following command to copy the LILO configuration to the floppy. Substitute the kernel image name after the “image” parameter. (If you don’t want to overwrite an existing map file on your system, add the -m option to the lilo command using another map filename to write to.)

echo image=kernel_name | ./lilo -C - -b /dev/fd0 -v -v -v

3.  Reboot your system from the floppy disk.

If the configuration is correct, LILO reads the floppy for the boot loader, then loads the kernel from the hard disk. If everything boots properly and you can move around the file system, the disk parameters are correct. If you can’t access the hard disk file system, the parameters are incorrect and should be re-entered.


Previous Table of Contents Next