Messed up Grub, need help getting everything working

I had a dual-boot system with Windows XP and Ubuntu 8.04, installed on the same hard drive. I installed a new (old, new to this system) 80GB drive to try out openSuse 11. The DVD install went fine, though I did get confused when it came time to install GRUB, and also when creating a /boot partition. I already have a /boot on my Win/Ubu disk, but I selected not to mount that one when partitioning for openSuse, and instead created another /boot partition in which I installed GRUB. So, when I rebooted I got a GRUB error 15. I then checked the boot order in my BIOS, and moved the openSuse disk up to 1st, and I can boot openSuse okay. Using SuperGrub I could boot into my Ubuntu install, but no Windows XP. I copied the entries from my Ubuntu menu.lst into my openSuse menu.lst:

title Ubuntu 8.04.1, kernel 2.6.24-21-generic
root (hd0,5)
kernel /vmlinuz-2.6.24-21-generic root=UUID=5b7dc39c-6414-4755-afea-630a7673a5d2 ro quiet splash
initrd /initrd.img-2.6.24-21-generic
quiet
FAT32 (LBA)
I then changed (hd0,5) to read (hd1,5) since I changed the order in BIOS. This works great for selecting between openSuse & Ubuntu when booting, but Windows still won’t boot ( also changed hd0 to hd1 for Windows). If I make my Win/Ubu disk the first boot disk I get a GRUB error.

My question is, how do I get a working GRUB config which lists all 3 Operating Systems, and allows me to boot into them?

Here’s my fisk -l output from openSuse:
[size=]
Disk /dev/sda: 300.0 GB, 300090728448 bytes
255 heads, 63 sectors/track, 36483 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xee800574

Device Boot Start End Blocks Id System
/dev/sda1 1 6527 52428096 7 HPFS/NTFS
/dev/sda2 * 6528 36483 240621570 f W95 Ext’d (LBA)
/dev/sda5 6528 26108 157284351 7 HPFS/NTFS
/dev/sda6 26109 26135 216846 83 Linux
/dev/sda7 26136 35059 71681998+ 83 Linux
/dev/sda8 35060 36334 10241406 83 Linux
/dev/sda9 36335 36483 1196811 82 Linux swap / Solaris

Disk /dev/sdb: 81.9 GB, 81964302336 bytes
255 heads, 63 sectors/track, 9964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000348a8

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 9961 80011701 f W95 Ext’d (LBA)
/dev/sdb5 1960 9961 64276065 83 Linux
/dev/sdb6 1 32 256945+ 83 Linux
/dev/sdb7 33 1959 15478596 83 Linux

Partition table entries are not in disk order

Disk /dev/sdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x54eeaef8

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 60801 488384001 7 HPFS/NTFS

Disk /dev/sdd: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x8f9c798a

Device Boot Start End Blocks Id System
/dev/sdd1 * 1 19457 156288321 c W95 FAT32 (LBA)[/size]

What’s SuperGrub? The Grub live cd? Anyway: you lost the ability to boot Windows because they require to be on the first partition (and/or on the first disk IIRC). Now, the easiest way to proceed would be this:
Keep the configuration in which you can boot Ubu and Suse, just add (or edit if it exists already) a classical Win stanza to contain the lines
rootnoverify (yadda yadda)
map (hd0) (hd1)
map (hd1) (hd0)
chainloader (yadda yadda)

Now your system will be able to boot, otherwise just double-check whether your references to (hd0,5), (hd1,5) are correct, and if needed also check other hard drive/partition references.

It’s a good thing you did not mount the /boot partition on the first disk when partitioning (or using) openSUSE - you will bork your Ubuntu instance. Don’t confuse controlling the boot from one partition with the necessity of having a unique /boot directory in each instance.

As already posted above, you need to use the map command. The stanza in openSUSE should look like:

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

I ended up with a different solution, nothing I tried could get things going normally. I suspect it may have something to do with having a SATA hd, and an IDE, but I’m not really sure.

Here’s what I did do to get things back to “normal”:

I had to boot a live cd, and use that terminal. I read somewhere that you can’t re-install grub in you’re using that hard drive, or something to that effect.

sudo grub
grub> root (hd0,5)
grub> setup (hd0)
grub> quit

This got my original ubuntu grub back and working.

I then added

title OpenSUSE Grub menu
configfile (hd1,5)/boot/grub/menu.lst

to the ubuntu menu.lst, then edited the menu.lst for openSuse, changin all hd0 references to hd1. Now things work okay.

I tried MANY different ways to chainload the opensuse grub menu so it will autoupdate when I update the kernel, for some reason map didn’t work. I got alot of strange errors, and took way too much time, I’m happy to have it in the state it’s in. I’ll probably tackle this project again when 11.1 is released, but for now I like the fact I can at least boot into any of my installs.

Sure, that approach will work just fine, too. Grub is very flexible. I’m not sure what you mean by

I tried MANY different ways to chainload the opensuse grub menu so it will autoupdate when I update the kernel . . .

Chainloading is the process of calling the boot manager from another partition boot sector. What you’ve done is one of the better methods, because when the openSUSE menu.lst changes it will not affect your primary Ubuntu menu.lst - you are simply calling the other menu.lst. But be careful with using the Debian/Ubuntu grub-install script - it’s been several years since I have so it may be changed, but in the past it would try to write a stanza for openSUSE that is like your Ubuntu stanza (with the fully qualified kernel and initrd file names). For ref, two other methods you can use are:

root (hd1,5)
kernel /boot/vmlinuz root=/dev/sdb6 etc.
initrd /boot/initrd

Or install grub to (hd1,5) and chainload to openSUSE thus:

root (hd1,5)
chainloader +1