Home   |   Guides and Tutorials   |   What's New?   |   Comments   |   About
 

LILO Configuration

by Tammy Fox
Last Modified: Wednesday, 19-May-2004 11:55:35 EDT

Introduction
    LILO stands for Linux Loader. It is the Linux boot manager that is either written to the Master Boot Record of your hard drive or to the first sector of your hard drive. It is what loads the Linux kernel when your computer boots up or allows you to choose which operating system to load if you have multiple operating systems on your machine. It also allows you to boot different Linux kernel versions if you choose.

Default Configuration
    During the installation of Linux, you are given the option to install LILO as your boot manager. If you choose to install it, the LILO configuration file is usually in the /etc/lilo.conf (the default for RedHat). However, in some distributions, it can be located in the /etc/lilo/config or /boot/lilo.conf. If you can not find your configuration file, try the command locate lilo or whereis lilo to locate your configuration file. See the locate: Find Files and Directories guide if the locate command does not work.

A typical configuration file will look like the following:


boot=/dev/hda                      #which hard drive LILO is installed on
map=/boot/map                      #where the LILO map file is located
install=/boot/boot.b               #boot sector file for MBR
prompt                             #prompt user with LILO menu when computer starts
timeout=50                         #time computer waits for user to choose an OS to load 
                                   #before loading default operating system or kernel
image=/boot/vmlinuz-2.2.5-15       #which kernel to boot Linux with
        label=linux                #alias name for above kernel
        root=/dev/hda3             #which partition contains the Linux kernel or alternate OS

Leaving the above default configuration will automatically boot Linux when your machine is started. When your machine boots up, it will pause at a LILO: prompt. If you want to see what other operating systems/kernels LILO is configured to load, you can press TAB to view the stanza list. Each kernel/operating system listed in the LILO configuration file is called a stanza. Using the example above, after 50 seconds, Linux will automatically boot using the installed kernel version indicated by the image stanza. If you do not want to wait that long you can either change the timeout value (in seconds) or press enter at the LILO: prompt to start loading Linux.

Custom Configuration
    LILO can also be configured to load other operating systems because chances are you are dual-booting your machine. For example, if you have a Windows-based Operating System on your machine, you can use LILO to alternately boot between Linux and Windows. For example, if you are running another OS off the first partition of the primary hard drive (/dev/hda1) then you can add the below lines to your /etc/lilo.conf file. Note: You must have root access to edit the LILO configuration file. If you are logged in as a regular user and know the root password, you can type the command su. This will prompt you for a password. Enter the root password correctly and you will have root priviledges until you type exit. Typing exit will take you back to regular user mode.

other=/dev/hda1
        label=msdos
        table=/dev/hda        
This would allow you to type in msdos (or whatever you choose to name your label) at the LILO: prompt during boot-up and whatever OS is on /dev/hda1 will be loaded.

Thus, your new LILO configuration file would look like below:


boot=/dev/hda                      
map=/boot/map                      
install=/boot/boot.b               
prompt                             
timeout=50                              
image=/boot/vmlinuz-2.2.5-15       
        label=linux                
        root=/dev/hda3             
other=/dev/hda1
        label=msdos
        table=/dev/hda               
After editing the configuration file to include additional operating systems, the lilo command must be run for your changes to take effect. This is done in RedHat 6.x with the command /sbin/lilo. It should be in a similar directory for other Linux distributions. Then, at the LILO: prompt at boot-up, type the "label" of the OS you wish to boot. In the example above, you can either type linux or msdos, respectively. If you do not remember what your choices are, you can press the tab key at the LILO: prompt to print out your choices. Notice: The lilo command must be run everytime you make any changes to the LILO configuration file!

Setting the Default OS for LILO
    To set the default operating system for LILO to load, first move the stanza for the OS/kernel to the front of the list like below:

boot=/dev/hda                      
map=/boot/map                      
install=/boot/boot.b               
prompt                             
timeout=50                         
other=/dev/hda1
        label=msdos
        table=/dev/hda                                                 
image=/boot/vmlinuz-2.2.5-15       
        label=linux                
        root=/dev/hda3             
Then, run the lilo command to allow your changes to take effect. This can be done in RedHat 6.x by typing the command /sbin/lilo. Notice: The lilo command must be run everytime you make any changes to the LILO configuration file!

What's Related


All Rights Reserved Linux Headquarters © 2000-2007
Linux is a registered trademark of Linus Torvalds
All logos are registered trademarks of their respective owners
Last modified: Wednesday, May 19, 2004