Softpanorama
(slightly skeptical) Open Source Software Educational Society

May the source be with you, but remember the KISS principle ;-)

Google   


Boot Management

[May 27, 1999]Booting Linux with the NT Loader

[May 27, 1999] Boot Disk Failure and Recovery LG #39

[May 27, 1999] Adding a Second IDE Hard Drive

WindowsLinux Dual Boot LG #38

Linux.com: LILO Security Tips(Apr 20, 2000)
Linuxnewbie.org: Overcoming LILO dual-boot problems(Mar 20, 2000)
Microsoft.com: Removing the Linux LILO Boot Manager(Jan 02, 2000)
c't: Start Engine: Boot Manager Lilo(Dec 27, 1999)
LinuxNewbie.org: Multiple OS Booting Without Lilo(Dec 06, 1999)

Project: Linux Howtos

 

LILO configuration and usage

By Mayank Sarup <mayank@freeos.com>
Posted: ( 2000-11-16 22:00:14 EDT by FreeOS )

The Linux Loader or LILO is one of the most popular methods of booting
into Linux. LILO also makes a highly flexible and effective boot
manager:handy if you have multiple operating systems installed on your
machine. This article will help you set up and configure LILO.

 

If this were the first time that you installed Linux, you probably, would have
gone the dual-boot way. But you do need a boot manager that will allow you to
switch between the different OS' installed on your system. Linux provides LILO
( LInux LOader ). This is a very simple but flexible boot manager. I use it to
boot multiple OS' and to check out various Linux kernels.

When your computer starts up, the BIOS executes a bootstrap program which lies
in the Master Boot Record (MBR) of your first hard drive or your floppy. The
MBR lies on the first sector of this device. The job of the bootstrap program
is to locate and load the operating system. If you're using Linux then this
will go out at boot and load the kernel into memory. LILO can take over this
job and also act as your boot manager.

Ok, after that short introduction, let's move on to LILO. You're first
encounter with LILO will be at the time of installation. You will be asked
where you want to install it. The options given are MBR or the root partition
of your Linux installation. Your choice will be based on your setup. There are
other boot managers are available like Boot Magic and System Commander and you
might want to use one of these instead. They're a lot easier to configure if
you have multiple OS' on your machine. If so, then choose the second option.
If, however, you do want to use LILO as your boot manager, you should choose
the first option. Also choose this option if you want to pass certain
parameters to the kernel at boot. This might be required for troublesome
hardware configurations or if you need to feed the kernel some pre-defined
parameters at boot.

If you chose to use LILO then you can read on. At boot, you will see a prompt
that looks like 'LILO:'. Press the Tab key to see a list of the operating
systems that you can boot into. Type in the label of the one you want and
press enter or just press enter to boot the default choice.

Once you boot into Linux, you need to take a look at the LILO configuration
file. This could be any file but by default LILO will check for
/etc/lilo.conf. Open this file and you will see something like the following.

boot    = /dev/hda
vga     = normal
read-only
prompt
default = dos
timeout = 30
append="hdc=ide-scsi"

  image  = /boot/vmlinuz
  label  = linux
  root   = /dev/hda2
  initrd = /boot/initrd

The structure of the LILO configuration file starts with the global directives
that are taken as the default values, unless overridden by a directive in the
image sub-section.

Let's check out the various options here.

The first option here is boot. This is the location where Lilo should be
installed.
'/dev/hda' puts LILO in the MBR. This is the option to select if you want to
use LILO as your boot manager.

If you want to use some other boot manager then you will have to write LILO to
the first sector of your root partition. This could also be true if you
already have another installation of Linux on your machine, which is what
you're using primarily.

This should point to the partition where your root resides. This is a global
directive.

vga is a common option that you see in most lilo configuration files.
Possible options here are 'normal' (80x25 text mode), 'extended' (80x50 text
mode) and 'ask' where you are prompted for the text mode.

read-only option if specified, mounts your root partition as read only.
This is recommended because it fsck checks require the file system to be read
only. In any case Linux will re-mount your root file system as read-write at
startup. This can be locally defined in an image section too.

prompt is another option that you should have in here. If not then LILO will
not bring up the LILO prompt at boot. To see the prompt, press the shift key.
This is a global directive.

default specifies the default boot image to boot. If this is not specified
then the first image in the configuration file is taken as the default.

timeout in tenths of a second is the time for which the prompt is displayed
before the default image is booted. By default the timeout is infinite.

append is one of the most useful parameters here. It allows you to pass
parameters to the kernel at boot without any intervention from you. This can
be a global setting or a per-image setting. Just enter the parameters that are
to be passed to the kernel within double-quotes. The advantage is that you
don't have to pass the parameters to Linux at every boot. Here using the
append statement, I am telling Linux to use the ide-scsi module
for /dev/hdc, which is my CD-Writer. If you have some troublesome hardware
that doesn't work you might want to provide Linux with the settings here.

LILO also allows you to pass these parameter right at the LILO prompt.
Type the name of the image you want to boot followed by the options that you
want to pass to the kernel.

LILO: linux single

Using the above, I could tell Linux to boot the image linux in single user
mode. I could also use 'linux root=/dev/hda3' to specify another root
partition to use.

Now come the image sections. Options in the global section can be overridden
by options in the image sections. Each section begins with a 'image='
statement that points to the kernel image that you want to boot.

Each image section also contains a 'label' option. This could be anything you
want. It is just what you will type at the LILO prompt to boot that particular
image.

If you need to have a different root for this image or you are trying to boot
another Linux distribution then you will need to specify the 'root' option
here as well as any other option specific to that image.

For more security you could add a password for that image.

password='password'

You can also put in 'restricted' here. You will only be prompted if you want
to enter parameters on the command line. Normal booting of the image will
still take place. This is just to prevent someone from entering a parameter
like 'single' and then booting straight into the prompt.

While LILO can boot other Linux distributions, it can also boot other OS'. The
section for booting another OS is essentially the same as that for the image.

other = /dev/hda3
label = dos
table = /dev/hda

Each section will start with a 'other=' which will point to the partition that
the other OS lies on. As with the image section, there is a label to be given.

The final parameter is table. This should point to the device that contains
the partition table. Definitely required because LILO will take the partition
information from this table and pass it on to the operating system that it is
booting.

Every change to the lilo.conf will require you to re-run /sbin/lilo to ensure
that any changes to the setup are written down. If you update the kernel,
re-create the initrd image you need to re-run LILO.

Lilo resides in /sbin. To run, simply type /sbin/lilo. You should then see
something like the following

Added linux *
Added suse
Added windows

This shows the various images that I have in lilo.conf. The image after
which the '*' is displayed is the default boot image. To change the default
boot image from the command line, add a '-D' followed by the image you 
want to use.

lilo -D windows

Added linux
Added suse
Added windows *

This is about all you need to configure LILO. If you have any problems/
suggestions then please send me a mail.

Copyright © 1996-2007 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

Standard disclaimer: The statements, views and opinions presented on this web page are those of the author and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.

Last modified: February 28, 2008