View Full Version : Booting XP from Grub

27-01-2004, 08:44 PM
I've currently got Arch Linux (http://www.archlinux.org) installed on my slave HDD, while XP is installed on the master HDD.

Residing in the MBR on what would be hda in Linux is the Windows XP boot loader; and I have Grub installed on the hdb MBR.

My current entry in Grub is

# (0) Arch Linux
title Arch Linux [/boot/vmlinuz]
root (hd0,1)
kernel (hd0,1)/vmlinuz root=/dev/discs/disc1/part3 ro

After reading the Grub documentation, I tested out

rootnoverify (hd1)
chainloader +1
...although at first I left out makeactive, presuming that was in case the partition/drive wasn't set as active. Grub wouldn't boot, so I changed that and added the makeactive line (using the e edit command, not changing /boot/grub/menu.lst).

After it still didn't work, I rebooted (because it froze when it didn't work), but ran into a kernel error. Partition Magic 8 reported that the partition table was bad, so under Disk Management I deleted the three Linux partitions and reinstalled Arch Linux.

What exactly would I need to put into /boot/grub/menu.lst so that it had an entry which loads the MBR off hda (/dev/discs/disc0/disc, although Grub will take it was hd1)?

27-01-2004, 09:07 PM
I am not a user (yet) of GRUB - I am still using LILO.

But a principle here - if you use two boot loaders then the first one must point to the second one.

Here you are using the NT boot loader on hda so you must edit boot.ini to be able to use GRUB as the second boot loader. I'm not sure if this will work if you install GRUB to the mbr on hdb. With LILO you usually install to the / partition if you are using the NTLDR.

I haven't got a copy on hand of what boot.ini might look like for this situation but for two versions of Windows it might look like:

[boot loader]
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Win2k Novell LAN" /fastdetect
multi(0)disk(0)rdisk(0)partition(2)\WINNT="Win2k Local" /fastdetect

Alternatively you install GRUB to the mbr of hda - this is the way I would do it.

27-01-2004, 09:50 PM
P.S. a good manual for GRUB is found at:

27-01-2004, 11:23 PM
I can see a few things here:
/boot/grub/menu.lst is likely a symlink to /boot/grub/grub.conf

They stopped using menu.lst a while back in favor of grub.conf :-)
cd /boot/grub && ls -l
Should show you what it's symlinked to

Read the Gentoo Documentation as I'd mentioned, its pretty good :-)

You said you use:
rootnoverify (hd1)
chainloader +1

My Family's PC has the following entry:
# This is not for booting, just dont get any ideas
title=Windows XP
root (hd0,0)
chainloader (hd0,0)+1

Try that one (As a seperate entry just in case), and keep in mind that hd1 is the SECOND HDD that Grub can find. This goes regardless of it being hdb, hdc or hdd... Its just the SECOND HDD it can find. If its your one and only HDD, or the first HDD in the PC, then you want hd0.
Im assuming you want it to be hd0 seeing as you wrote hda in there :-)

Give it a shot, the worst that can happen is it wont boot...

Hope this helps


Graham L
28-01-2004, 03:14 PM
The rootnoverify is a Good Idea, That stops the automatic disk check of the partition. Even though the Linux file system checking is great, it's probably better not to do it to a Microsoft OS. :D

28-01-2004, 05:48 PM
I've read the Grub documentation (that's how I fixed the entries so that I could actually boot Arch Linux); it covers Windows NT/95 largely - some DOS too.

Couldn't find anything useful in the Gentoo documentation (http://www.gentoo.org/doc/en/index.xml) either - I'm probably not looking in the right place though :D

The reason I use rootnoverify (hd1) is because it appears that Grub detects the HDD that Arch Linux is installed on as hd0 - the first one it finds. Therefore I assume it would detect my primary HDD (where XP is installed) as hd1.

Do I really need to use makeactive?

Graham L
28-01-2004, 06:09 PM
I am far from documentation or a /boot/grub, but I'm wondering about the hd0/hd1 problem. We seem to be in the transition between the "traditional" /dev/hda, /dev/hdb ... and the new /dev/disks/...

Have a look at dmesg for what disks are identified as.

Didn't the installation recognize that XP was there and give you the oprion of booting to it? Even if it didn't, I suspect there is a GUI Control Centre page to set up booting options.

I seem to remember that the "makeactive" is done for MS comaptibility ... but I'm only using grub on one RH8/WinME machinne ... and I haven't had any problems (apart from spelling errors and then a problem with the "LABEL=/" format as the partition identifier). :D

28-01-2004, 06:37 PM
What I posted above was ALL that I've got on the Family's PC and it worked...


28-01-2004, 08:44 PM
Considering I just spent a good hour hoping like hell I wouldn't have to reinstall XP; I don't feel like trying out any flashy big-bang stuff in Grub :D

I ran through all sorts of different entries in Grub (none worked, though of course they wouldn't if the first one buggered it all up), and eventually ended up using the rescue option from my XP CD a few times - it was for some reason picking up the location of %windir% on E: instead of C:.

Now, er... Grub picks up /dev/discs/disc1 as hd0 because it is installed on /dev/discs/disc1/disc (the MBR); whereas in actual fact this is the slave drive, and should (IMO), be recognised as a stock standard hd1.

Nevertheless, it then picks up /dev/discs/disc0 as hd1 (I presume, but it's not as if I've had success booting Windows using this grub).

The best I got out of all toying around with the entries was a few "Invalid system disk" errors, which do make it sound like something from Windows got loaded, although I never got past this. I also browsed through ntldr using Vim, and came across a section which was complaining about corrupted loading stuff, most likely due to me toying around with partition entries in Grub.

If it makes a difference, Arch Linux is using GNU Grub 0.93 (not sure what the latest version is), and I didn't think that /boot/grub/menu.lst was a symbolic link - after which taking a look, no, it isn't, as there is no grub.conf file anywhere in site (didn't look in /boot though; just /boot/grub).

I might now try something with rootnoverify (hd1,0). Grub complains about plain old (hd1) being an invalid device for some reason, so I'm not sure how I'll tell it to load the MBR off hd1. I don't know what difference chainloader (hd1,0)+1 makes to chainloader +1 - both end up in errors for me. I'm beginning to wonder if it's makeactive that is creating my problems in terms of screwing up MBRs and partition tables, but it doesn't work whether makeactive is included or not.

I should probably try reinstalling Mandrake 9.0, because that automatically inserted a working entry to boot XP, whereas Arch Linux is pretty much DIY-and-screw-things-up-along-the-way (I've already reinstalled it three times over the ~10 days of actually trying it).

28-01-2004, 09:14 PM
Further update...
rootnoverify (hd1,0)
chainloader (hd1,0)+1

...all by itself didn't work (though C_S uses plain old root, I understand).

And this time, I decided to see what Grub's auto-completion says. My choices for the main boot device are fd0, hd0, and hd1 (duh), but doing auto-completion on (hd1, gets interesting...

the first two partitions, which are NTFS, it says are unknown type (0x72 I think - not sure if that's what it actually displayed afterwards, I should have checked). The next partition is recognised as FAT32 (vfat), which is correct. Doing this on hd0 turns up the right partitions too, as that only has ReiserFS, vfat, and swap space partitions.

I'm beginning to wonder, would Grub (v0.93 perhaps?) not work with NTFS 5.1 (XP)? I don't know what NTFS version XP uses by default, but using Partition Magic it to do formats, it seems to like using NTFS 5.0 (Win2K) as the default.

I am now seriously considering reinstalling Mandrake to see if it can automatically pick up the right entry for Grub, and can also boot off that.

John H
28-01-2004, 09:39 PM
If you look through the thread "Messed up Grub - won't boot Windows" started by me on 20 Jan, you may find some further hints from these guys. They sorted it out for me after I had stuffed it up.

You will be able to see what I had in grub.conf, and what Chill in particular suggested I change. That worked fine for me.

Chill's comment to make a back up of grub.conf before editing it was sage advice, by the way, though too late because I had already stuffed it up without a back up...

John H

28-01-2004, 11:53 PM
> though too
> late because I had already stuffed it up without a
> back up...


So lets get a few things straight here, please post the following:
Master/Slave/Primary/Secondary positionings of HDD's and the partitions
What you have on which partitions (eg, Windows on /dev/hdb1, / on /dev/hda2, /boot on /dev/hda1 etc)

That way we can work out EXACTLY what your .conf file needs to have in it.

IIRC, 0.93 should be the latest. Its fully stable and the developers have been hassled for a while to label it a stable release.

But Linux boots fine?

Stick with it, you'll get it....


29-01-2004, 11:24 PM
Ah, well, you know... considering it'd be a bit hard to browse from Runlevel 3... :D

On Primary IDE Channel, the Master disk is where Windows is located. First partition is NTFS (XP is installed here), second NTFS also (documents, etc), and the final one FAT32 (multimedia). These should be /dev/hda1, /dev/hda2, and /dev/hda3 respectively.

The Slave disk is where Linux is located, my partition layout first up has /boot, then the swap partition, then root (/), and then a FAT32 partition (backups, misc stuff I really ought to sort through). However, during partitioning for Arch Linux, the FAT32 partition is said to be /dev/discs/disc1/part1 (most likely because it is already present? /boot, swap, and root get assigned part2, part3, and part4 respectively.

I always try to install the boot loader for whatever distro I use on the MBR of the Slave drive - although the Linux boot loaders can automatically detect and load Windows, if anything goes wrong it's quicker for me to change the boot order in the BIOS back to the Master drive, as opposed to inserting the XP setup CD and running fixmbr in repair mode.

Hence, as Grub is installed on the MBR of the Slave drive, it detects that drive as hd0. The Master drive is then detected as hd1.

Because I've gone through every Grub configuration I could think of (not many ;)), I installed Mandrake 9.0 to see what they put in menu.lst (and as I said, Arch Linux also uses menu.lst; it does not appear to be a symlink). Interestingly enough (or perhaps not), the entry to boot off the first partition on the Master drive (as said, where XP is installed) was ordered differently:
root (hd0,0)
chainloader +1

Please don't get confused; it says (hd0,0) because I installed Mandrake in standard mode, and hence did not get to chose where the boot loader went - it overwrote XP's.

So I have yet to reinstall Arch Linux, but when I do, I will most certainly try the following entry:

rootnoverify (hd1)
chainloader +1

And if that doesn't work, I'll fix any screwups and remove the makeactive line. And if that doesn't work, I'll use (hd1,0), and if it still won't work, I'll repeat using plain root as opposed to rootnoverify.

Surely I'll find a working solution somewhere :)

29-01-2004, 11:38 PM
Dont play around with settings for booting off HDD XYZ etc.. It breaks stuff....

Leave it set to boot from hda and install the boot loader into the MBR. It'll then install it onto your hda's MBR.

This is how it should be!

From there, it'll automatically pick up WinXP's boot loader (Which will be automatically booting XP and not showing the boot menu) so you'll be fine!!!!

Leave things that way.. It works.... Its simple...

Change the boot order for installing Arch Linux so it looks for the CD-Rom, then hda, then hdc...

Whatever you do, let it install into hda's MBR. If worst comes to work, boot off a Bootable floppy and fdisk /mbr the MBR away!

Hope this helps


30-01-2004, 08:38 PM
If you are stuck on this why not try to do it the other way round - use the Windows boot loader to do the job.

1. Restore the Windows boot sector using recovery console.
2. Use floppy disk to boot to Linux and write GRUB or LILO to the root partition rather than the MBR.
3. Use the following command to make an image of the first 512 bytes:

dd if=/dev/hda2 of=/mnt/floppy/linux.bin bs=512 count=1

- replace hda2 with your root partition

4. Restart Windows and copy the file linux.bin to the root of the c:\ drive
5. Modify boot.ini to have the line:

C:\linux.bin = "Linux"

Used this method yesterday and it worked fine.