In this column we investigate installing a dual boot system using both the LILO and GRUB boot loader. A boot loader allows you to select an operating system to boot when your computer is first turned on. This article works on the assumption that you have already installed the operating systems you wish to dual boot.
Before setting up the dual boot system you will need to know where each operating system is located on your hard disk. Using fdisk to find this, log in as root and in a shell type:
$ /sbin/fdisk /dev/hda
If your operating systems are installed on another hard disk, substitute /dev/hda with this disk.
To display the list of partitions on this drive, type p and an output similar to the following will be displayed:
Device Boot Start End Blocks Id System /dev/hda1 1 96 771088+ 6 FAT16 /dev/hda2 97 2646 20482875 83 Linux
This output shows that Windows is installed on the first partition and Linux on the second. We will use this scenario above as the example in the following sections. To quit fdisk, type q.
The LInux LOader (LILO) uses a configuration file named /etc/lilo.conf. If your distribution uses LILO, this file will be present. This is the LILO configuration for our dual boot system:
prompt timeout=50 default=linux boot=/dev/hda linear
image=/boot/vmlinuz-2.4.18-14 label=linux initrd=/boot/initrd-2.4.18-14.img read-only other=/dev/hda1 label=win
Compare this file to the /etc/lilo.conf installed on your own system.
The first section of this file defines how LILO will operate. When editing your LILO configuration you should not need to change this section. A detailed explanation of each keyword can be found by typing:
$ man lilo.conf
The second section of the LILO configuration file defines the operating systems available to boot. This is what you need to be concerned with when setting up a dual boot system.
The ‘image’ keyword is followed by the filename of a Linux kernel. Your kernel will already be included in your /etc/lilo.conf. If you wish to boot another Linux kernel, such as one you have compiled yourself, you can add another ‘image’ entry with the new kernel file name. Each ‘image’ entry will appear as an option in the LILO menu. The ‘label’ keyword specifies a unique identifier for each kernel for use in the LILO menu.
The ‘other’ keyword is followed by a partition containing an operating system other than Linux to be booted. In our case, Windows is installed on /dev/hda1. You can add ‘other’ keywords for each non-Linux operating system. Once again, the ‘label’ keyword specifies a unique identifier. To install a LILO configuration, type as root in a shell:
GRUB is another boot loader used by many Linux distributions. The GRUB configuration file is located at /boot/grub/menu.lst. This is the GRUB configuration file for our dual boot system:
default=1 timeout=5Compare this file to the /etc/grub.conf installed on your own system. Like LILO, the first section of this configuration file defines how GRUB operates. These settings should not need to be modified to build the dual boot system.
title Linux root (hd0,1) kernel /boot/vmlinuz-2.4.18-14 ro initrd /boot/initrd-2.4.18-14.img title Win rootnoverify (hd0,0) chainloader +1
The second section of the GRUB configuration file defines the operating systems available to boot. Each operating system is defined with the ‘title’ keyword followed by a unique identifier.
The ‘root’ keyword specifies the partition where the operating system can be found. GRUB identifies hard disks using the keyword ‘hd’ followed by a pair of integers corresponding to the drive number and partition number. For example, (hd0,0) means the first partition on the first hard disk. In our case, Windows is located at (hd0,0) and Linux at (hd0,1).
The ‘kernel’ keyword is followed by the filename of a Linux kernel. The ‘initrd’ keyword is followed by the initrd filename corresponding to the kernel.
The ‘rootnoverify’ keyword is used to specify a partition containing an unsupported operating system — in our case, Windows. The ‘chainloader’ keyword is used to boot Windows from this partition.
To install a GRUB configuration, as root in a shell type:
$ grub-install /dev/hda