8.5. 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]Map File Deletion through Write Access

Any write access (even through file movements) to any of these files corrupts the map file — unless LILO is updated (see Section 8.5.3.1. “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.

8.5.1. 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].

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 Section 8.5.3. “Installing and Uninstalling LILO”.

8.5.2. 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 Example 8.1. “Sample Configuration of /etc/lilo.conf”. 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.

Example 8.1. 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 Section 8.5.2. “Structure of lilo.conf”.

  • Global section (Parameter part)

    • boot=bootdevice

      The device on which the first sector of LILO should be installed. bootdevice may be a floppy disk drive (/dev/fd0), a partition (e.g., /dev/hdb3), or an entire disk (e.g., /dev/hda). In the last case, LILO would be installed in the MBR. If this option is missing, LILO is installed on the current root partition by default.

    • lba32

      With this option, ignore the 1024­-cylinder limit of LILO if your BIOS supports this.

    • prompt

      Forces display of the LILO prompt. The default is not to display any prompt (see Section 8.5.2. “Structure of lilo.conf”, option delay).

      This is recommended if LILO needs to manage more than one system. It should be used together with the timeout option to guarantee that the default system is automatically booted if nothing is entered at the prompt.

    • timeout=deciseconds Sets a time-out for selecting an operating system to boot. The default system is booted after the time-out if there is no user input. The deciseconds value specifies the time-out in tenths of a second. Pressing Shift or the arrow keys disables the time-out, causing LILO to wait for further user input. The default time-out is set to 80 (8 seconds).

  • Linux section

    • image=kernelimage

      This specifies the name of the kernel image to boot, including its directory location. With a new system, this is most likely /boot/vmlinuz.

    • label=name

      A name for the system in question (e.g., Linux). It may be freely chosen but must be unique as far as the contents of /etc/lilo.conf are concerned. Its maximum length is fifteen characters and it may only consist of letters, numbers, and underscores — no blanks or special characters. For more about the specific characters that are allowed, see [lilo], Section 3.2.1. The default for this option is the file name of the corresponding kernel image (e.g., /boot/vmlinuz).

      The same name is presented in the boot menu as one of the selectable items. If there are several systems installed, you may want to provide a more detailed description of the bootable systems by creating a message file (see Section 8.5.2. “Structure of lilo.conf”, option message).

    • root=rootdevice

      This is used by LILO to tell the kernel about the name of the root partition (e.g., /dev/hda2) of your Linux system. You should use this option to be on the safe side: if it is omitted, the kernel just assumes that the root partition is identical with its own root device (as derived from kernelimage).

    • append=parameter

      To pass additional boot parameters to the kernel, add the append option to an existing lilo.conf file followed by a = and your parameters. Individual parameters must be separated by spaces and the parameter string as a whole must be enclosed in quotation marks. After saving the file, execute the lilo command as root, so LILO reinstalls the boot loader and takes the changes into account during the next boot.

  • Linux part (Linux — Safe Settings)

    Even if you installed a customized kernel, you are still able to boot the SUSE standard kernel.

    • optional

      If you decide to delete /boot/vmlinuz.shipped (not recommended), this section is skipped without an error message during LILO installation.

  • Other systems

    • other=partition

      other tells LILO to start the partitions of other systems (e.g., /dev/hda1).

    • label=name

      Select a name for the system. This is recommended, because the default — the raw device name — is not very informative.

  • Memory Test

    Entry for the memory test program memtest86.

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.

8.5.3. Installing and Uninstalling LILO

[Warning]Booting Other Operating Systems

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.

8.5.3.1. 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 Section 8.5. “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:

Example 8.2. 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.