Red Hat Linux 7 Unleashed

Red Hat Linux 7 Unleashed

By William Ball

Installing and Configuring LILO

You should know where your Linux partition is before LILO is installed. You should also know if and where other operating systems are installed. For example (using the Linux df, or disk file usage command), partitions may appear as

$ df

Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/hda5              6079464   2168440   3602200  38% /
/dev/hda1                21929      2421     18376  12% /boot

This simple example, typical of a single hard drive system, shows that the Linux /boot partition is installed on /dev/hda1, with the rest of the Linux filesystem resident on /dev/hda5 (there are other partitions present, such as swap and hibernation, but only those recognized are displayed). Here, LILO is installed in the Master Boot Record (MBR) of /dev/hda. Here is another example, using the output of the fdisk command's print partition table option:

Disk /dev/hda: 240 heads, 63 sectors, 1559 cylinders
Units = cylinders of 15120 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1       218   1648048+   c  Win95 FAT32 (LBA)
/dev/hda2           219      1559  10137960    5  Extended
/dev/hda5           219       221     22648+  83  Linux
/dev/hda6           222       499   2101648+  83  Linux
/dev/hda7           500       534    264568+  82  Linux swap
/dev/hda8           535       881   2623288+  83  Linux
/dev/hda9           882      1559   5125648+  83  Linux

In this example, the Linux filesystem is installed across several partitions, such as /dev/hda5, /dev/hda6, /dev/hda8, and /dev/hda9. Although not obvious, these partitions correspond to /boot, root (/), and two additional volumes, with Windows installed on /dev/hda1. Again, LILO is installed in the MBR of /dev/hda, although it could also be installed in /dev/hda9.

If Linux is the only operating system on your computer or if you already have Windows installed, install LILO as the MBR of the boot drive. If you have OS/2 also, you will want to install LILO on the root partition of your hard drive and use OS/2's bootloader on the MBR to boot different operating systems.

LILO is installed after you have partitioned your hard drives and after you have installed either Linux or other operating systems. LILO has capabilities that equal and, in some cases, exceed commercial solutions, and it's free. LILO is used to boot Linux in one of three traditional ways:

LILO has numerous configuration parameters and command-line arguments that demonstrate its special features.

Although LILO is easy to install by using the lilo command (located under the /sbin directory), you should first take the time to read its documentation, which you'll find under the /usr/share/doc/lilo-21.4.4 directory. Along with the documentation, you'll find a shell script named QuickInst, which can be used for a first-time install. LILO's documentation contains details of its features and provides important tips and workarounds for special problems, such as installing bootloaders on very large capacity hard drives or booting from other operating systems.

Installing or Reconfiguring LILO

If you don't install LILO during your Red Hat install or decide not to use the QuickInst script, you can install LILO in two basic steps:

  1. Create and then configure /etc/lilo.conf.
  2. Run /sbin/lilo to install LILO and make it active.

This discussion describes modifying an existing lilo.conf file. Before making any changes, do yourself a favor and create a backup of the file either in the same directory or on a separate disk. Several files are important to LILO and are created during an initial install:

Configuring LILO

Under Linux, your hard drives are abstracted to device files under the /dev directory. If you have one or more IDE drives, your first hard drive is referred to as /dev/hda and your second hard drive is /dev/hdb. SCSI drives are referred to as /dev/sda and /dev/sdb. When you installed Linux, you most likely partitioned your hard drive. The first partition on your first drive would be /dev/hda1 or /dev/sda1, your second partition would be /dev/hda2 or /dev/sda2, and so on.

Before configuring LILO, you should know which partitions have what operating system on them. You should also know where you want to install LILO. In almost all cases, you will want to put LILO on the MBR. You shouldn't do this, however, if you run OS/2, BootMagic, or the like. OS/2, BootMagic, and other similar software use the MBR. If you are using these types of software packages, LILO should be installed on the superblock of the root partition.

Armed with your information, you are now ready to edit LILO's configuration file, /etc/lilo.conf.

Editing lilo.conf

Editing lilo.conf is easy. Make sure you're logged in as root and load the file into your favorite editor, making sure to save your changes and to save the file as ASCII text. You'll edit lilo.conf for a number of reasons:

Listing 3.1 shows a sample lilo.conf file.

Example 3.1. A Sample lilo.conf

boot=/dev/hda
map=/boot/map
install=/boot/boot.b
append="vga=791"
default=linux-up
keytable=/boot/us.klt
prompt
timeout=50
message=/boot/message
image=/boot/vmlinuz-2.2.15
        label=old-linux
        root=/dev/hda9
        append="vga=791"
        read-only
other=/dev/hda1
        label=dos
        table=/dev/hda
image=/boot/vmlinuz-secure
        label=linux-secure
        root=/dev/hda9
        append="vga=794"
        read-only
image=/boot/vmlinuz
        label=linux-up
        root=/dev/hda9
        append="vga=794"
        read-only

Listing 3.1 shows a dual-boot LILO configuration that offers the ability to boot DOS and three different versions of the Linux kernel. Each lilo.conf file consists of global, kernel, and non-Linux parameters with arguments. Global parameters detail the LILO's location, boot messages, prompts or delays, the default Linux kernel, kernel arguments, or password protection.

You can add the parameters listed in Table 3.1 to your /etc/lilo.conf file. They could also be given at the LILO boot prompt, but it is much simpler for them to reside in your /etc/lilo.conf file. Note that only the most common of LILO's 23 options are listed here. See LILO's documentation for details.

Table 3.1. /etc/lilo.conf Configuration Parameters

Parameter Description
boot=< boot_device> Tells the kernel the name of the device that contains the boot sector. If boot is omitted, the boot sector is read from the device currently mounted as root.
linear Generates linear sector addresses instead of sector/head/cylinder addresses, which can be troublesome, especially when used with the compact option. See LILO's documentation for details.
install= <boot_sector> Installs the specified file as the new boot sector. If install is omitted, /boot/boot.b is used as the default.
message= <message_file> You can use this to display the file's text and customize the boot prompt, with a maximum message of up to 65,535 bytes. Rerun /sbin/lilo if you change this file.
verbose= <level> Turns on progress reporting. Higher numbers give more verbose output, and the numbers can range from 1 to 5. This also has -v and -q options; see LILO's documentation for details.
backup= <backup_file> Copies the original boot sector to <backup_file> (which can also be a device, such as /dev/null) instead of to /etc/lilo/boot. <number>.
force-backup <backup_file> Similar to backup, this option overwrites the current backup copy, but backup is ignored if force-backup is used.
prompt Requires you to type a boot prompt entry.
timeout= <tsecs> Sets a timeout (in tenths of a second) for keyboard input, which is handy if you want to boot right away or wait for longer than the default five seconds. To make LILO wait indefinitely for your keystrokes, use a value of -1.
serial= <parameters> Allows input from the designated serial line and the PC's keyboard to LILO. A break on the serial line mimics a Shift-key press from the console. For security, password-protect all your boot images when using this option. The parameter string has the syntax <port>, <bps> <parity> <bits>, as in /dev/ttyS1,8N1. The components <bps, <parity>, and <bits> can be omitted. If one of these components is omitted, all of the following components have to be omitted as well. Additionally, the comma has to be omitted if only the port number is specified. See LILO's documentation for details.
ignore-table Ignore corrupt partition tables.
password= <password> Use this to password-protect your boot images. If you use this option but do not have lilo.conf set to root read-only permission (-rw------), LILO issues a warning—the password is not encrypted!
unsafe This keyword is placed after a definition for a partition. The keyword tells LILO not to attempt to read the MBR or that disk's partition table entry.

After making your changes to lilo.conf, make sure to run /sbin/lilo. You should also always run /sbin/lilo after installing a new kernel; otherwise, the changes will not take effect. Experienced Red Hat Linux users will use a favorite text editor, such as vi, pico, or emacs, to edit the lilo.conf file. Hand-tuning your lilo.conf file is probably the best way to customize LILO's boot menu and add features, such as the splash screen used by Red Hat Linux. You'll find this file (which uses ASCII color graphics), named message, under the /boot directory.

LILO Boot Prompt Options

The following sample list of options can be passed to LILO at the boot prompt to enable special features of your system or to pass options to the Linux kernel to enable a proper boot. Knowing any needed options for your system is especially handy during the Red Hat Linux installation process because you'll be asked for any special options if you choose to install LILO at that time. Kernel arguments can be especially handy if you need to pass hard-drive geometry settings, the device names of designated boot volumes, or want to boot Linux to a particular user mode or runlevel, such as single or 0, with networking, multiple users and X11 disabled.

Although you'll normally type linux or dos at the LILO: prompt, you can also try one or two of the following options. (For a more up-to-date list of kernel messages or options, read Paul Gortmaker's BootPrompt-HOWTO available at http://www.linuxdoc.org.)

Share ThisShare This

Informit Network