LILO - Generic Boot Loader for Linux ("LInux LOader") by Werner Almesberger =========================================================================== Important: The file INCOMPAT contains vital (in)compatibility information for this release of LILO. Read it before proceeding. Installing boot loaders is inherently dangerous. Be sure to have some means to boot your system from a different media if you install LILO on your hard disk. ! STOP READING HERE IF YOU CAN USE THE LaTeX VERSION OF THE DOCUMENTATION ! The LaTeX part contains introductory sections that are missing in the README. Installation ------------ Please read the file INCOMPAT for compatibility notes. The installation procedure is described in the section "Normal first-time installation". Please read "Booting basics" in the LaTeX document for the whole story. *** QUICK INSTALLATION *** If you want to install LILO on your hard disk and if you don't want to use all its features, you can use the quick installation script. Read QuickInst or QuickInst.old for details. LILO is a versatile boot loader for Linux. It does not depend on a specific file system, can boot Linux kernel images from floppy disks and from hard disks and can even boot other operating systems.* * PC/MS-DOS, DR DOS, OS/2, 386BSD, SCO UNIX, Unixware, ... One of up to sixteen different images can be selected at boot time. Various parameters, such as the root device, can be set independently for each kernel. LILO can even be used as the master boot record. This document introduces the basics of disk organization and booting, continues with an overview of common boot techniques and finally describes installation and use of LILO in greater detail. The troubleshooting section at the end describes diagnostic messages and contains suggestions for most problems that have been observed in the past. Please read the sections about installation and configuration if you're already using an older version of LILO. This distribution is accompanied by a file named INCOMPAT that describes further incompatibilities to older versions. For the impatient: there is a quick-installation script to create a simple but quite usable installation. See section "Quick installation" for details. But wait ... here are a few easy rules that will help you avoiding most problems people experience with LILO: - _Don't panic._ If something doesn't work, try to find out what is wrong, try to verify your assumption and only then attempt to fix it. - Read the documentation. Especially if what the system does doesn't correspond to what you think it should do. - Make sure you have an emergency boot disk, that you know how to use it, and that it is always kept up to date. - Run /sbin/lilo _whenever_ the kernel or any part of LILO, including its configuration file, has changed. - If using LILO as the MBR, de-install it _before_ performing a destructive upgrade and/or erasing your Linux partitions. - Don't trust setup scripts. Always verify the /etc/lilo.conf they create before booting. - If using a big disk, be prepared for inconveniences: you may have to use the LINEAR option. Introduction ============ The following sections describe how PCs boot in general and what has to be known when booting Linux and using LILO in particular. Disk organization ----------------- When designing a boot concept, it is important to understand some of the subtleties of how PCs typically organize disks. The most simple case are floppy disks. They consist of a boot sector, some administrative data (FAT or super block, etc.) and the data area. Because that administrative data is irrelevant as far as booting is concerned, it is regarded as part of the data area for simplicity. +---------------------------+ |Boot sector| | |-----------+ | | | | Data area | | | | | +---------------------------+ The entire disk appears as one device (e.g. /dev/fd0) on Linux. The MS-DOS boot sector has the following structure: +------------------------+ 0x000 |Jump to the program code| |------------------------| 0x003 | | | Disk parameters | | | |------------------------| 0x02C/0x03E | | | Program code | | | | | |------------------------| 0x1FE | Magic number (0xAA55) | +------------------------+ LILO uses a similar boot sector, but it does not contain the disk parameters part. This is no problem for Minix, Ext2 or similar file systems, because they don't look at the boot sector, but putting a LILO boot sector on an MS-DOS file system would make it inaccessible for MS-DOS. Hard disks are organized in a more complex way than floppy disks. They contain several data areas called partitions. Up to four so-called primary partitions can exist on an MS-DOS hard disk. If more partitions are needed, one primary partition is used as an extended partition that contains several logical partitions. The first sector of each hard disk contains a partition table, and an extended partition and _each_ logical partition contains a partition table too. +--------------------------------------------+ | Partition table /dev/hda | | +------------------------------------------| | | Partition 1 /dev/hda1 | | | | | |------------------------------------------| | | Partition 2 /dev/hda2 | | | | +--------------------------------------------+ The entire disk can be accessed as /dev/hda, /dev/hdb, /dev/sda, etc. The primary partitions are /dev/hda1 ... /dev/hda4. +--------------------------------------------+ | Partition table /dev/hda | | +------------------------------------------| | | Partition 1 /dev/hda1 | | | | | |------------------------------------------| | | Partition 2 /dev/hda2 | | | | | |------------------------------------------| | | Extended partition /dev/hda3 | | | +----------------------------------------| | | | Extended partition table | | | |----------------------------------------| | | | Partition 3 /dev/hda5 | | | | | | | |----------------------------------------| | | | Extended partition table | | | |----------------------------------------| | | | Partition 4 /dev/hda6 | | | | | +--------------------------------------------+ This hard disk has two primary partitions and an extended partition that contains two logical partitions. They are accessed as /dev/hda5 ... Note that the partition tables of logical partitions are not accessible as the first blocks of some devices, while the main partition table, all boot sectors and the partition tables of extended partitions are. Partition tables are stored in partition boot sectors. Normally, only the partition boot sector of the entire disk is used as a boot sector. It is also frequently called the master boot record (MBR). +------------------------+ 0x000 | | | Program code | | | | | |------------------------| 0x1BE | Partition table | | | |------------------------| 0x1FE | Magic number (0xAA55) | +------------------------+ The LILO boot sector is designed to be usable as a partition boot sector. (I.e. there is room for the partition table.) Therefore, the LILO boot sector can be stored at the following locations: - boot sector of a Linux floppy disk. (/dev/fd0, ...) - MBR of the first hard disk. (/dev/hda, ...) - boot sector of a primary Linux file system partition on the first hard disk. (/dev/hda1, ...) - partition boot sector of an extended partition on the first hard disk. (/dev/hda1, ...)* * Most FDISK-type programs don't believe in booting from an extended partition and refuse to activate it. LILO is accompanied by a simple program (activate) that doesn't have this restriction. Linux fdisk also supports activating extended partitions. It _can't_ be stored at any of the following locations: - boot sector of a non-Linux floppy disk or primary partition. - a Linux swap partition. - boot sector of a logical partition in an extended partition.* - on the second hard disk. (Unless for backup installations, if the current first disk will be removed or disabled, or if some other boot loader is used, that is capable of loading boot sectors from other drives.) * LILO can be forced to put the boot sector on such a partition by using the -b option or the BOOT variable. However, only few programs that operate as master boot records support booting from a logical partition. LILO typically doesn't detect attempts to put its boot sector at an invalid location. Choosing the "right" boot concept ----------------------------------- Although LILO can be installed in many different ways, the choice is usually limited by the present setup and therefore, typically only a small number of configurations which fit naturally into an existing system remains. The configuration file /etc/lilo.conf for the examples could look like this: boot = /dev/hda2 compact image = /vmlinuz image = /vmlinuz.old other = /dev/hda1 table = /dev/hda label = msdos It installs a Linux kernel image (/vmlinuz), an alternate Linux kernel image (/vmlinuz.old) and a chain loader to boot MS-DOS from /dev/hda1. The option COMPACT on the second line instructs the map installer to optimize loading. In all examples, the names of the IDE-type hard disk devices (/dev/hda...) are used. Everything applies to other disk types (e.g. SCSI disks; /dev/sda...) too. One disk, Linux on a primary partition - - - - - - - - - - - - - - - - - - - If at least one primary partition of the first hard disk is used as a Linux file system (/, /usr, etc. but _not_ as a swap partition), the LILO boot sector should be stored on that partition and it should be booted by the original master boot record or by a program like BOOTACTV. +--------------------------+ | MBR /dev/hda | | +------------------------| | | MS-DOS /dev/hda1 | | |------------------------| --> | | Linux / /dev/hda2 | +--------------------------+ In this example, the BOOT variable could be omitted, because the boot sector is on the root partition. One disk, Linux on a logical partition - - - - - - - - - - - - - - - - - - - If no primary partition is available for Linux, but at least one logical partition of an extended partition on the first hard disk contains a Linux file system, the LILO boot sector should be stored in the partition sector of the extended partition and it should be booted by the original master boot record or by a program like BOOTACTV. +--------------------------+ | MBR /dev/hda | | +------------------------| | | MS-DOS /dev/hda1 | | |------------------------| --> | | Extended /dev/hda2 | | | +----------------------| | | | Linux /dev/hda5 | | | |----------------------| | | | ... /dev/hda6 | +--------------------------+ Because many disk partitioning programs refuse to make an extended partition (in our example /dev/hda2) active, you might have to use activate, which comes with the LILO distribution. OS/2 BootManager should be able to boot LILO boot sectors from logical partitions. The installation on the extended partition itself is not necessary in this case. Two disks, Linux (at least partially) on the first disk - - - - - - - - - - - - - - - - - - - - - - - - - - - - This case is equivalent to the configurations where only one disk is in the system. The Linux boot sector resides on the first hard disk and the second disk is used later in the boot process. Only the location of the boot sector matters - everything else (/boot/boot.b, /boot/map, the root file system, a swap partition, other Linux file systems, etc.) can be located anywhere on the second disk. Two disks, Linux on second disk, first disk has an extended partition - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - If there is no Linux partition on the first disk, but there is an extended partition, the LILO boot sector can be stored in the partition sector of the extended partition and it should be booted by the original master boot record or by a program like BOOTACTV. FIRST DISK SECOND DISK +--------------------------+ +--------------------------+ | MBR /dev/hda | | MBR /dev/hdb | | +------------------------| | +------------------------| | | MS-DOS /dev/hda1 | | | Linux /dev/hdb1 | | |------------------------| | |------------------------| --> | | Extended /dev/hda2 | | | ... /dev/hdb2 | | | +----------------------| | | | | | | ... /dev/hda5 | | | | | | |----------------------| | | | | | | ... /dev/hda6 | | | | +--------------------------+ +--------------------------+ The program activate, that accompanies LILO, may have to be used to set the active marker on an extended partition, because MS-DOS' FDISK and some older version of Linux fdisk refuse to do that. (Which is generally a good idea.) Two disks, Linux on second disk, first disk has no extended partition - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - If there is neither a Linux partition nor an extended partition on the first disk, then there's only one place left, where a LILO boot sector could be stored: the master boot record. In this configuration, LILO is responsible for booting all other operating systems too. FIRST DISK SECOND DISK +--------------------------+ +--------------------------+ --> | MBR /dev/hda | | MBR /dev/hdb | | +------------------------| | +------------------------| | | MS-DOS /dev/hda1 | | | Linux /dev/hdb1 | | |------------------------| | |------------------------| | | ... /dev/hda2 | | | ... /dev/hdb2 | +--------------------------+ +--------------------------+ You should back up your old MBR before installing LILO and verify that LILO is able to boot your other operating system(s) before relying on this approach. The line boot = /dev/hda2 in /etc/lilo.conf would have to be changed to boot = /dev/hda in this example. The boot prompt =============== Immediately after it's loaded, LILO checks whether one of the following is happening: - any of the [Shift], [Control] or [Alt] keys is being pressed. - [CapsLock] or [ScrollLock] is set. If this is the case, LILO displays the boot: prompt and waits for the name of a boot image (i.e. Linux kernel or other operating system). Otherwise, it boots the default boot image* or - if a delay has been specified - waits for one of the listed activities until that amount of time has passed. * The default boot image is either the first boot image, the image specified with the DEFAULT variable, or the image that has been selected at the boot prompt. At the boot prompt, the name of the image to boot can be entered. Typing errors can be corrected with [BackSpace], [Delete], [Ctrl U] and [Ctrl X]. A list of known images can be obtained by pressing [?] (on the US keyboard) or [Tab]. If [Enter] is pressed and no file name has been entered, the default image is booted. Boot command-line options ------------------------- LILO is also able to pass command-line options to the kernel. Command-line options are words that follow the name of the boot image and that are separated by spaces. Example: boot: linux single root=200 Standard options - - - - - - - - The 1.1.54 kernel recognizes the options debug , no387 , no-hlt , ramdisk= , reserve=,,... , root= , ro , and rw , and all current init programs also recognize the option single . The options lock and vga are processed by the boot loader itself. Boot command-line options are always case-sensitive. single boots the system in single-user mode. This bypasses most system initialization procedures and directly starts a root shell on the console. Multi-user mode can typically be entered by exiting the single-user shell or by rebooting. root= changes the root device. This overrides settings that may have been made in the boot image and on the LILO command line. is either the hexadecimal device number or the full path name of the device, e.g. /dev/hda3.* * The device names are hard-coded in the kernel. Therefore, only the "standard" names are supported and some less common devices may not be recognized. In those cases, only numbers can be used. reserve=,,... reserves IO port regions. This can be used to prevent device drivers from auto-probing addresses where other devices are located, which get confused by the probing. ro instructs the kernel to mount the root file system read-only. rw mounts it read-write. If neither ro nor rw is specified, the setting from the boot image is used. no-hlt avoids executing a HLT instructions whenever the system is idle. HLT normally significantly reduces power consumption and therefore also heat dissipation of the CPU, but may not work properly with some clone CPUs. no387 disables using the hardware FPU even if one is present. debug enables more verbose console logging. vga= alters the VGA mode set at startup. The values normal , extended , ask or a decimal number are recognized. (See also "Booting kernel images from a file".) Finally, lock stores the current command-line as the default command-line, so that LILO boots the same image with the same options (including lock ) when invoked the next time. Device-specific options - - - - - - - - - - - - There is also a large number of options to specify certain characteristics (e.g. IO and memory addresses) of devices. The 1.1.54 kernel understands the following device options (if the corresponding devices are included): ether , max_scsi_luns , hd , st , bmouse , st0x , tmc8xx , t128 , pas16 , ncr5380 , aha152x , xd , mcd , sound , and sbpcd . The usage of these options is