This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature

Triple-booting with GRUB, LILO, and Windows XP

By Samartha Vashishtha on April 13, 2006 (8:00:00 AM)

Share    Print    Comments   

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.

Samartha Vashishtha is a poet, intermittent journalist, and Linux enthusiast. He works on the technical communication team of a leading IT company in India.

Share    Print    Comments   

Comments

on Triple-booting with GRUB, LILO, and Windows XP

Note: Comments are owned by the poster. We are not responsible for their content.

regarding lilo and xandros

Posted by: Anonymous Coward on April 13, 2006 07:53 PM
well if there is one excellent program in windows it is the Acronis Disk suite. It costs 40 $ dollars but is very practical in order to resize and also it includes a boot manager.

#

Re:regarding lilo and xandros

Posted by: Anonymous Coward on April 13, 2006 09:18 PM
You can use only one boot loader for more than one distribution - either lilo or grub, or even Windows NT/2000/XP/2003/Vista boot loader.

#

Why Chainload ??

Posted by: Anonymous Coward on April 13, 2006 08:55 PM
Why are you using grub to chainload lilo?? There is nothing particularly difficult about configuring either lilo or grub to boot multiple linux distros without resorting to chainloading another bootloader on each linux distro. Take a little time to learn how to configure either lilo or grub; it will be time well spent.

#

Re:Why Chainload ??

Posted by: Anonymous Coward on April 13, 2006 11:56 PM
Thanks for your comment. I guess I have explained in this article pretty many cases where I found this method useful. Things do not always happen the ideal way--I personally never wanted to touch my Xandros while trying many other distros in the triple booting way. With LILO, things aren't that simple. As I explained, editing the LILO config file didn't work. And there is not much high-quality documentation on LILO accessible online.

Ofcourse, things would work pretty well if you tried triple booting when both distros use GRUB only. But that isn't the case with everybody.

But, in the end, simpler ways might exist. But I know it by experience that things do not always happen automatically when triple booting's concerned. This method is for those wretched times.

And yes, I have spent considerable time with both LILO and GRUB.

#

Re:Linux Staring Problem

Posted by: Anonymous Coward on April 13, 2006 10:38 PM
Well, unless you are a troll trying to reiterate what is percieved as common linux problems, I can help. But first you have to tell me what distribution of linux you are using.

#

Re:Linux Staring Problem

Posted by: Administrator on April 19, 2006 06:57 PM
i am using PCQuest Linux. that has come with PCQuest Mag. (April month). plz tell me more.

#

Why?

Posted by: Anonymous Coward on April 13, 2006 11:35 PM
There is no reason to chainload bootloaders. GRUB will cheerfully boot pretty much anything directly. The machine I'm on right now dual-boots XP and my own custom Linux, and adding another OS is as simple as installing it normally (on the same hard drive or another - doesn't matter, I setup a machine with 6 OS's across 3 drives a while back for testing) and adding an entry to GRUB's configuration file. It should be pointed out that you don't *have* to install a boot loader when you install Linux if you already have one due to an existing Linux installation. Most Linux installation schemes give you the option of not installing one - just configure the existing one to boot the new one. BTW, I've used GRUB to boot XP and XP's boot manager to boot Linux - it's a matter of preference, but IMHO GRUB is probably the best all around general purpose boot loader.

#

Re:Why?

Posted by: Anonymous Coward on April 14, 2006 11:13 AM
I agree. Thats just extra boot time to chainload a bootloader. I have 5 linux distro's and 2 windows distro's on one machine using GRUB. I have to have windows to support work. I use linux for me.

#

Re:Why?

Posted by: Anonymous Coward on April 14, 2006 12:14 PM
GRUB may have been the best in wide use, but Boot Camp's method of choosing a Startup Disk is best, in my opinion.

#

How do you use XP's boot manager to boot Linux?

Posted by: Anonymous Coward on April 14, 2006 07:49 PM
How do you use XP's or Win2000's boot manager to boot Linux?

I've often wondered how to do this.

Would you be so kind as to give a brief rundown of what one would do?

#

Re:How do you use XP's boot manager to boot Linux?

Posted by: Anonymous Coward on May 31, 2006 08:47 AM
There is a great article at <a href="http://www.geocities.com/epark/linux/grub-w2k-HOWTO.html" title="geocities.com">http://www.geocities.com/epark/linux/grub-w2k-HOW<nobr>T<wbr></nobr> O.html</a geocities.com>
to show you how to use XP's boot manager to boot xp or linux. Have fun.

#

Purpose?

Posted by: Anonymous Coward on April 14, 2006 04:45 AM
Why bother using Windows? Aren't we trying to NOT use it? Buy an external hard drive. Put an OS on that and an OS on the main one. That is two. How many does one person need?

#

Re:Purpose?

Posted by: Anonymous Coward on April 14, 2006 12:11 PM
Sorry, I cannot afford a new external hard-drive!<nobr> <wbr></nobr>:)

#

You shouldn't write these guides

Posted by: Anonymous Coward on April 14, 2006 05:17 PM

It sounds like the author doesn't have a clue about boot loaders.



  1. LILO is not an out-of-date boot loader like the author makes it out to be. I use it as a matter of preference, and there are loads of cool things you can do with it, if you do your research.

  2. Triple-booting, using one boot loader to call another, is really stupid. It is easy to configure one or the other to load three OS's, and to remove the one that you do not want.

  3. You DO NOT change LILO's configuration by simply changing the configuration file. Before rebooting you must run the command,
    <tt>lilo -v</tt>
    , so that the changes are made.

#

Re:You shouldn't write these guides

Posted by: Anonymous Coward on April 14, 2006 06:38 PM
I agree Lilo is fine...one thing grub is good at is editing a command line boot option before u boot...I don't know if lilo can do that but most of the time its not needed.

A more interesting problem is triple booting
XP, NetBSD(or any BS) and linux for example...
It can be tricky..

#

Re:You shouldn't write these guides

Posted by: Anonymous Coward on April 15, 2006 04:46 PM
Hi,


      Thanks for the comments. I agree it might sound stupid to you, but there are so many newbies out there who can't edit config files and issue commands.

BTW, did you notice that in this method, one simply doesn't need the command-line--unless it is Windows first case discussed earlier.

And yes, I did find LILO poorly documented and stubborn for the purpose of configuration. That your find it good could be a personal viewpoint.

I am just an advanced newbie. That is what I am. I think in ways that could help newbies... geeks don't need How Tos anyways.

Samartha Vashishtha

#

Installing a copy of Windows on a Spare Partition.

Posted by: Anonymous Coward on April 14, 2006 07:40 PM
If you're starting with a new hard drive and want your Linux distros to coexist with Windows, install Windows first."

This is not necessary.

For a nice writeup of how to install Windows after Linux and how to use grub generally, see:

<a href="http://linux.coconia.net/addingXP.htm" title="coconia.net">http://linux.coconia.net/addingXP.htm</a coconia.net>

It is called: "Installing a copy of Windows 2000/XP on a Spare Partition."

#

Chainload Because!

Posted by: Anonymous Coward on April 14, 2006 11:23 PM
First, like others mentioned, LILO is not outdated.
Pesonally, I prefer lilo over grub because of clearer configuration syntax, and lack of graphical stuff.

second, unlike others mention, there is a good reason for chainloading. Imagine using several different kernels on each install (yes, even windows can do that, although why is a valid question here).

If you have just 1 bootloader in the MBR you need to copy every new/additional kernel to someplace where your bootloader can find it before being able to configure it. Then configure, etc.

At minimum, using grub, in your 2nd install you have to mount the / of your first, and edit<nobr> <wbr></nobr>/etc/grub.conf or something. With lilo you also have to chroot (or reboot to your other install) and run lilo.

With chained bootloaders, you just have to configure (and rerun lilo) the bootloader for your current install, and the MBR bootloader hands over control to that (and therefore doesn't have to be updated).

All of which can be figured out from reading the manpages thank-you-very-much, so please stop bashing (and making yourselves look ignorant), and start reading the doc's.

Not clear for a newbie? Almost all of the distro's recognize your windows stuff, and will offer to automagically add windows to your bootmenu, be they lilo or grub. Newbie can start reading about bootmanaging right away. And this hypothetical newbie sure is not going to start with 2 distro's at the same time anyway.

#

Re:Don't Chainload Because!

Posted by: Anonymous Coward on April 15, 2006 02:19 PM
If you want to have the option of different kernels for each Linux install, it is relatively easy to achieve using LILO without having to chainload. You simply have to mount up all of the partitions storing the kernels, and then in the LILO config, point to where those kernels are mounted on your current system.

Example: Say you have another Linux distro, on<nobr> <wbr></nobr>/dev/hda3. Mount it up to<nobr> <wbr></nobr>/mnt/hda3, or something. Then in your LILO config, point to the kernel images, relative to your _current_ root directory, _not_ relative to where your root directory would be if you were loading up that second Linux distro. So I would point to something like<nobr> <wbr></nobr>/mnt/hda3/boot/vmlinuz-2.4,<nobr> <wbr></nobr>/mnt/hda3/boot/vmlinuz-2.6 NOT<nobr> <wbr></nobr>/boot/vmlinuz-2.4.

LILO takes care of it 100%. There is no chrooting or chainloading required, because when you run the lilo command, it changes your MBR to point to the physical location of the kernel on your hard drive, and not to a potentially variable file path.

P.S. LILO can be plenty graphical if you wish. I've lost the link, but I've seen a page that describes even animated LILO bootscreens.

#

Re:Don't Chainload Because!

Posted by: Anonymous Coward on April 16, 2006 02:29 AM
Your method is really strange to me. I don't mean I doubt your method, I believe you know what you are talking about.

The problem is, the syntax is awful to me. For a boot loader, most people expect it getting the kernel images from raw partition, instead of mounted filesystem.

Isn't it more intuitive if the syntax is '/dev/hda3/boot/vmlinuz-xxx'? Why, after so many years of causing pain to Linux users, Lilo still insists its stange syntax? I guess that's why every major distributions abandon it.

By the way, I doubt Lilo is cable of booting BSD family OS. But I konw for sure GRUB can do it.

#

Re:Don't Chainload Because!

Posted by: Anonymous Coward on April 18, 2006 03:42 PM
The thing to keep in mind is that LILO cannot read filesystems. It generates a hard-coded pointer to the hard-drive sector number or whatever. Grub on the other hand CAN read filesystems, so you just tell it the filename and it will find it even if the file moves. That's why under grub you don't need to mount all the partitions and you don't have to run a command to update anything. Grub will find the files when it boots up. This is the difference between Grub and Lilo. It is a difference in convenience and a difference in robustness. Grub is more convenient and more robust.

#

Standalone GRUB configuration ?

Posted by: Anonymous Coward on April 19, 2006 01:47 PM
I'm playing with several distributions on my PC and also update or replace them from time to time. My problem with GRUB is that it will overwrite the GRUB configuration if this one is located in the partition of the OS I'm replacing. Right now, to avoid this, I've created another partition with a minimal Linux distribution for the sole purpose of having a "standalone" GRUB configuration completely independant of the other installations. This way, I'm sure my GRUB config will not be lost by re-installing another partition. Aldo not a big deal, the drawback of this method is that you have an extra partition with some disk space used for a "dummy" Linux install. My question is wether this is indeed the only way to have a "standalone GRUB configuration" that will not be touched by any OS installation or upgrade ? Or is there a better/cleaner/... method ?
Thanks in advance for any advice.

#

Linux Staring Problem

Posted by: Administrator on April 13, 2006 07:01 PM
I m new to this linux, & want to learn more about it. i am having some problems like

1 > Sound driver not instaled properly.
2 > after grub nothing can come.
3 > how to run java in it.
if anybody have idea plz send me immediatly.

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya