Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] Grub: Second harddrive (XP) not bootable
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
haarp
Guru
Guru


Joined: 31 Oct 2007
Posts: 535

PostPosted: Sat Jan 10, 2009 7:48 pm    Post subject: [solved] Grub: Second harddrive (XP) not bootable Reply with quote

Greetings.
For a long time now, I've been using a single harddrive (sda) containing just Gentoo. And it was good. A few weeks ago, I was required to install a Windoze for testing purposes. Relax, I am not going to use it for anything else ;)
I choose XP x64. I attached a second harddrive (sdb) for it to reside on. The installer insisted that it needed to butcher Gentoo on my first drive or it refused to install, so I unhooked it and installed XP on the second one. Hooked the first up again.
Voila: Letting the first drive boot gives me my normal Grub, Booting the second drive (using the BIOS Boot menu) gives me Windoze.

So far so good. Now I tried adding Windoze on the second disk to Grub on the first one:
Code:
title Windoze XP
        rootnoverify(hd1,0)
        makeactive
        chainloader +1

Should work fine? Doesn't.
Code:
Grub error 13: Invalid or unsupported executable format

Searching the web hinted me to use the map function to make Windoze think it's the first drive:
Code:
title Windoze XP
        rootnoverify(hd1,0)
        makeactive
        map (hd0) (hd1)
        map (hd1) (hd0)
        chainloader +1

Well, no luck either. Same error. Any ideas?


Last edited by haarp on Mon Jan 12, 2009 10:08 pm; edited 1 time in total
Back to top
View user's profile Send private message
cynic120
n00b
n00b


Joined: 08 Jan 2009
Posts: 11
Location: Plano TX

PostPosted: Sat Jan 10, 2009 9:20 pm    Post subject: Reply with quote

Quote:
...so I unhooked it and installed XP on the second one. Hooked the first up again.


I'm wondering: by doing this, is it possible you have changed the mapping of your drives as seen by GRUB? You already hinted at that when you suggested
Code:

title Windoze XP
        rootnoverify(hd1,0)
        makeactive
        map (hd0) (hd1)
        map (hd1) (hd0)
        chainloader +1

But I'm wondering if it would be easier to check where GRUB thinks the drives are now, and change your grub.conf to reflect the current setup? What are the results of:
Code:

cat /proc/partitions

and
Code:

$ grub --device-map
$ cat /boot/grub/device.map
Back to top
View user's profile Send private message
haarp
Guru
Guru


Joined: 31 Oct 2007
Posts: 535

PostPosted: Sat Jan 10, 2009 11:16 pm    Post subject: Reply with quote

Nope, the partitions stayed the same order. 101% sure of that. /dev/sda is the first harddisk, sdb the second.
Code:
$cat /boot/grub/device.map
(fd0)   /dev/fd0
(hd0)   /dev/sda

The second disk is not even listed here. I wonder why?
Back to top
View user's profile Send private message
cynic120
n00b
n00b


Joined: 08 Jan 2009
Posts: 11
Location: Plano TX

PostPosted: Sun Jan 11, 2009 1:37 pm    Post subject: Reply with quote

Quote:
The second disk is not even listed here. I wonder why?


Just checking - did you do "grub --device-map"? The command I originally suggested is wrong - it should have been
Code:

$ grub --device-map <test.map>

where <test.map> is the name you choose for your output file. I tried it on my system using "grub --device-map test", and it created a file called "test" that contained a map of the drives as GRUB sees them. If you discover the map file GRUB creates deviates from your current device.map file, I'd start there. From the GRUB manual:
Quote:

When you specify the option --device-map (see Basic usage), the grub shell creates the device map file automatically unless it already exists. The file name /boot/grub/device.map is preferred.

If the device map file exists, the grub shell reads it to map BIOS drives to OS devices. This file consists of lines like this:

device file

device is a drive specified in the GRUB syntax (see Device syntax), and file is an OS file, which is normally a device file.

The reason why the grub shell gives you the device map file is that it cannot guess the map between BIOS drives and OS devices correctly in some environments. For example, if you exchange the boot sequence between IDE and SCSI in your BIOS, it gets the order wrong.

Note the last line I emphasized. I know you're dealing with SCSI devices (sda, sdb, etc), but I also know if you install GRUB, and then add another drive to your system, it can change how GRUB maps the drives depending on which SATA port you plugged the drives into.

One more thing. I was looking at the Gentoo GRUB Error Collection, and the suggested method for mapping your disks is
Code:

title Windows XP
  map (hd0) (hd1)
  map (hd1) (hd0)
  chainloader (hd1,0)+1

I also noted that same solution in a couple of other posts I read when I google'd GRUB Error 13. Maybe you need to change "chainloader +1" to "chainloader (hd1,0) +1"?
Back to top
View user's profile Send private message
haarp
Guru
Guru


Joined: 31 Oct 2007
Posts: 535

PostPosted: Mon Jan 12, 2009 4:52 am    Post subject: Reply with quote

Changing the chainloader line worked. Thanks!
And yes, grub showed the extra drive correctly in the test.map file...
Back to top
View user's profile Send private message
cynic120
n00b
n00b


Joined: 08 Jan 2009
Posts: 11
Location: Plano TX

PostPosted: Mon Jan 12, 2009 12:28 pm    Post subject: Reply with quote

Woot! Glad it worked :D

Can we change this to solved now?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum