Triple-booting with GRUB, LILO, and Windows XP


Author: Samartha Vashishtha

Wondering how to create a triple-booting system that involves Windows and two Linux distributions — one that uses the GRUB bootloader and the other using LILO? Here’s a hands-on procedure that lets you do just that, without tweaking cryptic configuration files and messing with geeky commands.

When you power on a PC with multiple operating systems installed, software called a bootloader asks you what operating system to boot. A boot loader can be installed on the master boot record (MBR) of your hard disk, or you may install it on the root partition that a Linux distro uses. For x86 hardware, you have the choice of two popular bootloaders in the Linux world — the Grand Unified Bootloader (GRUB) and the Linux Loader (LILO).

Most flavors of Linux use GRUB as their default bootloader, but many, such as Xandros and Mandriva, still use LILO. You can find lots of tutorials on the Web that explain how GRUB could be configured in different scenarios to boot multiple operating systems. With LILO, it is a different ballgame; such resources are scarce and hard to find.

One typical problem you encounter when you create multi-boot systems is making LILO and GRUB work in tandem. For this discussion, we will focus on creating a Xandros, Fedora, and Microsoft Windows triple-booting system as an example of creating multi-boot systems involving Windows, LILO-using, and GRUB-using distros.

Sometimes distros will automatically detect other Linux operating systems installed on a system, but often they don’t. Also, if the GRUB-using distro is the last operating system (out of the three) that you plan to install on your system, my method will save you hours of tedious geeky stuff.

A practical solution

With Xandros and LILO, I faced problems when I attempted to create a triple-booting system. Though you can easily configure GRUB by editing its configuration file /etc/grub.conf, editing the /etc/lilo.conf file for Xandros didn’t quite work. Xandros overwrote the modified file with the default values whenever I restarted the system. This prompted me to try using GRUB to boot the three operating systems, which proved to be a lot easier.

Your first step is to back up your data to whatever media you prefer. If you’re starting with a new hard drive and want your Linux distros to coexist with Windows, install Windows first.

You may partition your disk using a utility that comes with new hard disks, or with utilities such as fdisk, cfdisk, Disk Druid, or Ranish Partition. Create two partitions, then install Windows on one of them. You’ll use the other one later for the two flavors of Linux.

Once you are done installing Windows on one partition, proceed with installing Xandros. Do not let Xandros install LILO on the MBR. Instead, let LILO write to the root partition of the Xandros install.

Installing Xandros

Boot right off the Xandros installation CD, and you’ll be presented with the Xandros installation wizard. Review and accept the license agreement and select Custom Install when you are asked to choose between the Custom or Express methods of installation.

On the Software Selection screen that follows, you should choose to install the Complete Desktop, since this will install most packages that one needs on a daily basis.

When presented with the Disk Configuration screen, select Manage Disks and Partitions. You will be presented with a screen where you can modify the partitions on your hard disk. Create the / and swap partitions for Xandros, and click Next. Take care to leave sufficient free space for Fedora; I recommend 4GB or more.

Also, note the device name of the Xandros root (/) partition which is usually something of the form /dev/hdax, where x is the number of the partition on the device.

The next screen will show you the summary of disk configuration. On this screen, remember to uncheck “Install boot-manager on the master boot record of [device name].” This will prevent Xandros from installing LILO to the MBR. LILO will be written to the Xandros root partition. Now complete the rest of the installation, and when prompted, remove the installation CD and reboot your system.

Installing Fedora and configuring GRUB

At this stage, you won’t be able to boot into Xandros since there is no bootloader installed on the MBR. Simply boot off the bootable CD/DVD of Fedora, and wade through the basic installation options.

When asked what kind of installation you would want, select Custom Install. When presented with the disk configuration options, select Manually partition using Disk Druid. Now choose to format the free partition you left earlier in the Ext3 format and supply the mount-name as /.

Next, you’ll be presented with the GRUB options, and a list of the operating systems detected. Xandros will probably not be listed. Click on the Add button, and in the window that pops up, enter Xandros in the Label field and the devicename of the Xandros partition (which you noted earlier) in the Device field. This will add Xandros to the GRUB list that you see later. Now complete the rest of the installation steps, and when prompted, remove the installation CD and reboot the system.

Test fire

Once your system reboots, you will be presented with the blue GRUB screen listing the three operating systems. You may boot into Fedora and Windows simply by selecting the appropriate option from the listing and pressing Enter.

However, when you select Xandros, you’ll be greeted with the second bootloader — the Xandros LILO installed on the root partition of Xandros. Select Xandros from this listing and press Enter. The listing will also probably list Windows, but not Fedora, so you can boot into Windows from LILO if you want to.

This method of using the Fedora GRUB bootloader instead of the Xandros LILO is quite flexible, since one may simply edit the Fedora /etc/grub.conf file to add or delete operating systems. Since GRUB is a popular bootloader, many system administrators can create configuration files for GRUB out of thin air.

Coping with Windows

Instead of beginning with a freshly formatted hard disk, many users might wish to install the Linux flavors on a disk that already has Windows installed. This is not too difficult, either. You’ll need to follow one of the two procedures described below, depending upon how your disk is partitioned.

If your hard disk has one or more logical partitions, the task is easier. Back up all of your data on the partition you want to use, note its size, and reboot into the installer for the first Linux distro you want to install. If you have more than one additional partition on the disk, you’ll want to use the last partition on the disk — so, if you have D: and E: under Windows, for example, you’d want to use the partition Windows sees as the E: drive.

When you are presented with the disk partitioning screen, delete this partition to free up space. Linux names the partitions differently, so you’ll need to compare the sizes of the partitions to make sure you are deleting the correct one. It might be a good idea to back up all of your data, including that on your C: drive, in case you accidentally delete the wrong partition.

Now, out of the space freed up, carve out a swap partition and a “/” partition for Xandros, as explained earlier. Take care to leave enough space for Fedora. Then proceed with the rest of the steps, as explained in the Installing Xandros and Installing Fedora sections above.

If you have everything on a single partition, which is pretty common, there’s still hope. First of all, defragment your hard disk. Then download Partition Resizer, which is an excellent piece of free software. Copy it to a bootable diskette and reboot into the DOS environment using it. (A bootable CD-ROM will not do since Partition Resizer requires the medium it is launched from to be writable.)

Run the program and resize your C: partition to carve out free space for the Linux distros. Reboot into Xandros installation routine and create its swap and / partitions out of the free space. Then, proceed with the rest of the steps of the procedure.

Modifications and alterations

What if you wish to install the Fedora GRUB (using the Linux rescue mode installation of your Fedora install CD) on an MBR that already has the Xandros LILO installed?

In this case, append the following lines to the Fedora /etc/grub.conf file to add Xandros to the list of operating systems that the bootloader can boot. This will work because Xandros installs a copy of LILO to its root partition anyway. This method will prove useful if you wish to install Xandros on a system that already has Fedora installed.

title Xandros
rootnoverify (hdx,x)
chainloader +1

Replace (hdx,x) with the GRUB name of the partition on which Xandros is installed — for instance, (hd0,5).

This method has the advantage of keeping the Xandros (or Mandriva, for that matter) LILO boot sector completely separate from the GRUB information used by the other distro, so mishaps are less likely. And of course, you might tweak this method to suit your specific needs — like creating a system that can boot four, or even more, operating systems. Best of luck!

Cheenu Sharma is a young technical journalist and Linux enthusiast based in India.