lilo

Install the core and load the boot management program

Supplementary instructions

lilo command is used to install core loading and boot management programs. lilo is a Linux system core loader that also has the function of managing boot. Executing the lilo command alone will read the /etc/lilo.conf configuration file and then install lilo based on its contents.

Linux lilo has become a standard part of all Linux distributions. As one of the older/oldest Linux bootloaders, its growing Linux community support has allowed it to evolve over time and always serve as a usable modern bootloader. There are some new features, such as an enhanced user interface and the utilization of new BIOS features that can exceed the original 1024-cylinder limit.

While LILO continues to evolve, the basic concept of how LILO works remains the same.

grammar

lilo(option)

Options

-b<Peripheral device code>: Specify the peripheral device code where lilo is installed;
-c: Use compact mapping mode;
-C<configuration file>: Specify the lilo configuration file;
-d<delay time>: Set the boot delay time;
-D <identification label>: Specifies the operating system that is preset to start after booting, or the system core identification label;
-f<Geometry parameter file>: Specify the geometry parameter configuration file of the disk;
-i<boot sector file>: Specify the boot sector file to be used. The default is the boot.b file in the /boot directory;
-I<Identification tag>: Displays the location where the system core is stored;
-l: Generate linear magnetic sector address;
-m<mapping file>: Specify the mapping file;
-P<fix/ignore>: Determine whether to repair or ignore errors in the partition table;
-q: List mapped system core files;
-r<root directory>: Set the directory to be mounted as the root directory when the system starts;
-R<execution command>: Set the command to be executed first when the system is started next time;
-s<backup file>: Specify the backup file;
-S<backup file>: force the backup file to be specified;
-t: Do not execute the command, only list the actions that will be performed during actual execution;
-u<Peripheral color device code>: delete lilo;
-U<Peripheral device code>: The effect of this option is similar to specifying the "-u" parameter, when the timestamp is not checked;
-v: Display the instruction execution process;
-V: Display version information.

Example

Using LILO as bootloader

What you need to do to use LILO as your bootloader depends on whether you are doing a clean installation or converting an existing Linux installation to use LILO. If you are doing a fresh installation, jump directly to the Configuring LILO section. If you already have a Linux distribution installed, you usually have the option of installing and configuring LILO (and booting the machine to a new Linux installation).

To migrate existing Linux to LILO, you must first obtain the latest version of LILO (see Related topics). Before doing anything else, it's recommended that you make sure you have a Linux boot disk handy - it can be a big help in getting back to your original Linux configuration if you accidentally mess up something! Once LILO is installed on your system, letting it take over the MBR is very simple. As the root user enter:

/sbin/lilo -v -v

This will use the current LILO defaults, erasing everything currently in the MBR. However, please read Configuring LILO to ensure it boots as expected. Also note that if you want to run Windows and Linux on the same machine, you should install the Windows OS first and then the Linux OS so that the boot loader selected in the Linux installation is not overridden by the Windows boot loader. cover. Unlike Linux boot loaders, most Window boot loaders do not support booting Linux. If you have already installed Linux first, you only need to create a Linux boot disk yourself, so that after installing Windows, you can go back to the Linux installation and rewrite the MBR.

Configuration LILO

LILO configuration is completed through a configuration file located at /etc/lilo.conf. Listing 1 shows an example configuration using my home machine that supports dual booting of Linux and Windows machines. Knowing the basic configuration of my workstation, you can imagine how these configurations relate to the actual machine:

Windows XP is installed on the main HDD (Physical Disk 1) (originally it is the only one on the machine). In Linux terminology, this HDD is /dev/hda (or hd0,0 in grub terminology).

Red Hat Linux was installed from HDD (physical disk 2); the root partition is located on the third partition of this hard drive, /dev/hdb3 (hd1,3 in GRUB terminology).

lilo.conf sample file:

boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=100
compact
default=Linux
image=/boot/vmlinuz-2.4.18-14
label=Linux
root=/dev/hdb3
read-only
password=linux
other=/dev/hda
label=WindowsXP

Configuration file option description:

The *boot= line tells LILO where to install the bootloader. In the above example, it will be installed to the MBR of the first hard drive. Alternatively, you can install LILO to /dev/hdb3 (the Linux partition in the example), which would require installing another bootloader to /dev/hda and pointing it to the LILO bootloader; then just let LILO act as a secondary Bootloader. Normally, the boot loader should be located at /dev/hda. You can also make a LILO floppy boot disk by pointing this parameter to a floppy drive (most commonly /dev/fd0).

There are many other parameters you can use in the lilo.conf file, but the parameters in Listing 1 are enough to make the machine usable. For further information on these and other parameters of lilo.conf, please refer to the man page (man lilo.conf). Since lilo.conf is not read at boot time, the MBR needs to be "updated" when this file is changed. If you reboot without completing this step, changes to lilo.conf will not be reflected on startup. Similar to writing LILO to the MBR earlier, you need to run:

/sbin/lilo -v -v

The -v -v flag will give you very verbose output. When running LILO like we did, there are a number of parameters that can be specified. See the man page (man lilo) for further information.

Initial Boot Process

When LILO initially boots, it prints out each letter in order - L-I-L-O. If all letters are displayed, the first stage of booting is successful. Anything missing indicates a problem:

L: The first stage bootloader has been loaded. If LILO stops here, there is a problem booting the second stage boot loader. This is usually accompanied by an error code. Common problems at this stage are media problems or incorrect disk parameters specified in the lilo.conf file.

LI: The second stage bootloader has been loaded. LILO stopping here means that the second stage boot loader cannot be executed. Again, this could be due to a similar problem to just showing L: Loading, or not loading because the boot.b file was corrupted, moved, or deleted.

LIL: The second stage bootloader is being executed. At this point, media problems may occur again, or the mapping file (as specified in the lilo.conf file) may have problems finding the descriptor table.

LIL?: Load into the same stage as above. This usually means that the wrong address was used to load the second-stage boot loader, most commonly because boot.b is in a different location than specified by the lilo.conf file.

LIL-: Load into the same stage as above. Problems loading the descriptor table are most commonly caused by a bad descriptor table.

LILO: LILO was successfully loaded without any errors.

Additional configuration at boot

After LILO is successfully loaded, you will see the LILO prompt. Still using the previous example lilo.conf file, you will have two choices at this point, which may not be intuitive to those new to LILO. First, you can let LILO timeout (after 10 seconds), which will boot /dev/hdb3, the Linux partition. Alternatively, you can press the TAB key, which will list the operating system options that will boot. In our example lilo.conf, the options you will get are "Linux" and "Windows". Whichever one you enter will boot to which OS. Specifying the load Linux option prompts for a password, in this case linux. If you enter an incorrect password, the LILO prompt is returned.

Unfortunately, LILO does not support interactive configuration during boot, so this can only be done in lilo.conf or specify options when running /sbin/lilo.

One last bit of advice for trying LILO for the first time: I find it safer to use a floppy boot disk than a hard disk for LILO configuration. To do this, boot=/dev/hda must be replaced with boot=/dev/fd0 in the lilo.conf file. That way, if you mess up any configuration in the lilo.conf file, you can remove the boot disk and boot into Linux as before. When booting with a floppy disk is normal, you can modify lilo.conf back to boot=/dev/hda, and then run /sbin/lilo for the last time to upload the changes.