31 July 2007

Super Grub

Finally have my desktop system working again! GRUB was kicking my ass.

Every time that I booted I would get a Grub "Error 15". I could boot manually using a Grub Boot CD but that is slow tedious and annoying.

My problem was this: I have three drives. They are listed here in no particular order because no two pieces of software agree which one goes first

Drive 1: SATA
Set first in the boot order in BIOS.

This disk has 2 partitions. The first partition contains my home directories. The second is supposed to be the boot partition.

Detected as (hd0) by Grub Boot CD
Detected as /dev/sdc by Ubuntu
Detected as (hd2) when I run 'sudo grub' inside Ubuntu

Drive 2: SATA

Three partitions. Root, Swap, and an ext3 partition for backups of the home directory.

Detected as (hd1) by Grub Boot CD
Detected as /dev/sdb by Ubuntu
Detected as (hd1) when I run 'sudo grub' inside Ubuntu

Drive 3: IDE (Channel 0 Master)
Has a single NTFS partition for my Windows XP installation.

Detected as (hd2) by Grub Boot CD
Detected as /dev/sda by Ubuntu
Detected as (hd0) when I run 'sudo grub' inside Ubuntu


Using the Grub Live CD I can get the OS running with these Commands:
Code:
root (hd0,1)
kernel /vmlinuz-2.6.20-16-generic root=/dev/sdb1
initrd /initrd.img-2.6.20-16-generic
boot
My /boot/grub/devices.map file looks like this:
Code:
(hd0)   /dev/sdc
(hd1) /dev/sdb
(hd2) /dev/sda
And my /boot/grub/menu.lst file looks like this: (useless comments omitted)

Code:
## ## End Default Options ##
default 0
timeout 10


title Ubuntu, kernel 2.6.20-16-generic
root (hd0,1)
kernel /vmlinuz-2.6.20-16-generic root=UUID=ffa6418a-8fdc-4c0b-90db-e6bb33ba518e ro quiet splash
initrd /initrd.img-2.6.20-16-generic
quiet
savedefault

title Ubuntu, kernel 2.6.20-16-generic (recovery mode)
root (hd0,1)
kernel /vmlinuz-2.6.20-16-generic root=UUID=ffa6418a-8fdc-4c0b-90db-e6bb33ba518e ro single
initrd /initrd.img-2.6.20-16-generic

title Ubuntu, kernel 2.6.20-15-generic
root (hd0,1)
kernel /vmlinuz-2.6.20-15-generic root=UUID=ffa6418a-8fdc-4c0b-90db-e6bb33ba518e ro quiet splash
initrd /initrd.img-2.6.20-15-generic
quiet
savedefault

title Ubuntu, kernel 2.6.20-15-generic (recovery mode)
root (hd2,1)
kernel /vmlinuz-2.6.20-15-generic root=UUID=ffa6418a-8fdc-4c0b-90db-e6bb33ba518e ro single
initrd /initrd.img-2.6.20-15-generic

title Ubuntu, memtest86+
root (hd2,1)
kernel /memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

I posted this on the Ubuntu Forums and got a response that recommended using a piece of software called Supper Grub. With a name like that I was skeptical but man was it effective.

Turns out all I needed was to reinstall Grub on the MBR. I'm pretty sure that I made the mistake during the Ubuntu Install when it asked where I wanted to install the boot loader. Because Ubuntu labeled drives differently then they had been on my Gentoo installation I entered the wrong thing. (At least that is my best hunch).

It is worth noting that I'm pretty sure that Ubuntu still has the order of my drives mixed up. This, I'm sure will cause everything to get a little fouled up (2 minutes worth of annoying) next time a Kernel update is pushed. I need to investigate this more.

No comments: