4.2. LILO: The Linux Loader
Once you've made the decision to install LILO, you still need to
decide how it should be configured. If you want your system to
dual boot Linux and Windows 95/98, you can install LILO on the master
boot record (MBR) and set it up to let you select the system to
boot. Dual booting Linux and Windows NT is not quite as
straightforward, because Windows NT has its own loader on the MBR, and
it expects to be the one in charge. Therefore, you need to make Linux
an option in the NT loader and install LILO in the Linux partition as
a secondary boot loader. The result is that the Windows NT loader
transfers control to LILO, which then boots Linux.
The same applies to
Windows 2000, which uses the NT loader. See Section 4.4, "Dual Booting Linux and Windows NT/2000" later in this chapter for more information.
In addition to booting Linux, LILO can boot other operating systems,
such as MS-DOS, Windows 95/98, or OS/2. During installation, the
major Linux distributions provide the opportunity to install LILO; it
can also be installed later if necessary. LILO can be installed on the
master boot record (MBR) of your hard drive or as a secondary boot
loader on the Linux partition. LILO consists of several pieces,
including the boot loader itself, a configuration file
(/etc/lilo.conf), a map
file (/boot/map) containing the location of the
kernel, and the lilo command
(/sbin/lilo), which reads the configuration file
and uses the information to create or update the map file and to
install the files LILO needs.
If LILO is installed on the MBR, it replaces the MS-DOS boot
loader. If you have problems with your installation or you simply want
to uninstall LILO and restore the original boot loader, you can do one
of the following:
One thing to remember about LILO is that it has two aspects: the boot
loader and the lilo command. The
lilo command configures and installs
the boot loader and updates it as necessary. The boot loader is the
code that executes at system boot time and boots Linux or another
4.2.1. The LILO Configuration File
The lilo command reads the LILO
configuration file, /etc/lilo.conf, to get the
information it needs to install LILO. Among other things, it builds a
map file containing the locations of all disk sectors needed for
Note that any time you change /etc/lilo.conf or
rebuild or move a kernel image, you need to rerun lilo to rebuild the map file and update LILO.
The configuration file starts with a section of global options,
described in the next section. Global options are those that apply to
every system boot, regardless of what operating system you are
booting. Here is an example of a global section (a hash sign,
#, begins a comment):
boot = /dev/hda # The boot device is /dev/hda
map = /boot/map # Save the map file as /boot/map
install = /boot/boot.b # The file to install as the new boot sector
prompt # Always display the boot prompt
timeout = 30 # Set a 3-second (30 tenths of a second) timeout
Following the global section, there is one section of options for each
Linux kernel and for each non-Linux operating system that you want
LILO to be able to boot. Each of those sections is referred to as an
image section, because each boots a different
kernel image (shorthand for a binary file containing a kernel) or
another operating system. Each Linux image section begins with an
image = /boot/vmlinuz # Linux image file
label = linux # Label that appears at the boot prompt
root = /dev/hda2 # Location of the root filesystem
vga = ask # Always prompt the user for VGA mode
read-only # Mount read-only to run fsck for a filesystem check
section for a non-Linux operating system begins with other= instead
of image=. For example:
other = /dev/hda1 # Location of the partition
label = dos
table = /dev/hda # Location of the partition table
Put LILO configuration options that apply to all images into the global
section of /etc/lilo.conf and options that apply to a
particular image into the section for that image. If an option is specified in
both the global section and an image section, the setting in the image
section overrides the global setting for that image.
Here is an example of a complete /etc/lilo.conf file for a system
that has the Linux partition on /dev/hda2:
## Global section
## Image section: For regular Linux
## Image section: For testing a new Linux kernel
optional # Omit image if not available when map is built
## Image section: For booting DOS
table=/dev/hda # The current partition table
## Image section: For booting Windows 95
126.96.36.199. Global options
In addition to the options listed here, the kernel options append, read-only, read-write, root, and vga
(described in Section 188.8.131.52, "Kernel options" later) also can be set as
Copies the original boot sector to backup-file instead of to the file
/boot/boot.nnnn, where nnnn is a number that depends on the disk
Sets the name of the device that contains
the boot sector. boot defaults to the device currently mounted as root,
such as /dev/hda2. Specifying a device such as /dev/hda
(without a number)
indicates that LILO should be installed in the master boot record;
the alternative is to
set it up on a particular partition such as /dev/hda2.
Merges read requests for adjacent disk sectors to speed up booting. Use
of compact is particularly recommended when booting from a floppy disk. Use of compact may conflict with linear.
Uses the image name as the default boot image.
If default is omitted, the first image specified
in the configuration file is used.
Specifies, in tenths of a second, how long the boot loader should
wait before booting the default image. If serial is set,
delay is set to 20 at a minimum. The default is to not wait.
Defines parameters for the disk specified by
device-name if LILO can't figure them
out. Normally, LILO can determine the disk parameters itself and this
option isn't needed. When disk is
specified, it is followed by one or more parameter lines, such as:
bios= 0x80 # First disk is usually 0x80, second is usually 0x81
Note that this option is not the same as the disk geometry parameters
you can specify with the hd boot command-line
option. With disk,
the information is given to LILO; with hd,
it is passed to the kernel.
The parameters that can be specified with disk
are listed briefly here. They are described in detail
in the LILO User's Guide, which comes with the LILO distribution.
The number the BIOS uses to refer to the device. See the previous
The number of cylinders on the disk.
The number of heads on the disk.
Tells LILO that the BIOS can't read the disk; used to prevent the system
from becoming unbootable if LILO thinks the BIOS can read it.
Starts a new section for a partition. The section contains one variable,
start=partition-offset, which specifies the zero-based number
of the first sector of the partition:
The number of sectors per track.
This option has been superseded by the
If set, allows lilo to adjust 3D addresses (addresses
specified as sector/head/cylinder) in partition tables. This is sometimes
necessary if a partition isn't track-aligned and another operating system
such as MS-DOS is on the same disk. See the lilo.conf
manpage for details.
Like backup but overwrites an old backup
copy if one exists.
Tells lilo to ignore corrupt partition tables.
Installs the specified file as the new boot sector.
If install is omitted, the boot sector defaults to /boot/boot.b.
Generates 32-bit Logical Block Addresses instead of sector/head/cylinder
addresses, allowing booting from any partition on hard disks greater than
8.4GB (i.e., it removes the 1024-cylinder limit). Requires BIOS support
for the EDD packet
and at least LILO Version 21-4.
If your BIOS is dated after 1998, it should
include EDD packet call interface support.
Generates linear sector addresses, which do not depend on disk
geometry, instead of 3D (sector/head/cylinder) addresses. If LILO can't
determine your disk's geometry itself, you can try using linear; if
that doesn't work, then you need to specify the geometry with disk=. Note, however, that linear sometimes doesn't work with floppy disks,
and it may conflict with compact.
Tells LILO to record the boot command line and use it as the default
for future boots until it is overridden by a new boot command
line. lock is useful if there is a set
of options that you need to enter on the boot command line every time
you boot the system.
Specifies the location of the map file. Defaults to
Specifies a file containing a message to be
displayed before the boot prompt. The message can include a formfeed character
(Ctrl-L) to clear the screen. The map
file must be rebuilt by rerunning the lilo command if the
message file is changed or moved. The maximum length of the file
is 65,535 bytes.
Disables warning messages.
Specifies that any image that is not available when the map is created
should be omitted and not offered as an option at the boot prompt. Like
the per-image option optional but applies to all images.
Specifies a password that the user is prompted to enter when trying to
load an image. The password is not encrypted in the configuration file,
so if passwords are used, permissions should be set so that
only the superuser is able to read the
file. This option is like the per-image version, except that all images are
password-protected and they all have the same password.
Automatically displays the boot prompt without waiting for the user to
press the Shift, Alt, or Scroll Lock key. Note that setting
prompt without also setting timeout prevents
Can be used with password to indicate that a password needs to
be entered only if the user specifies parameters on the command line. Like the
per-image restricted option but applies to all images.
Allows the boot loader to accept input from a serial line as well as from
the keyboard. Sending a break on the serial line corresponds to
pressing a Shift key on the console to get the boot loader's
attention. All boot images should be password-protected if serial access
is insecure (e.g., if the line is connected to a modem). Setting serial
automatically raises the value of delay to 20 (i.e., 2 seconds) if
it is less than that.
The parameter string parameters has the following syntax:
For example, to initialize COM1 with the default parameters:
The parameters are:
The port number of the serial port. The default is 0, which corresponds
to COM1 (/dev/ttys0). The value can be one of 0 through 3, for the four
possible COM ports.
The baud rate of the serial port. Possible values of bps are
110, 300, 1200, 2400, 4800, 9600, 19200, and 38400. The default is 2400 bps.
The parity used on the serial line. Parity is specified as: n or N
for no parity, e or E for even parity, and o or O for odd parity. However, the
boot loader ignores input parity and strips the 8th bit.
Specifies whether a character contains 7 or 8 bits. Default is 8 with
no parity and 7 otherwise.
Sets a timeout (specified in tenths of a second) for keyboard
input. If no key has been pressed after the specified time,
the default image is
booted automatically. timeout is also used to determine when to
stop waiting for password input. The default timeout is infinite.
Turns on verbose output, where higher values of level produce
more output. If -v is also
specified on the lilo command line, the level is
incremented by 1 for each occurrence of -v. The maximum
verbosity level is 5.
184.108.40.206. Image options
The following options are specified for a particular image.
Provides an alternate name for the image that can be used instead of the name
specified with the label option.
Specifies the file or device containing the boot image of a bootable
Linux kernel. Each per-image section that specifies a bootable Linux kernel
starts with an image option. See also the range option.
Specifies the name that is used for the image at the boot prompt. Defaults
to the filename of the image file (without the path).
For a non-Linux operating system, specifies
the chain loader to which LILO should pass control for booting that
operating system. The default
is /boot/chain.b. If the system will be booted from a
drive that is neither the first hard disk or a floppy, the chain loader
must be specified.
Like lock as described in the global options
section; it can also be specified in an image section.
Specifies that the image should be omitted if it is not available when the
map is created by the lilo command. Useful for
specifying test kernels that are not always present.
Specifies that the image is password-protected and provides the password
that the user is prompted for when booting. The password is not encrypted
in the configuration file, so if passwords are used, only
the superuser should be able to read the file.
Used with the image option, when the image is specified as a device
(e.g., image=/dev/fd0), to indicate the range of
sectors to be mapped into the map file. sectors can be given as
the range start-end or as start+number, where
start and end are zero-based sector
numbers and number is the increment beyond start to include.
If only start is specified, only that one sector is mapped. For
image = /dev/fd0
range = 1+512 # take 512 sectors, starting with sector 1
Specifies that a password is required for booting the image only if boot
parameters are specified on the command line.
Specifies, for a non-Linux operating system,
the device that contains the partition table. If table is
omitted, the boot loader does not pass partition information
to the operating system being booted. Note that /sbin/lilo
must be rerun if the partition table is modified. This option cannot be
used with unsafe.
Can be used in the per-image section for a non-Linux operating system
to indicate that the boot sector should not be accessed when the map
is created. If unsafe is specified,
then some checking isn't done, but the option can be useful for running the
lilo command without having to insert
a floppy disk when the boot sector is on a fixed-format floppy disk
device. This option cannot be used with table.
220.127.116.11. Kernel options
The following kernel options can be specified in
/etc/lilo.conf as well as on the boot command
Appends the options specified in string to the parameter line
passed to the kernel. This typically is used to
specify certain hardware parameters. For example,
if your system has more
than 64 MB of memory (i.e., more than your BIOS can recognize), you can
append = "mem=128M"
Specifies the file to load into /dev/initrd when booting with
a RAM disk. See also the options load_ramdisk (in Section 4.5, "Boot-time Kernel Options"), prompt_ramdisk,
ramdisk_size, and ramdisk_start (in Section 4.6, "initrd: Using a RAM Disk").
Like append but replaces all other kernel boot options.
Preserves the contents of /dev/initrd so they
can be read once after the kernel is booted.
Specifies whether the kernel should prompt you to insert the floppy disk
that contains the RAM disk image, for use during Linux installation. Values
of n are:
Don't prompt. Usually used for an installation in which the kernel and the
RAM disk image both fit on one floppy.
Prompt. This is the default.
Obsolete; use only with kernels older than Version 1.3.48.
For newer kernels, see the option load_ramdisk in Section 4.5, "Boot-time Kernel Options" as well as prompt_ramdisk,
ramdisk_size, and ramdisk_start, elsewhere in this section.
Specifies the amount of memory, in kilobytes, to be allocated for the RAM
disk. The default is 4096, which allocates 4 megabytes.
Used for a Linux installation in which both the kernel and the RAM disk image
are on the same floppy. offset indicates the offset on the floppy
where the RAM disk image begins; it is specified in kilobytes.
Specifies the device that should be mounted as
root. If the special name current is used as the value, the
root device is set to the device on which the root
filesystem currently is mounted. Defaults to the root-device
setting contained in the kernel image.
Specifies the VGA text mode that should be
selected when booting. mode defaults to the VGA mode setting in the kernel
image. The values are case-insensitive. They are:
Prompts the user for the text mode. Pressing Enter in response to the prompt
displays a list of the available modes.
- extended (or ext)
Selects 80x50 text mode.
Selects normal 80x25 text mode.
Use the text mode that corresponds to number. A list
of available modes for your video card can be obtained by booting with
vga=ask and pressing Enter.
4.2.2. The lilo Command
You need to run the lilo command to
install the LILO boot loader and to update it whenever the kernel
changes or to reflect changes to /etc/lilo.conf.
The path to the
lilo command is usually
/sbin/lilo. The syntax of the command is:
Some of the options
correspond to /etc/lilo.conf keywords:
These options should be put in the configuration file
whenever possible; putting
them on the lilo command line instead of in /etc/lilo.conf
is now deprecated. The next section describes those options that can be
given only on the lilo command line; the others are described earlier in this section.
4.2.3. lilo Command Options
The following list describes those lilo
command options that are available only on the command line. Multiple
options are given separately:
% lilo -q -v
- -C config-file
Specifies an alternative to the default configuration file
(/etc/lilo.conf). lilo uses the configuration file to
determine what files to map when it installs LILO.
- -I label
Prints the path to the kernel specified by label
to standard output or an error message if no matching label is found. For
% lilo -I linux
Lists the currently mapped files. lilo
maintains a file (by default /boot/map), containing
the name and location of the kernel(s) to boot. Running
lilo with this option
prints the names of the files in the map file to standard output, as in this
example (in which the asterisk indicates that
linux is the default):
% lilo -q
- -r root-directory
Specifies that before doing anything else, lilo should
chroot to the indicated directory. Used for repairing a setup
from a boot floppy -- you can boot from a floppy but have lilo use
the boot files from the hard drive. For example, if you issue the following
commands, lilo will get the files it needs
from the hard drive:
% mount /dev/hda2 /mnt
% lilo -r /mnt
- -R command-line
Sets the default command for the boot
loader the next time it executes. The command executes once and
then is removed by the boot loader. This option
typically is used in reboot scripts, just before calling shutdown -r.
Indicates that this is a test. Does not really write a new boot sector or
map file. Can be used with -v to find out what
lilo would do during a normal run.
- -u device-name
Uninstalls lilo by restoring the saved boot sector
from /boot/boot.nnnn, after validating it against
a timestamp. device-name is the name of the device on which LILO
is installed, such as /dev/hda2.
- -U device-name
Like -u but does not check the timestamp.
Prints the lilo version number.
Copyright © 2001 O'Reilly & Associates. All rights reserved.