LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Add Windows XP entry to GRUB (https://www.linuxquestions.org/questions/linux-software-2/add-windows-xp-entry-to-grub-434986/)

bforbes 04-13-2006 11:47 PM

Add Windows XP entry to GRUB
 
I can't figure out how to add a Windows XP entry to the GRUB bootloader. I know there's been a million threads on this already, but none of them seem to help me. It think the problem might be that I have a lot of drives and partitions.

I added the following to /boot/grub/menu.lst:

title Windows Xp
rootnoverify (hd0,0)
makeactive
chainloader +1

But when I select it during boot, it says some executable is not in the right format, or something like that. I tried hd1 and hd2, but that gave me errors about unknown partition type. Can anyone help me fix this?

Here's some specs:

Suse Linux 9.3

120gb SATA drive
/dev/sdb
/dev/sdb1 Reiser /
/dev/sdb5 NTFS Storage
/dev/sdb6 Swap
/dev/sdb7 Reiser (previous Suse install)
/dev/sdb8 NTFS Storage

120gb SATA drive
/dev/sdc
/dev/sdc1 NTFS Storage

200gb SATA drive
/dev/sda
/dev/sda1 NTFS Windows
/dev/sda5 NTFS Storage

It's all a mess I know, but there's a lot of valuable stuff stored on the partitions, so reorganizing it would take ages.

titanium_geek 04-14-2006 12:22 AM

hey! that's our problem.

you need to work out where the window's boot info is, and then how to tell grub that- hd0,0 isn't going to be helpful here.

titanium_geek

bforbes 04-14-2006 01:14 AM

Do you mean that I need to specify the windows directory as well as the drive? Do you have an example you could show me?

homey 04-14-2006 07:42 AM

Can you post the actual output of the commmand: fdisk -l

titanium_geek 04-14-2006 07:58 AM

as homey says, fdisk -l - that's a little L, not a one,
is the best way to start.

ok- an explanation of the problem:

grub reads the grub entry to find out what it needs to do. at the line where you call
Code:

rootnoverify (hd0,0)
you are telling grub to look at the first harddrive, and the first partition. (because grub starts counting at zero, not one.)
Ok. So if we look at your partition diagram, which we shouldn't rely on, go for the fdisk -l but if we have a look, it is pointing to the one that just says sdb. Try changing it to hd2 (for the third drive) and 1 for the second partion. so it would be
Code:

rootnoverify (hd2,1)
This is just guesswork of course- we will be able to concrete it with the output of the fdisk command.

oh- and the grub manual, though it be long and boring (hint- use the power of the table of contents) is an excellent resource. http://www.gnu.org/software/grub/manual/grub.html - use it!

and another thing- next time try and read the threads- I know it can be daunting when you are starting out.

One last thing- I was a rude idiot for not welcoming you to the forums- Welcome to LQ!

titanium_geek

bforbes 04-14-2006 08:42 AM

Thank you, it's good to be here.
I did read a few threads about this, but nobody else seemed to have as many partitions as I do, so those solutions didn't work.
Here's the fdisk output:

Quote:


Disk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 892 7164958+ 7 HPFS/NTFS
/dev/sda2 893 24321 188193442+ f W95 Ext'd (LBA)
/dev/sda5 893 24321 188193411 7 HPFS/NTFS

Disk /dev/sdb: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 2040 16386268+ 83 Linux
/dev/sdb2 2041 14592 100823940 f W95 Ext'd (LBA)
/dev/sdb5 2041 3736 13623088+ 7 HPFS/NTFS
/dev/sdb6 3737 3865 1036161 82 Linux swap / Solaris
/dev/sdb7 3866 4845 7871818+ 83 Linux
/dev/sdb8 4846 14592 78292746 7 HPFS/NTFS

Disk /dev/sdc: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 14593 117218241 7 HPFS/NTFS
The partition with windows on it is sda1. So should I try rootnoverify with (hd1,0) and (hd2,0), or should I also try higher partitions?

Emerson 04-14-2006 10:07 AM

> But when I select it during boot, it says some executable is not in the right format, or something like that.

What's the exact error message?

titanium_geek 04-15-2006 05:24 AM

try sdb5 as the place to find windows.

I think the solution might be that it's sda - not hda.

try, this:
Code:

rootnoverify (sd2,4)
the trick is to work out where XP is installed. so try the other NTFS partitions until it works, I guess.

remember that it's hardrive, partion number, but start counting at zero.

beyond that, my knowledge peters out- sorry.

titanium_geek

titanium_geek 04-15-2006 05:40 AM

http://www.gnu.org/software/grub/man...OS_002fWindows

this link might have some info in regards to your situation.

I think, that it might be worth an day's work to back up your stuff, and then do a complete reformat and repartition- in a way that makes sense.
- but you should be able to fix it without that- of course with less hair :)

titanium_geek

bforbes 04-15-2006 08:56 AM

Quote:

Originally Posted by titanium_geek
http://www.gnu.org/software/grub/man...OS_002fWindows

this link might have some info in regards to your situation.

I think, that it might be worth an day's work to back up your stuff, and then do a complete reformat and repartition- in a way that makes sense.
- but you should be able to fix it without that- of course with less hair :)

titanium_geek

I'll try all those things, sounds promising.

Ideally I would repartition everything, but there's a few hundred gig of stuff on these drives, it would take a bit of work to pull off.

bforbes 04-18-2006 09:30 PM

I haven't been able to get any hd#,# combination to work, and I think I know why. I installed Windows on that partition while I already had Windows installed on another partition. There is thus no boot.ini on the partition I'm trying to boot to. What should I put in the boot.ini?

EDIT: If I need to reinstall Windows, can I do it without clobbering GRUB? Could I maybe unplug all hard drives except for the Windows drive, install Windows, then plug everything back in?

titanium_geek 04-20-2006 04:19 AM

one: windows loves to be the first partition on the first drive. It will scream if you don't let it.
two: it WILL clobber grub- if it can find it. :jawa:
I know of people on this forum who have unplugged all but the windows drive, then reinstalled windows with out it killing grub. Of course, you could put grub on a floppy disk, then windows can't touch it. A linux boot floppy is a very useful tool in situations like this, as well.

Oh- and have you thought in investing in an external hardrive to backup your data? ;)

good luck- windows can be infruriating!

titanium_geek

bforbes 04-28-2006 11:24 PM

I now have things working nicely. Here's a rundown:

1. Unplugged all drives except the one I want windows on.
2. Installed windows on it.
3. Linux drive is SATA1, windows drive is SATA3, but I changed the boot order in BIOS so that SATA3 was the first one. Could have just plugged them in the other way I know, but whatever.
4. Installed Kubuntu with GRUB onto the linux drive. It detected Windows during installation and added to the boot menu:
Quote:

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title Microsoft Windows XP Professional
root (hd0,0)
savedefault
makeactive
chainloader +1
So Windows is on hd0, even though it's actually on SATA3. I guess the boot order of the drives is important.

Anyone want to make any observations about this setup?

titanium_geek 04-28-2006 11:45 PM

looks good! keeping windows and linux on separate drives is always a good thing.

titanium_geek

bforbes 05-01-2006 01:32 AM

What is "dd" trick?

Try changing the boot order of the hard drives through bios, or just switch the cables around. That's what worked for me. It seemed that when my linux drive was the first boot hard drive, there was no "hd#,#" combination which would boot windows, but when I put the windows drive as the first boot device, it worked fine.

It's possible that you'll have to install GRUB on the windows drive if it's to be the first boot drive, because it's probably not on there at the moment.

sgmbest12321 11-12-2006 09:16 AM

remember that the (0,0) means hd_1 not hd_0
i had the same problem
i was putting in 0,3 for hdb3 when it should have been 0,2

sbose78 05-25-2011 11:08 AM

logical rearrangement
 
How about swapping your hard drives logically as Windows can only start from the first hard disk.

something like this...

map (hd0) (hd1)
map (hd1) (hd0)


All times are GMT -5. The time now is 05:57 PM.