Boot problem with dual boot WinXP/11.4 system - Grub issue?

I am building a new dual boot system for WinXP and 11.4/KDE4.7.1
I have 3 hard drives that look like:

fdisk -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x41dff28f

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048  1953523711   976760832   83  Linux

Disk /dev/sdb: 320.1 GB, 320072933376 bytes
240 heads, 63 sectors/track, 41345 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00040dfd

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          63   625121279   312560608+   7  HPFS/NTFS/exFAT

Disk /dev/sdc: 150.0 GB, 150039945216 bytes
255 heads, 63 sectors/track, 18241 cylinders, total 293046768 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x1a291a28

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048      208895      103424   83  Linux
/dev/sdc2          208896    16979967     8385536   82  Linux swap / Solaris
/dev/sdc3        16979968   293046271   138033152   83  Linux

/dev/sda is dedicated to /home (Probably should not be marked bootable, but I don’t think that is my issue)
/dev/sdc is /boot, swap and /
/dev/sdb is WinNT.

Grub was created with YAST and loaded into the MBR of /dev/sdc
Here is the GRUB menu (after modification by PTA’s updategrub)

cat /boot/grub/menu.lst
# Modified by YaST2. Last modification on Fri Sep 16 19:12:07 EDT 2011
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# Configure custom boot parameters for updated kernels in /etc/sysconfig/bootloader

default 0
timeout 8
gfxmenu (hd0,0)/message
##YaST - activate

###Don't change this comment - YaST2 identifier: Original name: linux###
title Desktop -- openSUSE 11.4 - 2.6.37.6-0.7
    root (hd0,0)
    kernel /vmlinuz-2.6.37.6-0.7-desktop root=/dev/disk/by-id/ata-WDC_WD1500AHFD-00RAR4_WD-WMAP41624125-part3 resume=/dev/disk/by-id/ata-WDC_WD1500AHFD-00RAR4_WD-WMAP41624125-part2 splash=silent quiet showopts vga=0x346
    initrd /initrd-2.6.37.6-0.7-desktop

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.4 - 2.6.37.6-0.7
    root (hd0,0)
    kernel /vmlinuz-2.6.37.6-0.7-desktop root=/dev/disk/by-id/ata-WDC_WD1500AHFD-00RAR4_WD-WMAP41624125-part3 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x346
    initrd /initrd-2.6.37.6-0.7-desktop

###Don't change this comment - YaST2 identifier: Original name: windows###
title WindowsXP
    map (hd1) (hd0)
    map (hd0) (hd1)
    rootnoverify (hd1,0)
    makeactive
    chainloader +1
###Don't change this comment - Added by updategrub Fri Sep 16 19:13:22 EDT 2011###

###Don't change this comment - YaST2 identifier: Original name: windows###
title Microsoft Windows XP Professional - added by updategrub
    map (hd1) (hd0)
    map (hd0) (hd1)
    rootnoverify (hd1,0)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: GrubOnsdc###
title Legacy Grub in sdc MBR
    rootnoverify (hd0)
    chainloader +1

I set the boot order in BIOS to be : /dev/sdc-/dev/sdb-/dev/sda

I can boot into menu item 1(the default) SuSE 11.4 no problem.

If I select menu item 3 - title WindowsXP, I get an Error13: Invalid or unsupported executable format message, I think from Grub. Grub restarts, offers the menu again.
Same if I select menu item 4 - *title Microsoft Windows XP Professional - added by updategrub
*
If I restart the system and set the BIOS boot order to be /dev/sdb-/dev/sdc-/dev/sda, Windows boots normally, but of course I have no option to boot Linux.

I am doing(trying) it this way because I want /dev/sdb to stay windows only, as I will ultimately move it to another WinXP only machine.

I had hoped updategrub would resolve this, but not so far.

Looking forward to hearing from you again, PTA :wink:

I did not try to analize your exact situation, but you seem to forget about the device.map file which should match what you are doing in your BIOS. In particular for your boot drive. Run the following command from your SUSE boot drive if you can and post the results here:

sudo cat /boot/grub/device.map

Based on this, your BIOS boot drive must be designated as HD0 in your device.map file. The Windows drive should be HD1 in your device.map file. When Windows is setup on a second hard drive, the map and makactive stuff is not needed really and can be removed. You should use only one Windows XP entry since more than one just confuses the problem and I don’t use update grub. Show us your device.map file and stop playing with your BIOS setup boot order, or more precisely, the two need to match.

Thank You,

Thanks for input, James.
Here is the map:

cat /boot/grub/device.map
(hd0)   /dev/disk/by-id/ata-WDC_WD1500AHFD-00RAR4_WD-WMAP41624125
(hd2)   /dev/disk/by-id/ata-ST31000520AS_9VX0ZYHW
(hd1)   /dev/disk/by-id/ata-Hitachi_HDT725032VLA360_VFM201R8081X8N

The hd0 drive is /dev/sdc, Linux boot, swap and root
The hd1 is the WinXP drive, which under Linux is /dev/sdb
The hd2 is the Linux /home drive, /dev/sda under Linux

I believe this matches what you said it should be.

Are you suggesting then that the windows menu item should be


###Don't change this comment - YaST2 identifier: Original name: windows### 
title WindowsXP 
    rootnoverify (hd1,0)
     chainloader +1 

I only play with the bios boot order to get back to Windows.
I have 3 days and a thousand reboots invested in that hdd - from an ancient WinXP CD !
Took that long to get it caught up to SP3.
I wanted to know it was still there!

Hi. Here am I.
So, your problem is booting Windows which is not on the first BIOS drive. The entry added by updategrub (in red) is similar to the one added by Yast (in blue), except that Yast made the Windows partition active - which wouldn’t be a good idea in most circumstances but is irrelevant here - and so is irrelevant, as you suspected, the fact that sda has the bootflag set.

###Don't change this comment - YaST2 identifier: Original name: windows###
title WindowsXP
    map (hd1) (hd0)
    map (hd0) (hd1)
    rootnoverify (hd1,0)
 **   makeactive**
    chainloader +1
###Don't change this comment - Added by updategrub Fri Sep 16 19:13:22 EDT 2011###

###Don't change this comment - YaST2 identifier: Original name: windows###
title Microsoft Windows XP Professional - added by updategrub
    map (hd1) (hd0)
    map (hd0) (hd1)
    rootnoverify (hd1,0)
    chainloader +1

You can safely delete everything that was added by updategrub. It won’t help you booting Windows here. Having a consistent device.map won’t hurt for sure. updategrub would abort with an error message if device.map contains errors (such as if it refers to a missing HD), but it will work (more or less reliably) if device.map doesn’t exist at all or is missing entries (notice the difference between missing entries and including entries for missing devices!).

I don’t know why you’re not able to boot Windows. findgrub might tell us more. I should be there it if you installed updategrub from my repo.

I would first try to change

  rootnoverify (hd1,0)

in

 rootnoverify (hd0,0)

right after the two map commands.

If it doesn’t help, I would run findgrub without options to see if it detects the Windows bootloader.
Look at your device mapping with findgrub -M
Use **findgrub -d **to find out if the Windows bootsector is encrypted.

I would try either this:


title WindowsXP 
   rootnoverify (hd1,0)
   chainloader +1 

or that:


title WindowsXP 
   map (hd1) (hd0)
   map (hd0) (hd1)
   rootnoverify (hd0,0)
   chainloader +1 

So, what you say does not make sense since it should work. So, what kind of hard drives are these? If IDE, which drive is Master and which is slave? Most often, I would make the Windows drive Master on one IDE channel and Linux Master on the other. Some oddities can occur if one is IDE while the other is SATA. If a Windows drive can be booted when selected as the boot drive, it should work when setup as secondary and the Grub Boot loader loads it through chainloader and the device.map matches the boot setup. Yours, when sda is boot, seems to match to me. So, it it does not work, there is some sort of hardware issue keeping it from working. That can be an issue with IDE Master Slave, it can be due to a mix of IDE and SATA and it can even be an issue with grub for some reason not liking your BIOS. A BIOS update can even fix some issues. However, off hand I am not seeing a problem here. I looked up error13 and got a little more info:

13 : Invalid or unsupported executable format
This error is returned if the kernel image being loaded is not recognized as Multiboot or one of the supported native formats (Linux zImage or bzImage, FreeBSD, or NetBSD).
Thank You,

These are all SATA drives.

I removed the boot enable on /dev/sda just to get it out of the way.

Here is the result of findgrub

findgrub
Find Grub Version 3.4.2 - Written for openSUSE Forums

 - reading MBR on disk /dev/sda                       ...
 - reading bootsector  /dev/sda1      (LINUX)         ...

 - reading MBR on disk /dev/sdb                       ...
 - searching partition /dev/sdb1   *  (NTFS)          ... --> Windows NT/2K/XP Loader found in /dev/sdb1

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can add the following entry to /boot/grub/menu.lst :

###Don't change this comment - YaST2 identifier: Original name: WindowsBootLoader###
title Windows on /dev/sdb1
    rootnoverify (hd1,0)
    map (hd1) (hd0)
    map (hd0) (hd1)
    chainloader +1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


 - reading MBR on disk /dev/sdc                       ... --> Grub  found in sdc MBR     => sdc1   0x83 (openSUSE)
 - reading bootsector  /dev/sdc1   *  (LINUX)         ...
 - skipping partition  /dev/sdc2      (swap)         
 - reading bootsector  /dev/sdc3      (LINUX)         ...

And here is findgrub -M

findgrub -M
Find Grub Version 3.4.2 - Written for openSUSE Forums

--- DEVICE.MAP: sda is PCI drive hd0
--- DEVICE.MAP: looking for /dev/sda in /boot/grub/device.map:
--- DEVICE.MAP: - /dev/sda
--- DEVICE.MAP: - /dev/disk/by-id/ata-ST31000520AS_9VX0ZYHW -> hd2
--- DEVICE.MAP: - /dev/disk/by-id/scsi-SATA_ST31000520AS_9VX0ZYHW
--- DEVICE.MAP: - /dev/disk/by-id/wwn-0x5000c50027646d10
--- DEVICE.MAP: - /dev/disk/by-path/pci-0000:00:0d.0-scsi-0:0:0:0
--- DEVICE.MAP: => sda - found in device.map - is now hd2
--- DEVICE.MAP:
--- DEVICE.MAP: sdb is PCI drive hd1
--- DEVICE.MAP: looking for /dev/sdb in /boot/grub/device.map:
--- DEVICE.MAP: - /dev/sdb
--- DEVICE.MAP: - /dev/disk/by-id/ata-Hitachi_HDT725032VLA360_VFM201R8081X8N -> hd1
--- DEVICE.MAP: - /dev/disk/by-id/scsi-SATA_Hitachi_HDT7250_VFM201R8081X8N
--- DEVICE.MAP: - /dev/disk/by-id/wwn-0x5000cca317c3aa25
--- DEVICE.MAP: - /dev/disk/by-path/pci-0000:00:0d.0-scsi-1:0:0:0
--- DEVICE.MAP: => sdb - found in device.map - is now hd1
--- DEVICE.MAP:
--- DEVICE.MAP: sdc is PCI drive hd2
--- DEVICE.MAP: looking for /dev/sdc in /boot/grub/device.map:
--- DEVICE.MAP: - /dev/sdc
--- DEVICE.MAP: - /dev/disk/by-id/ata-WDC_WD1500AHFD-00RAR4_WD-WMAP41624125 -> hd0
--- DEVICE.MAP: - /dev/disk/by-id/scsi-SATA_WDC_WD1500AHFD-_WD-WMAP41624125
--- DEVICE.MAP: - /dev/disk/by-id/wwn-0x50014ee0aac875da
--- DEVICE.MAP: - /dev/disk/by-path/pci-0000:00:0d.1-scsi-0:0:0:0
--- DEVICE.MAP: => sdc - found in device.map - is now hd0
--- DEVICE.MAP:
********************************************************************************




Note the highlighted lines.
I am not real sure how to interpret the hd0 and hd2 changes.

By the way, neither of the suggested menu changes worked.

What about this:

title Windows on /dev/sdb1
    rootnoverify (hd1,0)
    map (hd1) (hd2)
    map (hd2) (hd1)
    chainloader +1

or that:

title Windows on /dev/sdb1
    rootnoverify (hd1,0)
    map (hd0) (hd2)
    map (hd2) (hd0)
    map (hd0) (hd1)
    map (hd1) (hd0)
    chainloader +1

Did Windows ever boot? with which setup?
As you booted the entries I suggested before, did you get a different error message?

Does sdb1 bootsector (as shown by findgrub -d) looks more or less like this one (which is not encrypted)?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/dev/sdb1 Bootsector
--------------------------------------------------------------------------------
MSWIN40jGOSDOSFAT16   3 8NrffWuVs3FfFVFvFV 
                                           HFNar98t
                                                   at2Nt	 rt
                                                                   HtURrV
2FVJRPSjjF3Bv                                                            FFNN fFfFffJJF
uBVaar
      uB
        IuAfjNTLDR      
**NTLDR is missing
Disk error
Press any key to restart**
U
--------------------------------------------------------------------------------

The highlighted lines are fine. They mean that hd0 is the first PCI drive and becomes hd2 according to device.map.
But the key of the problem probably resides between how the hard drives are plugged into SATA ports, the order you set in BIOS setup and the content of device.map.

If it’s still not fixed, here’s something else you can do:

  • Make sure you don’t use device names in /etc/fstab (you shouldn’t normally)
  • Comment out the line mouting /home in /etc/fstab
  • You can leave (hd2) in device.map as long as you don’t use updategrub, reinstall Grub or update the kernel. But it wouldn’t hurt to remove it either. Of course make a copy of device.map:
su -c 'cp /boot/grub/device.map{,.bk}'
  • Now shut down, power off, open the case and unplug the hd with your /home. You can boot Linux without /home if you don’t log in as user. And you won’t log in as user until the problem is fixed.
  • You now have 2 hds, one with Linux and one with Windows, one has to be connected to the first SATA port and the other to the second SATA port. Don’t use the other SATA ports!. Obviously the Linux one has to be the first one in BIOS.
  • Wait for James to get up and explain you exactly how to proceed. It’s a while ago that I translated his method in german (and probably in french) and I don’t install Windows on physical computers.
  • You can boot Linux in runlevel 3 in the meantime, login as root and edit files with nano if needed (I guess I should not mention using vi). Some people would even boot from liveCD just to have a GUI editor.
  • Once you get it working with 2 HDs, uncomment the line mounting /home, restore your original device.map, shut down, power off, connect you third hd to SATA3 (there is no point for this drive to be the first one). At next boot, your Linux root partition should be on sda and /home should be on sdc. Althouh it doesn’t matter, it’s more elegant (somehow).
  • With you 3rd. HD being the 1st one and your Windows hd in the middle, you’re adding an unnecessary level of complexity, which I would try to exclude first to get things working.

Thanks for all the late night input, folks.
I’ll answer some of your questions (that have answers) assuming it adds to the knowledge base.
((I am just figuring out how to use the Quote feature, which does make this more readible. ))

I would try either this:

title WindowsXP
     rootnoverify (hd1,0)
    chainloader +1 

or that:

title WindowsXP
     map (hd1) (hd0)
    map (hd0) (hd1)
    rootnoverify (hd0,0)
    chainloader +1 

Both of these attempts yielded the same Error13 message from Grub

Does sdb1 bootsector (as shown by findgrub -d) looks more or less like this one (which is not encrypted)?

My bootsector looks like your example

findgrub -d
Find Grub Version 3.4.2 - Written for openSUSE Forums

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 - reading MBR on disk /dev/sdb                       ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/dev/sdb1 Bootsector
--------------------------------------------------------------------------------
RNTFS    B
hjsffAfff AUrUu tffff fjfPSfh
                             aBfXfXfXf3ffff6
 fofa   t
A disk read error occurred
NTLDR is missing
NTLDR is compressed
Press CtrlAltDel to restart
U
--------------------------------------------------------------------------------


Did Windows ever boot? with which setup?

From Grub?, no, not yet.
I CAN change the BIOS boot order and start WinXP directly.

You can boot Linux in runlevel 3 in the meantime, login as root and edit files with nano if needed (I guess I should not mention using vi). Some people would even boot from liveCD just to have a GUI editor.

I’m OK at runlevel3. I was one of 15,000 Linux ver 0.1 testers, a.k.a. all of Bell Labs in the 1970s. I was a two fingered hardware guy, so** vi** was native. EMACS was for the 12 fingered software types. Amazing what you remember after 40 years. But sed, not so much.

Next steps:
I did not try PTA’s additional menu/map items yet, will if you want the results.
Otherwise, my plan of attack was to rearrange the hdds to satisfy WinXP.
Grub and Linux, using disk ID’s, seems fairly robust.

My thinking is:
SATA1 WinXP drive
SATA2 Linux /boot+swap+/ drive
SATA3 Linux /home drive

Bios boot order: SATA2 - SATA1 - SATA3
Boot to Linux, then reinstall a new Grub to get a new map and menu.

Other thoughts/recommendations?

FYI, Motherboard and BIOS might be part of the confusion here. It is an ASUS m2n32sli, a relatively early SATA MB with 7SATA ports, one eSATA(two SATA controllers) plus IDE. Bios is up to date, but a long time ago.

My thinking is:
SATA1 WinXP drive
SATA2 Linux /boot+swap+/ drive
SATA3 Linux /home drive

Bios boot order: SATA2 - SATA1 - SATA3
Boot to Linux, then reinstall a new Grub to get a new map and menu.

Other thoughts/recommendations?

FYI, Motherboard and BIOS might be part of the confusion here. It is an ASUS m2n32sli, a relatively early SATA MB with 7SATA ports, one eSATA(two SATA controllers) plus IDE. Bios is up to date, but a long time ago.

Well I am back up and its Saturday morning with lots of online time today. Just got to get the wife breakfast and go to the grocery store today. And, there is even a chance of rain today (It is rather parched here in Austin)! I like your proposed new setup. So, you need to get your bios, device.map & menu.lst to all agree on who is hd0, hd1 and hd2. The boot drive is most important and is hd0 while hd1 & hd2 just need to match between device.map & menu.lst though I tend to follow the hardware order for the rest. Still don’t understand what the problem is but when software is setup properly but does not work, the issue is hardware and often hardware problems simply don’t make sense. My solution is to dump suspected bad hardware at the first opportunity. It is always great to have an excuse to buy some new computer part if I can afford it.

Thank You,

OK, here we are again, new configuration, issue, but different one (I think)

I made the following physical swap:
SATA1 WinXP drive
SATA2 Linux /boot+swap+/ drive
SATA3 Linux /home drive

Bios boot order: SATA2 - SATA1 - SATA3

Booted to Linux, opened Yast-Bootloader and installed new Grub on the /dev/sdb disk.
Rebooted (to verify new Grub).

These results:

findgrub -d
Find Grub Version 3.4.2 - Written for openSUSE Forums

 - reading MBR on disk /dev/sda                       ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/dev/sda1 Bootsector
--------------------------------------------------------------------------------
RNTFS    B
hjsffAfff AUrUu tffff fjfPSfh
                             aBfXfXfXf3ffff6
 fofa   t
A disk read error occurred
NTLDR is missing
NTLDR is compressed
Press CtrlAltDel to restart
U
--------------------------------------------------------------------------------
0000000 52eb 4e90 4654 2053 2020 0020 0802 0000
0000020 0000 0000 f800 0000 003f 00f0 003f 0000
0000040 0000 0000 0080 0080 97c0 2542 0000 0000
0000060 0000 000c 0000 0000 297c 0254 0000 0000
0000100 00f6 0000 0001 0000 94c0 8cde dec9 648c
0000120 0000 0000 33fa 8ec0 bcd0 7c00 b8fb 07c0
0000140 d88e 16e8 b800 0d00 c08e db33 06c6 000e
0000160 e810 0053 0068 680d 026a 8acb 2416 b400
0000200 cd08 7313 b905 ffff f18a 0f66 c6b6 6640
0000220 b60f 80d1 3fe2 e2f7 cd86 edc0 4106 0f66
0000240 c9b7 f766 66e1 20a3 c300 41b4 aabb 8a55
0000260 2416 cd00 7213 810f 55fb 75aa f609 01c1
0000300 0474 06fe 0014 66c3 1e60 6606 10a1 6600
0000320 0603 001c 3b66 2006 0f00 3a82 1e00 6a66
0000340 6600 0650 6653 1068 0100 8000 143e 0000
0000360 850f 000c b3e8 80ff 143e 0000 840f 0061
0000400 42b4 168a 0024 1f16 f48b 13cd 5866 075b
0000420 5866 5866 eb1f 662d d233 0f66 0eb7 0018
0000440 f766 fef1 8ac2 66ca d08b c166 10ea 36f7
0000460 001a d686 168a 0024 e88a e4c0 0a06 b8cc
0000500 0201 13cd 820f 0019 c08c 2005 8e00 66c0
0000520 06ff 0010 0eff 000e 850f ff6f 1f07 6166
0000540 a0c3 01f8 09e8 a000 01fb 03e8 fb00 feeb
0000560 01b4 f08b 3cac 7400 b409 bb0e 0007 10cd
0000600 f2eb 0dc3 410a 6420 7369 206b 6572 6461
0000620 6520 7272 726f 6f20 6363 7275 6572 0064
0000640 0a0d 544e 444c 2052 7369 6d20 7369 6973
0000660 676e 0d00 4e0a 4c54 5244 6920 2073 6f63
0000700 706d 6572 7373 6465 0d00 500a 6572 7373
0000720 4320 7274 2b6c 6c41 2b74 6544 206c 6f74
0000740 7220 7365 6174 7472 0a0d 0000 0000 0000
0000760 0000 0000 0000 0000 a083 c9b3 0000 aa55
0001000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/dev/sda Partition table
--------------------------------------------------------------------------------
0000000 0180 0001 ef07 ffff 003f 0000 97c1 2542
0000020 0000 0000 0000 0000 0000 0000 0000 0000
*
0000100
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 - reading MBR on disk /dev/sdb                       ... --> Grub  found in sdb MBR     => sdb1   0x83 (openSUSE)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/dev/sdb Partition table
--------------------------------------------------------------------------------
0000000 2080 0021 0083 0d33 0800 0000 2800 0003
0000020 0000 0d34 fe82 ffff 3000 0003 e800 00ff
0000040 fe00 ffff fe83 ffff 1800 0103 7000 1074
0000060 0000 0000 0000 0000 0000 0000 0000 0000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 - reading MBR on disk /dev/sdc                       ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/dev/sdc Partition table
--------------------------------------------------------------------------------
0000000 2000 0021 fe83 ffff 0800 0000 6000 7470
0000020 0000 0000 0000 0000 0000 0000 0000 0000
*
0000100
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


This menu looked sort of normal to me

cat /boot/grub/menu.lst
# Modified by YaST2. Last modification on Sat Sep 17 10:12:04 EDT 2011
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# Configure custom boot parameters for updated kernels in /etc/sysconfig/bootloader

default 0
timeout 8
gfxmenu (hd0,0)/message
##YaST - activate

###Don't change this comment - YaST2 identifier: Original name: linux###
title Desktop -- openSUSE 11.4 - 2.6.37.6-0.7
    root (hd0,0)
    kernel /vmlinuz-2.6.37.6-0.7-desktop root=/dev/disk/by-id/ata-WDC_WD1500AHFD-00RAR4_WD-WMAP41624125-part3 resume=/dev/disk/by-id/ata-WDC_WD1500AHFD-00RAR4_WD-WMAP41624125-part2 splash=silent quiet showopts vga=0x346
    initrd /initrd-2.6.37.6-0.7-desktop

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.4 - 2.6.37.6-0.7
    root (hd0,0)
    kernel /vmlinuz-2.6.37.6-0.7-desktop root=/dev/disk/by-id/ata-WDC_WD1500AHFD-00RAR4_WD-WMAP41624125-part3 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x346
    initrd /initrd-2.6.37.6-0.7-desktop

###Don't change this comment - YaST2 identifier: Original name: windows###
title WindowsXP
    rootnoverify (hd1,0)
    chainloader +1


The mapping makes sense, I think

cat /boot/grub/device.map
(hd0)   /dev/disk/by-id/ata-WDC_WD1500AHFD-00RAR4_WD-WMAP41624125
(hd2)   /dev/disk/by-id/ata-ST31000520AS_9VX0ZYHW
(hd1)   /dev/disk/by-id/ata-Hitachi_HDT725032VLA360_VFM201R8081X8N


findgrub -M
Find Grub Version 3.4.2 - Written for openSUSE Forums

--- DEVICE.MAP: sda is PCI drive hd0
--- DEVICE.MAP: looking for /dev/sda in /boot/grub/device.map:
--- DEVICE.MAP: - /dev/sda
--- DEVICE.MAP: - /dev/disk/by-id/ata-Hitachi_HDT725032VLA360_VFM201R8081X8N -> hd1
--- DEVICE.MAP: - /dev/disk/by-id/scsi-SATA_Hitachi_HDT7250_VFM201R8081X8N
--- DEVICE.MAP: - /dev/disk/by-id/wwn-0x5000cca317c3aa25
--- DEVICE.MAP: - /dev/disk/by-path/pci-0000:00:0d.0-scsi-0:0:0:0
--- DEVICE.MAP: => sda - found in device.map - is now hd1
--- DEVICE.MAP:
--- DEVICE.MAP: sdb is PCI drive hd1
--- DEVICE.MAP: looking for /dev/sdb in /boot/grub/device.map:
--- DEVICE.MAP: - /dev/sdb
--- DEVICE.MAP: - /dev/disk/by-id/ata-WDC_WD1500AHFD-00RAR4_WD-WMAP41624125 -> hd0
--- DEVICE.MAP: - /dev/disk/by-id/scsi-SATA_WDC_WD1500AHFD-_WD-WMAP41624125
--- DEVICE.MAP: - /dev/disk/by-id/wwn-0x50014ee0aac875da
--- DEVICE.MAP: - /dev/disk/by-path/pci-0000:00:0d.0-scsi-1:0:0:0
--- DEVICE.MAP: => sdb - found in device.map - is now hd0
--- DEVICE.MAP:
--- DEVICE.MAP: sdc is PCI drive hd2
--- DEVICE.MAP: looking for /dev/sdc in /boot/grub/device.map:
--- DEVICE.MAP: - /dev/sdc
--- DEVICE.MAP: - /dev/disk/by-id/ata-ST31000520AS_9VX0ZYHW -> hd2
--- DEVICE.MAP: - /dev/disk/by-id/scsi-SATA_ST31000520AS_9VX0ZYHW
--- DEVICE.MAP: - /dev/disk/by-id/wwn-0x5000c50027646d10
--- DEVICE.MAP: - /dev/disk/by-path/pci-0000:00:0d.1-scsi-0:0:0:0
--- DEVICE.MAP: => sdc - found in device.map - is now hd2
--- DEVICE.MAP:
********************************************************************************


I was surprised to see the following proposed addition to the menu

updategrub -l
Scanning...
Following boot entries could be added to Grub menu:

###Don't change this comment - YaST2 identifier: Original name: windows###
title Microsoft Windows XP Professional - added by updategrub
    map (hd1) (hd0)
    map (hd0) (hd1)
    rootnoverify (hd1,0)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: GrubOnsdb###
title Legacy Grub in sdb MBR
    rootnoverify (hd0)
    chainloader +1
sed: -e expression #1, char 0: no previous regular expression


I have not added these new menu items yet.

Next, I rebooted and at Grub screen selected the WinXP menu item
get a new screen with

 rootnoverify (hd1,0)
    chainloader +1


But then nothing - just a blinking cursor until three finger salute…

On system reboot, I changed the Bios boot order to:
SATA1-SATA2-SATA3

Windows boots OK under this setup.

I am going to try the updategrub suggested adders.
Any other thoughts?

OK, an update AND… Success!!

The highlighted menu works (added by updategrub)

cat /boot/grub/menu.lst
# Modified by YaST2. Last modification on Sat Sep 17 10:12:04 EDT 2011
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# Configure custom boot parameters for updated kernels in /etc/sysconfig/bootloader

default 0
timeout 8
gfxmenu (hd0,0)/message
##YaST - activate

###Don't change this comment - YaST2 identifier: Original name: linux###
title Desktop -- openSUSE 11.4 - 2.6.37.6-0.7
    root (hd0,0)
    kernel /vmlinuz-2.6.37.6-0.7-desktop root=/dev/disk/by-id/ata-WDC_WD1500AHFD-00RAR4_WD-WMAP41624125-part3 resume=/dev/disk/by-id/ata-WDC_WD1500AHFD-00RAR4_WD-WMAP41624125-part2 splash=silent quiet showopts vga=0x346
    initrd /initrd-2.6.37.6-0.7-desktop

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.4 - 2.6.37.6-0.7
    root (hd0,0)
    kernel /vmlinuz-2.6.37.6-0.7-desktop root=/dev/disk/by-id/ata-WDC_WD1500AHFD-00RAR4_WD-WMAP41624125-part3 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x346
    initrd /initrd-2.6.37.6-0.7-desktop

###Don't change this comment - YaST2 identifier: Original name: windows###
title WindowsXP
    rootnoverify (hd1,0)
    chainloader +1
###Don't change this comment - Added by updategrub Sat Sep 17 11:55:59 EDT 2011###

###Don't change this comment - YaST2 identifier: Original name: windows###
title Microsoft Windows XP Professional - added by updategrub
    map (hd1) (hd0)
    map (hd0) (hd1)
    rootnoverify (hd1,0)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: GrubOnsdb###
title Legacy Grub in sdb MBR
    rootnoverify (hd0)
    chainloader +1


I’ll standby for the expert explanation.

PTA will be happy to see that updategrub found the right solution :slight_smile:

This looks like what you had in the beginning except you dropped makeactive:

###Don't change this comment - YaST2 identifier: Original name: windows### 
title Microsoft Windows XP Professional - added by updategrub     
map (hd1) (hd0)     
map (hd0) (hd1)     
rootnoverify (hd1,0)     
chainloader +1

Since the partition is already active, it is hard to say what that would do. I did use the map commands with Windows XP at first, but on new BIOS’ it did not seem to matter. One can only say that with your PC, you need the MAP commands and makeactive creates a problem for some reason. Anyway, good to hear of your success.

Thank You,

Well … bummer somehow. You could have told me what caused that:

updategrub -l
Scanning...
Following boot entries could be added to Grub menu:

###Don't change this comment - YaST2 identifier: Original name: windows###
title Microsoft Windows XP Professional - added by updategrub
    map (hd1) (hd0)
    map (hd0) (hd1)
    rootnoverify (hd1,0)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: GrubOnsdb###
title Legacy Grub in sdb MBR
    rootnoverify (hd0)
    chainloader +1
sed: -e expression #1, char 0: no previous regular expression

And it’s in updatgebrub, not in findgrub … Even worse! :frowning:
I wish you could give me a clue how I could possibly reproduce this error and fix it.

Do updategrub -i and grubmenu work OK?

It’s still the same entry (as the one written by YaST and by updategrub the first time), except that now, your 3rd.hd is really the 3rd. one (connected to SATA3 and in BIOS order), so it doesn’t interfere with the map commands between hd0 and hd1. My guess it that the mapping didn’t work as expected with the previous setup because of this double mapping (first in the BIOS, then it Grub menu) - probably involving the 3rd. drive at some point, and you ended up chainloading the wrong drive. I don’t think makeactive was a problem, but since it was not needed, it could not help either. I don’t know why YaST added it - but YaST don’t think too far when it gets about bootflags.

Yes, I ran both and used them to remove the now unneeded menu items.
No errors on console.

cat /boot/grub/menu.lst
# Modified by YaST2. Last modification on Sat Sep 17 10:12:04 EDT 2011
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# Configure custom boot parameters for updated kernels in /etc/sysconfig/bootloader

default 0
timeout 8
gfxmenu (hd0,0)/message
##YaST - activate

###Don't change this comment - YaST2 identifier: Original name: linux###
title Desktop -- openSUSE 11.4 - 2.6.37.6-0.7
    root (hd0,0)
    kernel /vmlinuz-2.6.37.6-0.7-desktop root=/dev/disk/by-id/ata-WDC_WD1500AHFD-00RAR4_WD-WMAP41624125-part3 resume=/dev/disk/by-id/ata-WDC_WD1500AHFD-00RAR4_WD-WMAP41624125-part2 splash=silent quiet showopts vga=0x346
    initrd /initrd-2.6.37.6-0.7-desktop

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.4 - 2.6.37.6-0.7
    root (hd0,0)
    kernel /vmlinuz-2.6.37.6-0.7-desktop root=/dev/disk/by-id/ata-WDC_WD1500AHFD-00RAR4_WD-WMAP41624125-part3 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x346
    initrd /initrd-2.6.37.6-0.7-desktop

###Don't change this comment - YaST2 identifier: Original name: windows###
#title WindowsXP
#    rootnoverify (hd1,0)
#    chainloader +1
###Don't change this comment - Added by updategrub Sat Sep 17 15:22:42 EDT 2011###

###Don't change this comment - YaST2 identifier: Original name: windows###
title Microsoft Windows XP Professional - added by updategrub
    map (hd1) (hd0)
    map (hd0) (hd1)
    rootnoverify (hd1,0)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: GrubOnsdb###
#title Legacy Grub in sdb MBR
#    rootnoverify (hd0)
#    chainloader +1

James and PTA, thanks for your insight.

I probably should just go play with my windoze, but what fun is that?

I am not sure I understand why this now works, but I don’t understand Grub script either.

Here is my first attempt at using a table
It summarizes the two bootable drives.

SATA PCI Grub(after map) /sdx content
1 hd0 hd1 /sda WinNT
2 hd1 hd0 /sdb Linux /boot,swap,/

Here again is the Grub map:

findgrub -M
Find Grub Version 3.4.2 - Written for openSUSE Forums

--- DEVICE.MAP: sda is PCI drive hd0
--- DEVICE.MAP: looking for /dev/sda in /boot/grub/device.map:
--- DEVICE.MAP: - /dev/sda
--- DEVICE.MAP: - /dev/disk/by-id/ata-Hitachi_HDT725032VLA360_VFM201R8081X8N -> hd1
--- DEVICE.MAP: - /dev/disk/by-id/scsi-SATA_Hitachi_HDT7250_VFM201R8081X8N
--- DEVICE.MAP: - /dev/disk/by-id/wwn-0x5000cca317c3aa25
--- DEVICE.MAP: - /dev/disk/by-path/pci-0000:00:0d.0-scsi-0:0:0:0
--- DEVICE.MAP: => sda - found in device.map - is now hd1
--- DEVICE.MAP:
--- DEVICE.MAP: sdb is PCI drive hd1
--- DEVICE.MAP: looking for /dev/sdb in /boot/grub/device.map:
--- DEVICE.MAP: - /dev/sdb
--- DEVICE.MAP: - /dev/disk/by-id/ata-WDC_WD1500AHFD-00RAR4_WD-WMAP41624125 -> hd0
--- DEVICE.MAP: - /dev/disk/by-id/scsi-SATA_WDC_WD1500AHFD-_WD-WMAP41624125
--- DEVICE.MAP: - /dev/disk/by-id/wwn-0x50014ee0aac875da
--- DEVICE.MAP: - /dev/disk/by-path/pci-0000:00:0d.0-scsi-1:0:0:0
--- DEVICE.MAP: => sdb - found in device.map - is now hd0
--- DEVICE.MAP:

 cat /boot/grub/device.map
(hd0)   /dev/disk/by-id/ata-WDC_WD1500AHFD-00RAR4_WD-WMAP41624125
(hd2)   /dev/disk/by-id/ata-ST31000520AS_9VX0ZYHW
(hd1)   /dev/disk/by-id/ata-Hitachi_HDT725032VLA360_VFM201R8081X8N



I read this Grub menu item

###Don't change this comment - YaST2 identifier: Original name: windows###
#title WindowsXP
     rootnoverify (hd1,0)
     chainloader +1


To say: Call hd1 (windows) root, don’t verify, chainload it
Or, is rootnoverify hd1 the PCI hd1, not the Grub hd1?

Likewise, my logic says

###Don't change this comment - YaST2 identifier: Original name: windows###
title Microsoft Windows XP Professional - added by updategrub
    map (hd1) (hd0)
    map (hd0) (hd1)
    rootnoverify (hd1,0)
    chainloader +1


would undo the mapping done in the Grub map and boot Linux.

So perhaps the key question is, are Grub commands relative to PCI domain or Grub-map domain?
If they are PCI domain (which my logic seems to say they are), of what use is the Grub-map?

I get (or guess) the first sdX to hdN mapping from these two commands in the script:

# map BIOS drive to Linux devices
eval $(find /dev/disk/ -mindepth 2 ! -name "*usb*" -ls | awk '/[a-z]$/ { gsub(/\.\.\//, "", $13) ; print $13, $11}' | sort | \
awk '{ if ( $1 == DEV ) printf " %s", $2 ; else {DEV=$1 ; printf "
%s_dsk=\"%s", $1, $2 }}' | sed '/^$/d;s|$|";|')
eval $(find /dev/disk/by-path -mindepth 1 ! -name "*usb*" ! -name "*part*" -ls  |\
awk '/[a-z]$/ { sub(/.*\./, "", $11) ; sub(/-scsi-/, " ", $11) ; gsub(/\.\.\//, "", $13) ;

It is not 100% reliable. But I had to start somewhere. You can see more about the method I applied in this post in the findgrub thread: Looking for Grub and Windows bootloader in all partitions. - Page 12

I excluded USB devices because they were impossible to handle. If you have only one SATA controller, the numbering of the drives will be consistent. If you have one SATA and one IDE, it might still guess the right order. If you have more than one SATA controller (as in James’ s example in the thread) it won’t probably work. So it’s impossible IMHO to find a logic that would be true for any motherboard. This is why the system uses a device.map. But I couldn’t assume that anyone has a device.map. It might be present or not, depending how you (in most cases the distro’s setup) installed Grub the first time.

Then the script reads the device symlinks and finally the device.map. If the device.map contains errors, findgrub will issue a warning (and updategrub will just abort).