Previous Section  < Day Day Up >  Next Section

Recipe 12.18. Multibooting Linuxes with LILO

12.18.1 Problem

You would like to run several different Linuxes on a single PC, and you want LILO for the bootloader.

12.18.2 Solution

The first Linux installed is the "host" system. You need to preserve it to keep LILO working. Make sure that the root filesystem containing the /boot directory is on a primary partition, or LILO won't work.

Write down the location of the partition where the root filesystem of your next Linux is going to be installed. If you also know the exact name of the kernel, and the initrd image (if there is one), you're ahead of the game. While you're still in the host Linux, you can create a lilo.conf entry for Linux #2:

# Red Hat 9

image=/boot/vmlinuz-2.4.22-1

initrd=/boot/initrd-2.4.22-1.img

label="Red Hat 9"

root=/dev/hda6

read-only

Then write the changes to the MBR:

# /sbin/lilo -v

Now you can go ahead and install Linux #2, and because you already have a LILO boot menu entry for it, you can glide through however many reboots it takes to complete the installation.

When the installer gets to the bootloader installation, be sure to select "install to the first sector of the root partition," or however your installer words it. Do not overwrite the MBR.

If you don't know the exact kernel name and initrd image, you'll have to discover them from the host Linux. Go ahead and start the installation of Linux #2. When it comes to the first reboot, you'll end up back in the host Linux. Mount the new Linux #2 filesystem and read the /boot directory:

# mount /dev/hda6 /mnt/tmp

# cd /mnt/tmp

# ls boot

System.map  initrd-2.4.22-1.img  System.map-2.4.22-1  vmlinuz  vmlinuz-2.4.22-1

There's your kernel and initrd. Make your lilo.conf entry, re-run /sbin/lilo, and reboot. Now you can select your new Linux from the bootloader menu and finish the installation.

12.18.3 Discussion

Sometimes a ramdisk is required for the system to boot properly. If this is the case, there will be an initrd image. Note that not all distributions require an initrd image. If it's in /boot, it's needed, and it requires an entry in lilo.conf.

12.18.4 See Also

    Previous Section  < Day Day Up >  Next Section