Linux Mall - The Linux SuperStore!
Linux books, Linux CDs, Linux toys, you name it, they have it!

W W W . L I N U X D O T . O R G

Newbie's Linux Manual
Lilo Explained
by Laurence Hunter
[ Home ] [ Contents ] [ Download*] [ Previous ] [ Next ]
* In Linux enter: unzip nlm.zip
The Linux Loader

When you switch on your computer or reboot it, your computer's BIOS starts the ball rolling. Your BIOS contains a little program called the "bootstrap". The bootstrap program knows just enough to read the contents of the master boot record (MBR) of the hard drive marked "active", into memory.

The MBR is the first sector of a hard drive. It contains pointers to the first sector (the boot sector) of the partition that contains the operating system, and that sector contains the instructions that cause the computer to boot the operating system, i.e.:

BIOS -> MBR -> boot sector -> operating system

The drawback to all this, is that your computer can only boot the one operating system. :( We need a better solution. A solution that allows us to have Windows and Linux on the same computer. The solution is Lilo. :)

By replacing the MBR with Lilo you now have the choice of which operating system's boot sector you want to advance to. Or more plainly; which operating system you want to boot.

Lilo allows you to boot up to 16 operating systems from the one computer.

/etc/lilo.conf

The /etc/lilo.conf file is Lilo's configuration file. After editing it, enter the following to apply the changes:

If you're root, enter:

lilo

If you're not root, enter:

su - -c lilo

...followed by the root password.

Lilo will then display something like:


linux * dos

Indicating that Lilo can boot linux or dos. The asterix (*) indicates the default operating system.

Note:

Lilo is actually a whole package of things. Whenever you enter: lilo at the command line what you're actually doing is running the "Map Installer" to create the "map file". The map file is just a file containing pointers to each of the operating system's boot sector. By default the map file is stored at /boot/map.

An Example lilo.conf File Explained

The following is an example of a no-frills lilo.conf file:


 1: boot=/dev/hda 2: map=/boot/map 3: install=/boot/boot.b 4: prompt 5: timeout=50 6: default=linux 7: 8: image=/boot/vmlinuz-2.2.12-20 9: label=linux 10: initrd=/boot/initrd-2.2.12-20.img 11: read-only 12: root=/dev/hda6 13: 14: other=/dev/hda1 15: label=dos

Key:
Global options.
"Per-image section" for Linux. (Note: If you want, you can have seperate "Per-image sections" for different kernels and/or different Linux distros.)
"Per-image section" for DOS/Windows.

1: On which boot sector the first little bit of Lilo will be stored. This location can be the MBR of a hard drive, the boot sector of a hard drive partition, or even the boot sector of a floppy disk.

2: The location of the map file. Omitting this line will default the location to /boot/map.

3: The file to install as the new boot sector. Omitting this will default the file to /boot/boot.b.

4: Displays the boot: prompt at boot time. Omitting this means you have to press Ctrl, Shift, or Alt key to bring up boot: prompt.

5: Time in 10ths of a second, boot: prompt waits for input before booting the default operating system. It also cancels current password entry if user takes too long. Omitting this and including prompt will result in an infinite timeout.

6: The default operating system. At the boot: prompt; by entering nothing and pressing Enter or waiting until timeout expires, Lilo will boot the default operating system. Omitting this will boot the first kernel image mentioned. In this case line 8 (Linux) because it comes before line 14 (DOS).

8: Where your kernel image is located.

9: What you enter at the boot: prompt to boot the OS in question. In this case, entering linux will load /boot/vmlinuz-2.2.12-20 (a.k.a. your Linux kernel). It's up to you what label you want to give each OS. Omitting this line will default the label to the kernel image's filename (without the path). In this case that would be vmlinuz-2.2.12-20.

10: Set the file that will be used as the initial RAM disk for preloading block device kernel modules (mostly to allow booting from SCSI or RAID drives). For more information, enter: info mkinitrd.

11: Mount root (/) partition as read-only to protect it from corruption whilst checks are performed on it (e.g. fsck). Once the checks are complete it will be remounted as read-write.

12: Set location of root (/) partition. Omitting this will default to the location stored in the kernel image.

14: other just means, "boot an operating system other than Linux. In this case the computer advances to the boot sector of the first partition, of your first hard drive (/dev/hda1), which boots DOS (followed by Windows) as if there were only one operating system on the computer. (If you're confused by that last bit, re-read the introduction at the top of this page).

Uninstalling Lilo
To uninstall Lilo:

If you're root, enter:

lilo -u

If you're not root, enter:

su - -c 'lilo -u'

...followed by the root password.

Restoring DOS MBR
In DOS, enter:
fdisk /mbr

...and reboot.

Further Information

There's lots more to Lilo than I've mentioned here, but I'll definitely be coming back to this subject at a later date. For further information read the excellent Lilo User Manual, located at /usr/doc/lilo-0.21/doc/User_Guide.ps (changing the version number indicated in blue to your version of Lilo).

[ Home ] [ Contents ] [ Download*] [ Previous ] [ Next ]
* In Linux enter: unzip nlm.zip
Homepage | The Last 5 Days | The Daily Linux News | The Linux Bits | Newbie's Linux Manual
The Best Linux Sites | Linux Book Reviews | A Windows Vendetta?
Diary of a Linux Newbie | Diary of an Open Source Newbie
The Linux Forum | Just For Fun
Amazon - The World's Biggest Bookstore!
4.7 million books, CDs, videos, and DVDs available to buy!
© MM Linuxdot.org | Webmaster | Manual's Copyright Terms