LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 04-13-2006, 11:47 PM   #1
bforbes
LQ Newbie
 
Registered: Apr 2006
Posts: 27

Rep: Reputation: 15
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.
 
Old 04-14-2006, 12:22 AM   #2
titanium_geek
Senior Member
 
Registered: May 2002
Location: Melbourne Australia
Distribution: it died/ macosx
Posts: 2,478

Rep: Reputation: 50
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
 
Old 04-14-2006, 01:14 AM   #3
bforbes
LQ Newbie
 
Registered: Apr 2006
Posts: 27

Original Poster
Rep: Reputation: 15
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?
 
Old 04-14-2006, 07:42 AM   #4
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
Can you post the actual output of the commmand: fdisk -l
 
Old 04-14-2006, 07:58 AM   #5
titanium_geek
Senior Member
 
Registered: May 2002
Location: Melbourne Australia
Distribution: it died/ macosx
Posts: 2,478

Rep: Reputation: 50
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

Last edited by titanium_geek; 04-14-2006 at 08:01 AM.
 
Old 04-14-2006, 08:42 AM   #6
bforbes
LQ Newbie
 
Registered: Apr 2006
Posts: 27

Original Poster
Rep: Reputation: 15
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?
 
Old 04-14-2006, 10:07 AM   #7
Emerson
Senior Member
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~
Posts: 3,177

Rep: Reputation: Disabled
> 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?
 
Old 04-15-2006, 05:24 AM   #8
titanium_geek
Senior Member
 
Registered: May 2002
Location: Melbourne Australia
Distribution: it died/ macosx
Posts: 2,478

Rep: Reputation: 50
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
 
Old 04-15-2006, 05:40 AM   #9
titanium_geek
Senior Member
 
Registered: May 2002
Location: Melbourne Australia
Distribution: it died/ macosx
Posts: 2,478

Rep: Reputation: 50
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
 
Old 04-15-2006, 08:56 AM   #10
bforbes
LQ Newbie
 
Registered: Apr 2006
Posts: 27

Original Poster
Rep: Reputation: 15
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.
 
Old 04-18-2006, 09:30 PM   #11
bforbes
LQ Newbie
 
Registered: Apr 2006
Posts: 27

Original Poster
Rep: Reputation: 15
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?

Last edited by bforbes; 04-18-2006 at 09:58 PM.
 
Old 04-20-2006, 04:19 AM   #12
titanium_geek
Senior Member
 
Registered: May 2002
Location: Melbourne Australia
Distribution: it died/ macosx
Posts: 2,478

Rep: Reputation: 50
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.
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
 
Old 04-28-2006, 11:24 PM   #13
bforbes
LQ Newbie
 
Registered: Apr 2006
Posts: 27

Original Poster
Rep: Reputation: 15
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?
 
Old 04-28-2006, 11:45 PM   #14
titanium_geek
Senior Member
 
Registered: May 2002
Location: Melbourne Australia
Distribution: it died/ macosx
Posts: 2,478

Rep: Reputation: 50
looks good! keeping windows and linux on separate drives is always a good thing.

titanium_geek
 
Old 05-01-2006, 01:32 AM   #15
bforbes
LQ Newbie
 
Registered: Apr 2006
Posts: 27

Original Poster
Rep: Reputation: 15
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.
 
  


Reply

Tags
grub, suse, windows xp


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I add Windows XP to Grub boot loader? LUB997 Linux - Software 29 10-17-2009 11:11 AM
Grub will not let me add Windows XP to menu.lst BillyGalbreath Linux - General 7 12-27-2005 02:39 PM
add windows install to GRUB menu sall Linux - Hardware 4 07-29-2005 05:41 PM
How to add entry for Windows in lilo Wynd Linux - General 2 09-04-2003 04:58 PM
how do i add linux to windows boot entry nikhil778 Linux - General 1 08-30-2003 10:59 AM


All times are GMT -5. The time now is 12:34 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration