Booting with LILO

The Linux boot loader LILO is suitable for installation in the MBR. LILO has access to two real-mode hard disks and is able to find all the data it needs from the raw hard drives without any partitioning data. Therefore, operating systems can also be booted from the second hard disk. Unlike with the DOS boot process, the entries in the partition table are ignored when using LILO.

The main difference from the standard DOS boot process is the possibility to load diverse installed operating systems when booting. After loading the MBR into memory, LILO is started, allowing the user to select from the list of preinstalled systems. At system start-up, it can load boot sectors from partitions to boot an operating system from the respective partition or load the Linux kernel and boot Linux. It also provides the important possibility of passing a command to the kernel. For security reasons, some or all LILO services can be protected with a password.

The LILO boot mechanism consists of the following components:

WARNING:  Any write access (even through file movements) to any of these files corrupts the map file --- unless LILO is updated (see Updating after Changing the Configuration). This is especially important when changing kernels.

The following locations are suitable for storing the LILO boot sector:

On a Floppy Disk: This is the simplest, but also the slowest method for booting with LILO. Choose this alternative if you do not want to change the existing boot sector.

In the Boot Sector of a Primary Linux Partition on the First Hard Disk: This leaves the MBR untouched. Before it can be booted, the partition must be marked active. Start fdisk as root with the command fdisk -s partition. The program asks for a command. Obtain a list of the available commands by entering m. The a command can be used to mark a partition as active.

In the Master Boot Record: This variation offers the highest flexibility. It is the only possible alternative if all the Linux partitions reside on the second hard disk and there is no extended partition on the first drive. Every setting of the MBR must be edited with extreme care because errors may have severe consequences.

In a Boot Sector Booted by Another Boot Manager: Try this if you are using another boot manager and want to continue using it. Depending on its flexibility and power, there are several variations. A common case: you have a primary Linux partition on the second hard disk from which to boot Linux. If your boot manager is able to boot this partition through its boot sector, you may install LILO into this boot sector then tell your boot manager that the partition is active.


Configuring LILO

LILO is a flexible boot manager that offers many ways of adapting a configuration to your needs. The most important options and meanings are described below. For more detail, look at LILO User's guide.

The configuration of LILO is stored in the file /etc/lilo.conf. Always make a backup of the last working lilo.conf file before changing it. Any changes in this file take effect only when reinstalling LILO --- after running the lilo command against the changed /etc/lilo.conf file. For details, refer to Installing and Uninstalling LILO.


Structure of lilo.conf

/etc/lilo.conf starts with a global section, followed by one or more system sections for each operating system LILO should start. Each system section starts with a line beginning with image or other.

The order of entries in /etc/lilo.conf matters only in the sense that the first one in the list is booted automatically if there is no user input at the boot screen (and unless the default option is used). This happens after a certain interval set with the delay and timeout options as explained below.

A sample configuration for a computer with both Windows and Linux is shown in . The bootable systems include a newly installed Linux kernel (/boot/vmlinuz) and the original kernel, which is used as a fallback (/boot/vmlinuz.shipped). There is also an entry to boot Windows on /dev/hda1 and an additional one to start the program MemTest86.


Sample Configuration of /etc/lilo.conf

### LILO global section 
boot = /dev/hda # LILO installation target: MBR
backup = /boot/MBR.hda.990428 # backup file for the old MBR
# 1999-04-28
vga = normal # normal text mode (80x25 chars)
read-only
menu-scheme = Wg:kw:Wg:Wg
lba32 # Use BIOS to ignore
# 1024 cylinder limit
prompt
password = q99iwr4 # LILO password (example)
timeout = 80 # Wait at prompt for 8 s before
# default is booted
message = /boot/message # LILO's greeting

### LILO Linux section (default)
image = /boot/vmlinuz # Default
label = linux
root = /dev/hda7 # Root partition for the kernel
initrd = /boot/initrd

### LILO Linux section (fallback)
image = /boot/vmlinuz.shipped
label = Failsafe
root = /dev/hda7
initrd = /boot/initrd.suse
optional

### LILO other system section (Windows)
other = /dev/hda1 # Windows partition
label = windows

### LILO memory test section (memtest)
image = /boot/memtest.bin
label = memtest86

Anything between a # and the end of a line is regarded as a comment. Spaces and comments are ignored by LILO and can be used to improve readability. The entries in the above sample file include mandatory options, which are explained in the list below, and others that are described in Structure of lilo.conf.

This section merely covers the basic entries required in /etc/lilo.conf. Other useful settings can be found in the man page man lilo.conf.


Installing and Uninstalling LILO

WARNING:  Before you install LILO, make sure that any other existing operating systems can be booted from floppy disk (not possible for Windows XP, 2000, or NT). In particular, make sure fdisk is available. As far as SUSE LINUX is concerned, use the installation CD or DVD as a fallback boot medium.


Updating after Changing the Configuration

If any of the LILO components have changed, or if you have modified your configuration in /etc/lilo.conf, update the LILO boot loader. This is easily done by launching the map installer as root with the command /sbin/lilo

LILO creates a backup of the target boot sector, writes its first stage into the boot sector, then generates a new map file (also see Booting with LILO). LILO issues a report on each installed system In the case of the sample configuration described above, it should look like this:


Output after Launching LILO

Added linux * Added suse Added windows Added memtest86

When the boot loader update is completed, reboot the machine as root with shutdown -r now. While rebooting, the BIOS first performs its system test. Immediately afterwards, you should see LILO and its command prompt, where you can enter parameters and select a boot image. Press Tab to see a list of the systems installed.