Operating Systems and Systems Integration

Using LILO to Boot Another Operating System

1 Aim

It is often useful to be able to boot more than one operating system from one hard disk. There are some commercial packages to achieve this examples include the boot selector with Partition Magic and System Commander. There are a number of free software packages also, such as grub and osbs. However, we will use lilo, simply because we need it to start Linux, so it is already available, and it can do the job. Today we see how to use lilo to boot Linux and one or more additional operating systems.

2 Background

lilo stands for Linux loder, but it is very flexible and can start many other operating systems besides Linux.

You can read the user manual for lilo by typing:

xdvi /usr/share/doc/lilo-21.4.4/doc/user &

or

gv /usr/share/doc/lilo-21.4.4/doc/User_Guide.ps &

I assume that you have set up the sudo command, and understand how to use it. If not, please read the document I have written about it first.

Note that setting up lilo involves two steps:

• edit the configuration file, /etc/lilo.conf

• run the installer, /sbin/lilo, which reads the configuration file and actually installs the boot loader.

Note that the boot loader code installed by lilo runs before any operating system is started.

3 Procedure

Before you begin:

• Linux should be installed

• All the operating systems you want to boot must be installed. If the operating system is not installed, then you cannot configure lilo to boot them later on after you install the new os.

Using LILO to Boot Another Operating System Operating Systems and Systems Integration

2

• You need a custom boot disk for your system. I do not mean the installation disk. You should have created one when you installed Linux. If you didn’t, you can create a custom boot disk for your system like this:

∘ Put a floppy disk into the machine.

∘ Enter this command:

    $ sudo mkbootdisk -v --device /dev/fd0 2.4.3-12

where the last number is the version of your kernel, found by typing the com-

    mand uname -r

Use this bootdisk to start the computer if lilo fails to boot the computer because the installation of a Microsoft os has overwritten lilo in the mbr (master boot record).

Here I am going to assume that you have installed Windows 98 in partition /dev/hda1.

3.1 If Linux is already started:

1. At a shell prompt, type:

$ sudo emacs /etc/lilo.conf

and enter your own password if necessary.

2. You should see something like this:

boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
linear
default=linux
image=/boot/vmlinuz-2.4.3-12
        label=linux
        read-only
        root=/dev/hda8

3. Add the following at the end:

other=/dev/hda1
         label=win98

4. Change the line

linear

Using LILO to Boot Another Operating System Operating Systems and Systems Integration

3

to

lba32

Note: the option lba32 is very important to ensure that your system can boot, since this enables support for extended bios disk functions that can read past the cylinder 1024. This issue about the bios limitations is discussed in the worksheet about partitioning. Please read that again if the 1024 cylinder limit puzzles you.

So your lilo.conf should look something like this:

boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
lba32
default=linux
image=/boot/vmlinuz-2.4.3-12
        label=linux
        read-only
        root=/dev/hda8
other=/dev/hda1
         label=win98

5. Save the file by typing [figure: Control-x][figure: Control-s]

6. Exit from Emacs by typing [figure: Control-x][figure: Control-c]

7. Type the following at the bash prompt:

$ sudo /sbin/lilo

If you see any error messages that you do not understand, ask the technician or your lecturer for help.

8. If there are no error messages, then restart the computer by typing:

$ sudo shutdown -r now

9. Boot both Linux and Windows and make sure that they start correctly.

10. Shutdown Windows and reboot. At the lilo prompt, press [figure: Enter](or just leave it alone). Linux should boot.

Using LILO to Boot Another Operating System Operating Systems and Systems Integration

4

3.2 If Linux is not already started:

You can save a few seconds by starting Linux in single user mode, or “runlevel 1”. This is similar to Windows’ “Safe mode (command prompt).” You also do not need to type in your root password—great if you forgot your password from last week, and haven’t set up sudo yet.

1. To start Linux in single user mode, at the lilo prompt, type:

[figure: Control-X]

to get to the lilo boot prompt.

2. At that prompt type:

LILO boot: linux 1

3. The remaining steps are as in section 3.1 on page 2.

4 How do I… ?

1. What should I do if I haven’t installed Linux but I have partitioned the hard disk and I want to install Windows 98 in /dev/hda1?

Answer: Just go ahead and install Windows 98 in the primary partition; you can set up mulitple boot as part of the Linux installation process.

2. How do I start Windows as the default instead of Linux?

Answer:

(a) Start Linux, edit /etc/lilo.conf and change the line

    default=linux

to

    default=win98

(b) Execute lilo by typing

    $ sudo lilo

at a bash prompt.