SDB:The Boot Manager LILO

Şuraya atla: kullan, ara


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:

  • The LILO boot sector with the initial part (first stage) of the LILO code that activates the actual LILO when the system is booted.
  • The LILO machine code, located in /boot/boot-menu.b.
  • A map file (/boot/map), where LILO enters the location of Linux kernels and other data during its installation.
  • Optional: the message file /boot/message, which displays the graphical boot menu from which the operating system can be selected.
  • The different Linux kernels and boot sectors LILO should offer.

Caution:

Any write access (even through file movements) to any of these files corrupts the map file unless LILO is updated (see SDB:The Boot Manager LILO#sec:lilo.installieren.aendern 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 with fdisk. Start fdisk as root with the command fdisk </dev/xxx> (replace </dev/xxx> with your hard disk's device name). The program will ask for a command. Obtain a list of the available commands by entering m and display all partitions with l. 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. For Windows XP/2000/NT, refer to the article SDB:Linux and Windows NT

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's documentation.

The configuration of LILO is stored in the file /etc/lilo.conf. You should always make a backup of the last working lilo.conf file before changing it. On the other hand, any changes in this file take effect only when reinstalling LILO -- after running the lilo command for the changed /etc/lilo.conf file (section SDB:The Boot Manager LILO#sec:lilo.installieren Installing and Uninstalling LILO).

Structure of lilo.conf

/etc/lilo.conf starts with a global options section followed by one or more system or image 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 lilo.conf does matter, because the first one in the list is booted automatically if there is no user input at the boot screen (unless the default option is used). This may happen after a certain interval, which can be set with the delay and timeout options as explained below.

A sample configuration for a computer with both Windows and Linux is shown in SDB:The Boot Manager LILO#dat:lilo.minimal.config Sample Configuration. 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
   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 and others that are explained in the list below:

  • Global section (Parameter part)
    • boot=bootdevice

The device on whose first sector 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 the LILO prompt to be displayed. The default is not to display any prompt. 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=decisecond

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.

    • message = /boot/message

In former Linux versions, this was a text file in which a description of the operating system name could be stored. Current SuSE Linux versions use this file to load the splash screen.

  • 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), which 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 the LILO documentation. 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.

    • 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, you still need to execute the lilo command as root, so that LILO reinstalls the boot loader and takes the changes into account during the next boot.

  • Linux part (Linux -- safe settings)

This section is no longer available in this form in current SUSE LINUX versions. 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 will be skipped without an error message during LILO installation.

  • Other system
    • 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.

This section merely covers the basic entries required in /etc/lilo.conf. Other useful settings can be found in the man page of lilo.conf, which can be accessed with the command man lilo.conf.

Installing and Uninstalling LILO

Caution:

Before installing LILO, make sure that any other existing operating systems can be booted from floppy disk (not possible for Windows XP/2000/NT). In particular, make sure that fdisk is available. As far as SUSE LINUX is concerned, you can 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, you must update the LILO boot loader. This is easily done by launching the map installers 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. LILO issues a report on each installed system. In the case of the sample configuration described above, it should look like this:

Added linux *
Added suse
Added windows
Added memtest86

When the boot loader update is completed, you can reboot the machine by issuing this command as root: 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. You can also hit Tab to see a list of the systems installed.

Uninstalling the Linux Boot Loader

To uninstall LILO, the boot sector on which the boot loader is located needs to be overwritten with its original contents. With SUSE LINUX, this is easily done provided that there is a valid backup of that former content. This procedure is described in the article SDB:Uninstalling the Boot Manager LILO from the MBR

Caution: A boot sector backup is no longer valid if the partition in question has a new file system. The partition table of an MBR backup becomes invalid if the hard disk in question has been repartitioned since the backup was created. Obsolete backups are "time bombs": it is best to delete them as soon as possible. <keyword>lilo,boot,bootmanager,bootloader,overview</keyword>