Red Hat Linux: LiloLILOWhenever you hear about Linux, you\\\\'ll also hear about LILO. LILO is the boot
loader used by Linux to load the operating system kernel. Whenever the Linux
kernel is changed or moved, LILO must be invoked to rebuild a map of the kernel
locations. LILO is versatile; it can boot Linux kernels from any type of file
system, including floppy disk, as well as from other operating systems. This chapter looks at LILO, the way hard disks are laid out with Linux, the
boot process, and the most common boot processes and LILO\\\\'s interactions with
each. This should help you install and use LILO efficiently and effectively. LILO (which means LInux LOader) is a bit tricky to use if you are not
familiar with it and its purpose. You need to install the LILO program, which
changes the boot sector of your hard drive to allow you to choose between a DOS
or a Linux partition as the boot source partition. LILO is included with Red Hat
Linux and is installed automaically when you load the system from CD-ROM. Some of the features of LILO include the following:
Using LILO may seem risky at first; it can ruin your hard drive or leave you
with a system that you cannot boot. To prepare yourself for this mishap, keep a
boot disk handy. Also, you have to do this installation as root, so be careful.
If you have already installed Red Hat Linux, the LILO files will exist on
your hard drive. If you are about to install Red Hat Linux, the LILO
installation routine will be activated automatically as part of the installation
process. If you want to redo the LILO system at any time, though, you can run
the program /sbin/liloconfig. The liloconfig program is easy to use and asks several questions about your
system. The sheer number of possibilities cannot be completely covered here, but
here are the terms with which you must be familiar:
The liloconfig program asks you where you want to install LILO. If you are
running multiple operating systems and plan to switch between them often, try
installing on the Linux partition superblock. If you will use Linux primarily or
only, install on the Master Boot Record. You will then be asked about the
ability to load other operating systems from the boot prompt, and you get to
identify each operating system and provide a name for it. This lets you start
DOS, for example, from the boot prompt by entering the name you assigned to DOS
partition. After the liloconfig program has run, it will create a file called lilo.conf
for you in the /etc directory. If you already have this file in your /etc
directory, you can edit it manually using any ASCII editor. Of course, depending
on how your system is set up, the contents of your Linux installation may vary.
A sample lilo.conf file for a system containing both DOS and Linux looks like
this: boot=/dev/hda In this lilo.conf file, you can see two different kernels that can be booted
from /dev/hda. The first image is the default image, called vmlinuz. The other
image is labeled DOS for the DOS partition. Typing dos at the boot prompt will
boot this partition. LILO Command-Line Arguments The LILO configuration is written to disk using the /sbin/lilo command. The /sbin/lilo
installer accepts several command-line options. A few of the more usual ones are
listed here.
Configuration Parameters The /etc/lilo.conf file can have the following parameters. All of these can
be set from the command line, but storing them in a configuration file is more
reliable. The following options are available to you:
. The number of the serial port, zero-based. 0 corresponds to
COM1. alias /dev/ttyS0, alias /dev/ttys1, alias /dev/ttys2, alias
/dev/ttys3. All four ports can be used (if present). . The baud rate of the serial port. The following baud rates are
supported: 110, 150, 300, 600, 1200, 2400, 4800, and 9600 bps. Default
is 2400 bps. . The parity used on the serial line. LILO ignores input
parity and strips the eighth bit. The following (upper- or lowercase)
characters are used to describe the parity: n for no parity, e for even
parity, and o for odd parity. . The number of bits in a character. Only 7 and 8 bits are
supported. Default is 8 if parity is none, 7 if parity is even or odd.
The kernel configuration parameters append, ramdisk, read-only, read-write,
root, and vga can be set in the options section. They are used as defaults if
they aren\\\\'t specified in the configuration sections of the respective kernel
images. If the option -q is specified on the command line, the currently mapped files
are listed. Otherwise, a new map is created for the images described in the
configuration file /etc/lilo/config and they are written to in the boot sector.
The boot Prompt When the system boots up, after the keyboard test, press and hold down one of
any one of these keys: Alt, Shift, or Ctrl (or you can set the Caps Lock or
Scroll Lock key). If any of these keys are pressed, LILO displays the boot:
prompt and waits for the name of a boot image. Pressing the Tab key or typing ?
gives you a list of names recognized by LILO. If you do not press any of these
keys, LILO will boot up the first it finds in the lilo.conf file kernel (in this
case, vmlinuz.cd) if there is no timeout specified in the /etc/lilo.conf file.
LILO can also pass command-line options to the kernel. Command-line options
are words that follow the name of the boot image and are separated by spaces.
Currently, the kernel recognizes the options root=, ro, and rw, and all
current init programs also recognize the option single, which boots the system
in single-user mode. This bypasses all system-initialization procedures and
directly starts a root shell on the console. Multiuser mode can be entered by
exiting the single-user shell or by rebooting. The option vga is processed by the boot loader itself. The option vga=
alters the VGA mode that was set at startup. The legal values for mode are
NORMAL, EXTENDED, ASK, or a decimal number for the BIOS mode command. You can
get a list of available modes by typing vga=ask and pressing Enter. The root= option changes the root device. This overrides settings
that may have been made in the boot image and on the LILO command line. is either a hexadecimal device number or the full pathname
of the device, such as /dev/hda3. (The device names are hard-coded in
the kernel.) ro instructs the kernel to mount the root file system as read-only.
rw mounts it as read-write. If neither ro nor rw is specified, the
setting from the boot image is used. The no387 option disables using the hardware FPU. Depending on the kernel configuration, some special configuration options for
nonstandard hardware might be recognized as well. Some of these boot prompts
include the following :
The parameters for each type of device will come with their documentation, so
do not assume anything. Use only specified values. If you do follow
instructions, you may wind up causing irrecoverable errors, which may lead to a
corrupt file system. Uninstalling LILO In order to keep LILO from being invoked when the system boots, its boot
sector has to be either removed or disabled. All other files belonging to LILO
can be deleted after removing the boot sector, if desired. LILO 0.14 (and newer) can be uninstalled with the lilo -u command. If LILO\\\\'s boot sector has been installed on a primary partition and is booted
by the standard MBR or some partition-switching program, it can be disabled by
making a different partition active. MS-DOS\\\\'s FDISK, Linux\\\\'s fdisk, or LILO\\\\'s
activate can do that. If LILO\\\\'s boot sector is the Master Boot Record (MBR) of a disk, it has to be
replaced with a different MBR, typically MS-DOS\\\\'s standard MBR. When using
MS-DOS 5.0 or above, the MS-DOS MBR can be restored with FDISK /MBR. This alters
only the boot loader code, not the partition table. LILO automatically makes
backup copies when it overwrites boot sectors. They are named /etc/lilo/boot.,
with corresponding to the device number—that is, 0300 is /dev/hda, 0800
is /dev/sda, and so on. Those backups can be used to restore the old MBR if no
easier method is available. The commands are or respectively.
Map Installer Errors Some messages that indicate common errors when installing the maps are as
follows:
LILO Error Codes When LILO loads itself, it displays the word LILO. Each letter is printed
before or after performing some specific action. If LILO fails at some point,
the letters printed so far can be used to identify the problem. This is
described in more detail in the technical overview. Note that some hex digits may be inserted after the first L if a transient
disk problem occurs. Unless LILO stops at that point, generating an endless
stream of error codes, such hex digits do not indicate a severe problem. The
following is the list of error messages you can see: (nothing) No part of LILO has been loaded. LILO either isn\\\\'t
installed, or the partition on which its boot sector is located isn\\\\'t
active. L The first stage boot loader has been loaded and started, but
it can\\\\'t load the second stage boot loader. The two-digit error codes
indicate the type of problem. (They are described in the next section.)
This condition usually indicates a media failure or a geometry mismatch
(that is, bad parameters in /etc/lilo/disktab). LI The first-stage boot loader was able to load the second-stage boot
loader but has failed to execute it. This can be caused either by a
geometry mismatch or by moving /etc/lilo/boot.b without running the map
installer. LIL The second-stage boot loader has been started, but it can\\\\'t load
the descriptor table from the map file. This is typically caused by a
media failure or a geometry mismatch. LIL? The second-stage boot loader has been loaded at an incorrect
address. This is typically caused by a subtle geometry mismatch or by
moving /etc/lilo/boot.b without running the map installer. LIL- The descriptor table is corrupt. This can be caused either by a
geometry mismatch or by moving /etc/lilo/map without running the map
installer. LILO All parts of LILO have been successfully loaded. There are also BIOS error codes that you might get while loading LILO. These
are listed in Table 4.1.
Using BOOTLIN Instead of LILO The BOOTLIN package uses the DOS MBR to boot off the hard drive. To install
this package, you must take the following steps:
Now when you reboot, the BOOT.SYS and BOOTLIN.SYS files will boot into Linux
for you. Restoring the MBR If you want to restore the MBR to the original DOS MBR, you can use the
following procedure:
|