Previous Section  < Day Day Up >  Next Section

Recipe 12.17. Booting Linux with LILO

12.17.1 Problem

You want to use LILO and need to know how to configure it to boot a Linux system.

12.17.2 Solution

Use liloconfig to generate a basic lilo.conf, then edit lilo.conf to add comments, titles, and any additional options you want.

Make sure you have the latest version of LILO, and as always, have a current backup of your data and bootable rescue disks at hand:

# /sbin/lilo -V

LILO version 22.4.1

After installing/upgrading, run liloconfig:

# liloconfig

It asks many questions, and gives many instructions. In this example, the root filesystem is on /dev/hda3. Say yes to these four questions:

Install a partition boot record to boot Linux from /dev/hda3?

Use LBA32 for addressing big disks using new BIOS features?

Install a master boot record on /dev/hda?

Make /dev/hda3 the active partition?

Run lilo to write the changes to the MBR:

# /sbin/lilo -v

Reboot to test it. When the system comes back up, you'll probably want to edit /etc/lilo.conf, because liloconfig does a rather barebones job on the boot stanzas. Here is a sample lilo.conf, first generated by liloconfig, then edited:

# Specifies the boot device

boot=/dev/hda3

# Location of the map file. This is a binary

# file generated by lilo, don't touch it

map=/boot/map

# Video resolution for the boot screen

vga=normal

# the LILO boot screen

message = /boot/boot_message.txt

# Show the LILO prompt for ten seconds

# before booting the default

prompt

timeout=100

# Access large disks beyond cylinder 1024

lba32

   

# Boot menu #

# default boot entry

default="Libranet-hd3"

   

# Stable 2.4 kernel

image=/boot/vmlinuz-2.4.21

label="Libranet-hd3"

root=/dev/hda3

read-only

   

# Test 2.6 kernel

image=/boot/bzImage-2.6.3

label="2.6-test-hd3"

root=/dev/hda3

read-only

There is a limit of 16 different images that can be configured in lilo.conf.

12.17.3 Discussion

This is what the original liloconfig-generated boot stanzas looked like:

# These images were automagically added. You may need to edit something.

   

image=/boot/vmlinuz

label="DEB 0"

read-only

   

image=/boot/vmlinuz-2.4.21

label="DEB 1"

read-only

   

image=/boot/bzImage-2.6.3

label="DEB 2"

read-only

liloconfig is good for setting up your first lilo.conf; after that, it is easier and better to edit it manually. Let's take a look at the four liloconfig questions you answered yes to:


Install a partition boot record to boot Linux from /dev/hda3?

This refers to where the /boot directory is located, and it must be a primary partition.


Use LBA32 for addressing big disks using new BIOS features?

Definitely say yes to this, unless you are using a system BIOS that does not support large-block addressing. Mainboards built in 1998 and after should support LBA32. This is the option that lets LILO boot partitions that are beyond the 1024-cylinder limit. The 1024-cylinder limit is a limitation of the x86 architecture; see "The Large Disk Howto" on tldp.org for details.


Install a master boot record on /dev/hda?

LILO stores the first-stage bootloader in the MBR; this bootloader then points to your other partition boot records.


Make /dev/hda3 the active partition?

This marks the partition as bootable, which Linux does not care about, but Windows does.

Any time you make changes to /etc/lilo.conf, you must re-run LILO to write the changes to the MBR:

# /sbin/lilo -v

The -v flag turns on verbosity, with levels ranging from 1 to 5:

# /sbin/lilo -v5

Another useful flag is -t, for test. Use this with -v to see what will happen before actually writing the changes to disk:

# /sbin/lilo -t -v2

12.17.4 See Also

    Previous Section  < Day Day Up >  Next Section