Help: I borked my WindowsXP boot when installing OpenSUSE 11.3

Hello all - some boot loader help would be much appreciated.

I have an existing WinXP install on the main drive (/dev/sda) of a Dell laptop. I installed Suse on the second (caddy tray) drive and didn’t touch the existing windows partition during install.

After install completed, I found there was no boot loader entry for WinXP during startup. Only SUSE-related stuff. I opened YaST boot loader and tried creating an entry of type “other” and device of “/dev/sda1” and set this as the default entry.

The /boot/grub/menu.lst file now has an entry:

title Windows XP-32
rootnoverify(hd0,0)
chainloader (hd0,0)+1

When I restart the machine I get an error message:

rootnoverify (hd0,0)
chainloader (hd0,0)+1
Error 13: Invalid or unsupported executable format

What am I missing?

Oops - even more fun on tap. I was able to boot into OpenSUSE before, but now I seem to have done something during my last menu.lst edit and there are no OpenSUSE entries during bootup anymore. :frowning:

I do have an OpenSUSE LiveCD (installable) in the form of a USB key that I can boot from in order to perform repairs, but some pointers would be greatly appreciated.

FWIW I have my OpenSUSE boot entries back up and running. But Windows still not booting.

Ok If you have Linux running, open a console window (Command Line)
become root by
su -
enter the root password (note this does no echo anything to the screen so don’t freak)
type
fdisk -l (note that is a lower case L not a one)

post out put here (note use the menu in the console menu for copy and paste functions)

Also
cat /boot/grub/menu.lst

fdisk -l

Disk /dev/sdb: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e85f9

Device Boot Start End Blocks Id System
/dev/sdb1 1 262 2103296 82 Linux swap / Solaris
Partition 1 does not end on cylinder boundary.
/dev/sdb2 262 2873 20972544 83 Linux
/dev/sdb3 2873 14594 94143488 83 Linux

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x83c583c5

Device Boot Start End Blocks Id System
/dev/sda1 1 19458 156288000 7 HPFS/NTFS
/dev/sda4 * 1 1 0 0 Empty
Partition 4 does not end on cylinder boundary.

cat /boot/grub/menu.lst

Modified by YaST2. Last modification on Tue Sep 28 18:40:08 EDT 2010

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 (hd1,1)/boot/message

###Don’t change this comment - YaST2 identifier: Original name: linux###
title openSUSE 11.3
root (hd1,1)
kernel /boot/vmlinuz-2.6.34-12-desktop root=/dev/disk/by-id/ata-TOSHIBA_MK1229GSGF_4057WOOWW-part2 resume=/dev/disk/by-id/ata-TOSHIBA_MK1229GSGF_4057WOOWW-part1 splash=silent quiet showopts vga=0x317
initrd /boot/initrd-2.6.34-12-desktop

###Don’t change this comment - YaST2 identifier: Original name: Linux other###
title Linux other
rootnoverify (hd2,0)
chainloader +1

###Don’t change this comment - YaST2 identifier: Original name: floppy###
title Floppy
rootnoverify (fd0)
chainloader +1

###Don’t change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe – openSUSE 11.3
root (hd1,1)
kernel /boot/vmlinuz-2.6.34-12-desktop root=/dev/disk/by-id/ata-TOSHIBA_MK1229GSGF_4057WOOWW-part2 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x317
initrd /boot/initrd-2.6.34-12-desktop

###Don’t change this comment - YaST2 identifier: Original name: other###
title Windows XP
rootnoverify (hd0,0)
chainloader +1

Found this on ubuntu forums. Try changing Windows XP entry to this:


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

Source: Grub Error 13: “Invalid or unsupported executable format” - Ubuntu Forums post # 2

root (hd1,0)

Not really sure this will work since hd1 (sdb) is the harddrive with OpenSUSE on it. hd0 (sda) is the hard drive with WinXP.

One more detail would be what is shown in the /etc/device.map file. Further, if I installed openSUSE on /dev/sdb, where did the grub boot loader get installed? If Grub is installed in the MBR of /sda, this could work, but if grub is installed anywhere on /dev/sdb, the BIOS must be changed to select /dev/sdb as the boot drive. If /dev/sdb was the boot drive and contained grub, somewhere, then the following menu.lst command could be correct:

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

The device map would have to show the /dev/sdb was (HD0) and /dev/sda was (HD1) for this to work. If this was me, I would pull the second drive and see if Windows will boot. If not, you need to find a Windows boot disk and fix the MBR and perhaps select the Windows partition as bootable and then try again, asking for the correct instructions on how to install openSUSE on a second hard drive without messing with the Windows boot drive. Something that can be done. These are just my opinions though.

Thank You,

device.map

(hd1) /dev/disk/by-id/ata-TOSHIBA_MK1229GSGF_4057WOOWW
(fd0) /dev/fd0
(hd0) /dev/disk/by-id/ata-TOSHIBA_MK1656GSYF_205JT0FJT
(hd2) /dev/disk/by-id/usb-USB_Flash_Disk_AA330463000360005773-0:0

When I installed OpenSUSE, I selected the boot loader default options, so I assume grub installed to hd0. How do I check this to confirm?

I can say with certainty that hd0 is definitely the drive where WinXP resides (partition is sda1), and hd1 is definitely the drive with the OpenSUSE partitions.

Okay - here’s an interesting development.
Since OpenSUSE is installed to a drive in a removable caddy I decided to try booting with that drive removed. I got a new error:

GRUB Loading stage1.5

GRUB loading, please wait …
Error 21

Does this mean GRUB was in fact installed to hd1?

We have a script file designed to find where you loaded grub, but it can only be ran from an openSUSE session. This is a script file called findgrub:

#!/bin/bash

#: Title       : findgrub
#: Date Created: Sun Sep 26 19:40:40 CDT 2010
#: Last Edit   : Sun Sep 26 19:40:40 CDT 2010
#: Author      : please_try_again & edited by j McDaniel
#: Version     : 1.00
#: Description : Locates the Grub Boot Loader
#: Options     : name of drive, ex: sda

#
# Check to see if we are root
#

if [[ $UID -ne 0 ]]; then
  echo "Root User Permissions are required, Please Enter the ..."
  echo
  sudo $0 $1
  exit 0
fi

echo
echo "Find Grub Version 1.0 : Syntax: findgrub [sdx] : x = a,b or c etc."
echo

devs=(`fdisk -l | sed -n 's|^Disk \(/dev/[hs]d[a-z]\):.*|\1|p'`)

[ "$1" ] && devs=(/dev/$1) 

for dev in ${devs
[li]} ; do[/li]        if [ -b $dev ] ; then
                dd if=$dev bs=512 count=1 2> /dev/null | grep -q GRUB && echo "Grub found in MBR on $dev"
                for pt in `fdisk -l $dev | awk '/^\/dev/ { print $1 }'` ; do
                        echo "Searching Partition $pt"
                        dd if=$pt bs=512 count=1 2> /dev/null | grep -q GRUB && echo "Grub found in partition $pt" 
                        dd if=$pt bs=512 count=1 2> /dev/null | grep -q NTLDR && echo "NT/XP/VISTA Loader found in $pt" 
                        dd if=$pt bs=512 count=1 2> /dev/null | grep -q BOOTMGR && echo "Windows 7 Loader found in $pt"
                done
        fi
done

echo
echo "findgrub search is complete..."
echo

exit 0
# End Of Script

Copy and past the file into Kwrite or other text editor and save it in your ~/bin folder, in your home area as the file findgrub. Then open a terminal session and use the command to make it executable:

chmod +x ~/bin/findgrub

To use findgrub, open a terminal session, like konsole, and type in findgrub. Here is an example of what it does on my computer with three hard drives:

james@LinuxUser:~> findgrub
Root User Permissions are required, Please Enter the ...

root's password:

Find Grub Version 1.0 : Syntax: findgrub [sdx] : x = a,b or c etc.

Searching Partition /dev/sda1
Windows 7 Loader found in /dev/sda1
Searching Partition /dev/sdb1
Searching Partition /dev/sdb2
Grub found in partition /dev/sdb2
Searching Partition /dev/sdb3
Searching Partition /dev/sdc1
Windows 7 Loader found in /dev/sdc1

findgrub search is complete...

This shows that grub is loaded in my /dev/sdb2 partition, which is correct. The next thing might be looking at your BIOS setup to determine which disk is set as the boot drive in your BIOS first. Is it the Windows disk which Linux calls /dev/sda or is it the Linux disk, which again is called /dev/sdb?

Finally, I would download the GParted boot disk and make a boot disk that you can use to make a partition bootable. I would try to get Windows going again since you can always reload openSUSE. Here is a Web page on GParted:

GParted – Welcome

Here is an article about reinstalling GRub, should you go that direction:

Re-Install Grub Quickly with Parted Magic

Thank You,

findgrub

Find Grub Version 1.0 : Syntax: findgrub [sdx] : x = a,b or c etc.

Grub found in MBR on /dev/sda
Searching Partition /dev/sda1
Searching Partition /dev/sdb1
Searching Partition /dev/sdb2
Searching Partition /dev/sdb3
Searching Partition /dev/sdc1
NT/XP/VISTA Loader found in /dev/sdc1

findgrub search is complete…

Okay, so the good news is GRUB is on sda as I suspected. The bad news is there is no windows loader on sda1. (The loader listed on /dev/sdc1 is a removable drive I have plugged into the system)

So you could change the rootnoverify line in grub config for Windows XP to:

rootnoverify (hd2,0)

Doing as you have done will work but the machine will not boot if the removable disk is not installed.

I’d set is up so the BIOS would first try to boot from then USB drive then I’d have temporarily disconnected the Window drive and installed Linux on the USB. Then edited the menu.list to add a menu item for windows and then reconnected the internal drive. This would allow booting to grub and the choice of OS or if the USB drive is not installed a direct boot into Windows.

You can still set that up fixing the Windows boot and installing grub to the USB drive boot record.

The removable drive does not contain a valid, bootable windows partition. Booting to hd2 is not an option - I need to figure out the GRUB entry to boot to hd0 (sda1)

I care a whole lot less about the fact I need the caddy drive installed in order to boot, and a whole lot more about the fact I don’t have a working GRUB entry to boot into windows. The first I can fix anytime later, the second I need to get fixed right now.

Try the latest version of the script I posted here: Looking for Grub and Windows bootloader in all partitions. and tell us what you see.
it has to be run as root:(

If you don’t see something like the text in green in the example below, you might not have any bootable Windows partition (or I’m still missing something that you’re going to tell me - that script hasn’t been tested a lot)

Grub found in MBR on /dev/sdb
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)
    makeactive
    chainloader +1

Grub found in /dev/sdb5
Grub found in MBR on /dev/sda
Windows NT/2K/XP Loader found in /dev/sda1
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/sda1
    rootnoverify (hd0,0)
    makeactive
    chainloader +1

Grub found in /dev/sda11

findgrub

Grub found in MBR on /dev/sda

That’s it - just one line returned.

When I run the findgrub version provided earlier in this thread, I get

Find Grub Version 1.0 : Syntax: findgrub [sdx] : x = a,b or c etc.

Grub found in MBR on /dev/sda
Searching Partition /dev/sda1
Searching Partition /dev/sdb1
Searching Partition /dev/sdb2
Searching Partition /dev/sdb3

findgrub search is complete…

It means that you have Grub in MBR, but that’s not what you are looking for, do you?
If the script, either the older or the newer version, doesn’t find a Windows partition, chances are that you don’t have any.
You can type :
sudo fdisk -l
and we will see …