Monday, May 18, 2009

LILO -The Linux Loader

In the section on the boot process, we briefly discussed the Linux boot loader LILO. (Short for LInux LOader). This is basically a set of instructions to tell the operating system how to boot. These instructions include what operating system to boot and from what partition, as well as a number of different options. If LILO is installed in your master boot record, it can be used to boot basically any operating system that you can install on that hardware. For example, on my machine, I have had LILO boot various Windows versions (including NT), SCO Unix, Sun Solaris, and, of course, Linux. Actually, most of the work was done by the boot loader of the respective operating system, but LILO was used to load start the boot process.

In this section we are going to talk about some of the basics of LILO from a user's perspective. In the section on Installing your Linux kernel, we'll go into more details of configuring and installing LILO.

When your system reaches the point where LILO is executed, you are usually given the prompt:


By simply pressing the enter key, LILO will execute it's default instructions, which usually means loading and executing a Linux kernel. However, starting Linux is not a requirement. In the before time, when I typically worked on Windows, rather than Linux, I had LILO as my boot loader, but it booted Windows 95 by default. Either I pressed the enter key at the LILO prompt or simply waited until LILO had reached the configured timeout (which I configured to be 10 seconds).

In order to boot different operating systems, you need to be able to tell LILO what to boot. This is done by simply inputting the appropriate text at the LILO prompt. This text is configured in the LILO configuration file (/etc/lilo.conf). A problem arises three months later when you have forgotten what text you used. Fortunately, to get a list of available options, all you need to do is press the TAB key, which will display the different texts. For example, I had three, which were labeled "win95", "linux" and "linuxgood". The win95 was the default (before I knew better), linux started my current kernel and linuxgood was a kernel that I had compiled with just the basic options that I knew worked and I used it as a failsafe should something go wrong when installing a new kernel. Interestingly enough, SuSE added their own LILO entry in the meantime, which they simply called "failsafe" with the same purpose as my entry.

In addition to accepting the tag, or label, for a specific entry, you can pass configuration options to LILO directly at the prompt. One thing I commonly pass is the location of the root filesystem. I used to have a couple of different Linux distributions on my system, particularly when a new version came out.I would install the new version on a different partition to make sure things worked correctly. I could then boot from either the new or old kernel and select which root filesystem I wanted. This might be done like this:

linux root=/dev/hda6

Here /dev/hda6 is the partition where my root filesystem is. Note that LILO does not do anything with these options, instead they are passed to the kernel. LILO is not very smart, but knows enough to pass anything given it at the LILO prompt to the kernel. You can also pass options to tell the kernel that the root filesystem is read-only (root=/dev/hda6,ro) or read-write (root=/dev/hda6,rw).

Another useful option is the keyword "single". This tells the kernel to boot into "single-user mode", which is also referred to as "maintenance mode". As the names imply, only a single user can log into the system and it is used to perform system maintenance.

If it runs into problems while booting, LILO will provide you information about what went wrong (albeit not as obviously as you might hope). When loading, the letters of "LILO" are not printed all at once, but rather as each phase of the boot process is reached. Therefore, you can figure out where the boot process stopped by how much of the word LILO is displayed. The following table shows you the various stages and what possible problems could be.

Characters Description
none LILO has not yet started. Either it was not installed or the partition is not active
L errorcode The first stage boot loader has been loaded and started. However, the second stage boot loader cannot be loaded. The errorcode typically indicates a media problem, such as a hard disk error or incorrect hard disk geometry.
LI The second stage boot loader was loaded, but could not be executed. Either a geometry mismatch has occurred or boot/boot.b was moved without running the map installer.
LIL Second stage boot loader starts, but cannot load the descriptor table from the map file. Typcially a media failure or by a geometry mismatch.
LIL? Second stage boot loader loaded at an incorrect address. Typically caused by a geometry mismatch or by moving /boot/boot.b without running the map installer.
LIL- Descriptor table is corrupt. Typically caused by either a geometry mismatch or by moving /boot/boot.b without running the map installer.
LILO Everything successfully loaded and executed.
Table - LILO boot stages and possible problems.

No comments:

Post a Comment