Multibooting Red Hat Linux 9 and Windows XP


 

 

 

 

 

Introduction

The page describes how to set up a pc to multiboot between Red Hat Linux 9 and Microsoft Windows XP.

It is based on the Sybex publishers 2 cd edition of Red Hat Linux 9.0. There may be slight differences compared to the Red Hat 3 cd edition.

The instructions will probably also be applicable to other versions of Red Hat Linux which use GRUB as the Linux boot loader. However I haven`t done it, so no guarantees given

The instructions will probably also apply to Microsoft Windows NT 4.0 and to Microsoft Windows 2000, as these use a similar boot process to Windows XP. Again, I haven`t done it, so no guarantees given.

On the pc`s that I have set up so far, I also have a FAT 32 partition on which is installed Windows 98. So these instructions can be extrapolated to include other operating systems as well.

 

Boot loaders

Most if not all operating systems require some form of boot loader.

The boot loader is a small chunk of code that lives in the Master Boot Record section of the first and active hard drive of the pc.

When the pc is booted up, the BIOS goes to the Master Boot Record, reads the code, from which it learns which partition is to be booted,and what boot file to look for.

The boot file then starts the boot up process of the actual operating system.

Alternatively, the boot file may point to another boot loader somewhere else. In this case, this second boot loader starts the relevant operating system.

Again, alternatively, this second boot loader may point to a third boot loader, and so on.

It is this ability to chain boot loaders that allows us to set up multibooting of Linux and XP

 

Choice of boot loader

Both Linux and XP have their own boot loaders, which are installed as part of the installation of the operating system.

It is possible to use either of them as the master boot loader, but for both of them, setting them up is not trivial.

There is a lot of conflicting advice on the internet and in books, about which boot loader is preferable. Each pc has to be considered individually, and a decision made on which boot loader to use based on the priorities for that pc.

This webpage has two sets of instructions, describing how to set up the pc to use either of them as the master boot loader. Some Linux skills are required for both sets of instructions.

There is a third option - use a third party boot loader. There is no information about this on this webpage.

 

Windows XP

The installation of XP will overwrite any existing boot loader, and if there is an earlier version of Windows, XP will add the boot loader for the earlier version to the boot loader menu.

This behaviour is not controllable, it is built into the installation procedure.

So if you install Linux before you install XP, the XP installation will overwrite the Master Boot Record which points to the Linux boot loader, and it will not be possible to boot Linux, unless Linux is installed in a particular way.

My preference is therefore to install XP, and then install Linux - even if the pc is to use the XP boot loader.

 

Red Hat Linux 9

Red Hat Linux 9 uses GRUB as its boot loader by default. The use of LILO is an option, but LILO is losing popularity, and Red Hat are going to drop it soon. So there is nothing about LILO on this webpage.

The installation programme for Red Hat Linux 9 ( the programme is called Anaconda ) allows GRUB to be configured in various ways - it is these variations that allow us to choose which boot loader to use as the master boot loader.

 

Using the XP boot loader as the master boot loader

Here is a summary of what you are going to do :-

 

install XP

XP sets up a master boot loader

install Linux

GRUB installed on the Linux boot partition

copy Linux boot partition record into file called bootsect.lnx

copy bootsect.lnx file into boot partition

add Linux to XP boot loader using bootsect.lnx file

Now the details - my preference is to install XP first.

Just do the normal install, XP will create or overwrite the master boot record, and the pc will then boot up into XP or an earlier version of Windows, if it exists.

Now install Linux - follow the set up instructions until you get to the section about configuring GRUB - now stop - the next few steps are critical.

There are various options available for this screen.

Start by clicking on the "Change boot loader" button. The pop-up window should provide three options :-

  • Use GRUB as the boot loader

  • Use LILO as the boot loader

  • Do not install a boot loader

You want to use GRUB as the boot loader, so make sure that button is highlighted - it is by default.

Click on OK to get back to the main screen.

You do not want to add any other operating systems.

It is your choice if you want to add a GRUB password.

Now click on the button for "Configure advanced boot loader options"

Then "Next", to take you to the next screen.

You should now have a screen which offers you a choice of where to install the boot loader.

Go for the second choice - "/dev/hdxx First sector of boot partion"

NB - the /dev/hdxx will automatically be pointing to the Linux boot partition created earlier in the installation programme, so it could be /dev/hda2 or /dev/hdb1, or something like that. Write down what it says, you will need it later.

You can safely ignore anything else on this screen - unless of course you know better ....

Now click on "Next", and you are safely on your way.

Until the next hurdle.

When it asks you if you want to make a boot disk - you do. You will not be able to run Linux and set up the XP boot loader without it.

Once Linux is fully installed, it is neccessary to set up the XP boot loader. And for this you need some Linux skills.

Using the Linux boot disk you just created, boot up into Linux, and open a command prompt screen.

Mount a clean formatted floppy.

At the command prompt, enter the following line :-

dd if=/dev/hdxx of=/mnt/floppy/bootsect.lnx bs=512 count=1

Of course, instead of /dev/hdxx, put in the partition number you wrote down earlier, during the installation process.

Now close down Linux, remove the floppy, and reboot into XP.

Once XP is up and running, copy the file "bootsect.lnx" from the floppy into the root of the boot partition of the first hard drive.

You will know it is the boot partition because of the existence of the files "ntldr" and "boot.ini".

Now open the "boot.ini" file in notepad, and add the following line at the end :-

C:\bootsect.lnx="Red Hat Linux"

Save it, reboot XP and now you should find the Red Hat Linux entry in the boot up menu list.

 

Using GRUB as the master boot loader

Here is a summary of what you are going to do :-

 

install XP

XP sets up a master boot loader

install Linux

GRUB installed on the Master Boot Record ( which deletes the existing MBR installed by the XP installation process)

modify the GRUB configuration file to add XP

Now the details - my preference is to install XP first.

Just do the normal install, XP will create or overwrite the master boot record, and the pc will then boot up into XP or an earlier version of Windows, if it exists.

Now install Linux - follow the set up instructions until you get to the section about configuring GRUB - now stop - the next few steps are critical, although the default values may be okay.

There are various options available for this screen.

Start by clicking on the "Change boot loader" button. The pop-up window should provide three options :-

  • Use GRUB as the boot loader

  • Use LILO as the boot loader

  • Do not install a boot loader

You want to use GRUB as the boot loader, so make sure that button is highlighted - it is by default.

Click on OK to get back to the main screen.

The white box right in the centre of the screen probably has two lines in it -

 

    DOS              /dev/hda1

    Red Hat Linux    /dev/hda3

    

The installation program has picked up the XP partition that was created when XP was installed, which is why the DOS entry is there.

NB - this assumes you installed a FAT 32 partition as the first partition.

The second line is for the new installation of Linux you are doing. >/p>

Click on the first line, then on "Edit".

In the "Label" box, type in "Windows XP" or something like that.

For the "Device" box, use the arrow to select the partition that contains the boot information for Windows XP. Note that this may not be the same partition that XP is installed on. Usually, Microsoft setup programmes install the boot information on the C:\ drive, which is the first primary partition of the first hard drive. In Linux nomenclature, this is called "hda1", so the device box should end up with "/dev/hda1" in it. It is pretty certain it will be there already.

Then click on "OK" to return to the main screen.

Make sure that Red Hat Linux is selected as the default.

It is your choice if you want to add a GRUB password.

Now click on the button for "Configure advanced boot loader options"

Then "Next", to take you to the next screen.

You should now have a screen which offers you a choice of where to install the boot loader.

Go for the first choice - "/dev/hda Master Boot Record ( MBR )" - this is the default, so the correct radio button will probably already be selected.

You can safely ignore anything else on this screen - unless of course you know better ....

Now click on "Next", and you are safely on your way.

When it asks you if you want to make a boot disk - you probably do, although you don`t explicitly need it. But it is very useful if GRUB fails to deliver.

Once Linux is fully installed, after rebooting, GRUB will offer the choice of which operating system to run.

Choose Linux, as XP will not load.

It is your choice as to whether you do the next bit through the Gnome desktop or through a command line environment.

Change directory to /boot/grub/, and open the file "grub.conf" in a text editor. The lower half of the file should look something like :-

 

    title Red Hat Linux (2.4.20-6)

           root (hd0,1)

           kernel /vmlinuz-2.4.20-6 ro root=LABEL=/

           initrd /initrd-2.4.20-6.img

    title Windows XP

           rootnoverify (hd0.0)

           chainloader +1

    

At the end of the file, add another two lines :-

 

           makeactive

           boot

    

So the Windows XP section should look like :-

 

    title Windows XP

           rootnoverify (hd0.0)

           chainloader +1

           makeactive

           boot

    

Save this, and reboot. And with a bit of luck, the Windows XP entry in the GRUB menu screen will now work - note that this entry does not load XP - it opens the XP boot loader, from which, as usual, you can load XP ( or other Microsoft operating systems, if you have more than one ).

 


© 2003 Ron Turner


Return to the Index page