require_once('../_includes/include.php'); $this_txt = 'lilo: The LInux LOader'; $last = ''; $up_url = 'http://www.dirac.org/linux'; $up_txt = 'Peter\'s Linux Pages'; $descrip = ''; $keywords = ''; myHeader('The LInux LOader (LILO)'); ?>
A boot loader is a program that loads and starts the operating system on a computer. The most popular boot loader for Linux is lilo.
When you turn on a computer, the bios goes though some diagnostic and configuration tests (called posting). The next thing it does is look at the master boot record (MBR) and runs whatever program is loaded there. In our case, it will find and run lilo.
lilo is highly configurable and can load any operating system. Many people have a `dual boot' system, which is a system that can boot more than one operating system, like Linux and Windows. Some operating systems like Windows NT, 2000 and XP have "issues" if their own boot loader isn't located in the MBR, but lilo can circumvent that too.
lilo has a few interfaces, which I discuss further down this document. I discuss the "text interface" here. When you switch on the computer and wait for a moment, you'll see:
that's lilo's prompt. It's waiting for you to enter something. You have a number of options:
vmlinux-2.2.14 vmlinuz-2.2.14-alt vmlinux-2.2.13After this, lilo will prompt you to enter something again.
Most of lilo's functionality can be set by editing its default configuration file, which is /etc/lilo.conf. After editing the configuration file, you'll need to run lilo to actually make the changes. Simply type lilo (lilo is located in /sbin). If your changes all make sense and there's nothing obviously wrong, you'll see a message that looks something like:
Added vmlinux-2.2.14 * Added vmlinuz-2.2.14-alt Added vmlinux-2.2.13
The star means that vmlinux-2.2.14 is the default kernel. For security, you might want to make sure that /etc/lilo.conf has permissions of 600 and is owned by root with group of root. That is,
# ll /etc/lilo.conf -rw------- 1 root root 500 Jan 21 00:03 /etc/lilo.conf
If you make backups of important administrative files on your computer, /etc/lilo.conf is a good one to backup.
There are two sections to the lilo.conf file, the global and local sections. The local section is further broken down into subsections, one for each kernel residing on your hard drive.
Here's a sample of what a simple lilo.conf might look like:
# Start lilo global Section # boot=/dev/hda linear compact read-only prompt timeout=100 vga = normal # force sane state # Start lilo local Section # image = /boot/vmlinuz-2.2.14 root = /dev/hda1 label = vmlinuz-2.2.14 image = /boot/vmlinuz-2.2.13 root = /dev/hda1 label = vmlinuz-2.2.13
The first line specifies where lilo will be installed. In this case, LILO will be installed in the master boot record on the first IDE hard drive, also known as /dev/hda.
The second line of the global section (linear) means that lilo should switch the method by which it access the hard drive from sector/head/cylinder notation to linear sector number. This is necessary when your kernel resides outside the first 1024 cylinders of your hard drive. It's also necessary for for some PCI SCSI controllers. It is incompatible with floppy disks.
The 3rd line in the global section (compact) tells lilo to attempt read requests for adjacent sectors while loading. This can make booting off a floppy much faster, but won't really speed up booting off a hard drive.
The 4th line (read-only) tells lilo that the root file system should be mounted read-only. The system startup scripts will re-mount the root file system as read-write after fsck'ing it.
The 5th line tells lilo to prompt the user before loading any kernel or operating system. If it's not set, lilo will automatically load the default kernel. If prompt is set but timeout is not set, then unattended reboots will be impossible because lilo will wait forever for the user to enter something.
The last command of the global section (timeout=100) tells lilo how long to wait (in miliseconds) for the user to enter something before lilo loads the default kernel.
Now we begin talking about the local section of lilo.conf. There can be multiple subsections, and each subsection starts with either the image or other keywords. The first subsection will the default kernel. The image keyword tells lilo the full path and name of the kernel to be booted by that subsection.
lilo can handle multiple OS's, and different OS's will have different partitions on your hard drive. Even if we know the full pathname of the kernel to load, lilo needs to know which partition on the hard drive /boot/vmlinuz-2.2.14 lives in. That's what the root keyword tells lilo. For each subsection, root tells lilo which partition to mount as the root partition. So:
image = /boot/vmlinuz-2.2.14 root = /dev/hdb1 label = vmlinuz-2.2.14
will look for /boot/vmlinuz-2.2.14 on the first partition of the 1st (slave) IDE hard drive and
image = /boot/vmlinuz-2.2.13 root = /dev/hdb2 label = vmlinuz-2.2.13
will look for /boot/vmlinuz-2.2.13 on the second partition of the 1st (slave) IDE hard drive.
Lastly, the label keyword tells lilo what to name that subsection. This is the name listed by pressing <TAB> at the lilo prompt. This is the name you type at the lilo prompt to load that particular kernel. lilo will balk at you trying to name two different subsections with the same label.
When you boot linux, there are a number of interfaces you can use. There's a menu interface, text interface and custom interface.
|Menu Interface||Text interface||Text interface after pressing <TAB>|
I don't have an image for the custom interface, but a good example is Corel's wierd ultra-graphics type interface.
You can choose interface from the boot-* files in /boot.
% ls /boot/boot-* /boot/boot-bmp.b /boot/boot-compat.b /boot/boot-menu.b /boot/boot-text.b
These are boot sector images which lilo will write to your hard drive's master boot record (MBR), or the partition if you're installing lilo on a partition. They are all created by lilo, and contain the basic same information. The only difference is how lilo presents the information.
I've never tried the bmp or compat, but boot-menu.b is the menu interface and the boot-text.b is the text interface that you see in the pictures above. Which one you use is determined by the install directive in lilo.conf:
You can, for instance, put install=/boot/boot-menu.b in lilo.con if you want the menu interface. The usual way of doing things is to keep install=/boot/boot.b and simply make a symlink in /boot like:
satan# ll /boot/boot.b lrwxrwxrwx 1 root root 11 Nov 30 09:17 /boot/boot.b -> boot-text.b
If you want a painless life, use the text interface. The menu interface looks nice, but it clears the screen. Unfortunately, as you can see from the pictures, this clears the screen which has important BIOS information like IRQ allotment and device listings. And NEVER use a graphics interface for lilo. It may look wonderful, but if you ever have problems with lilo, you're going to be one sorry person.
other = /dev/hda4 label = win95 table = /dev/hda
OS's other than Linux always begin with the other keyword, and this kind of serves the same purpose as the root keyword. In this example, Windows 95 is located on the fourth partition of the primary hard drive on IDE0. Label serves the same purpose as it did before. Table indicates where the partition table for the corresponding hard disk is located. This will always be Linux's name for the hard drive that holds the foreign OS, (ie- /dev/hda, /dev/hdb, /dev/hdc, /dev/sda, etc).
If you add a password to a subsection, a password will have to entered before the kernel boots. Using restricted will make lilo prompt for a password only if parameters are specified, like `single' to throw Linux into single user mode. Here's an example of a password protected subsection:
image = /boot/vmlinuz-secret label = secret_kernel root = /dev/hda3 password = mypassword restricted
Don't be fooled by the word "password". It's really not secure. A person with physical access to the computer can boot off a rescue disk and install their own lilo, without a password. Physical access to a computer is synonymous with being able to get root.
After editing /etc/lilo.conf and running lilo, there's a few error messages that you may see. These are not boot time errors; these are errors that occur when you run lilo.
One of your kernels resides above the 1024 cylinder on the hard drive, the dreaded 2GB limit. You can add the option linear to the global section of /etc/lilo.conf, and everything should be OK. See the Large-Disk howto.
One of your kernels listed in the image section (here, I the missing kernel is named "fofo") does not exist.
The label for one of your kernel images is too long. Shorten it to something like label = a_short_name and you'll be fine.