Ubuntu – Grub Error 2 in Ubuntu Jaunty Server

grubUbuntuubuntu-9.04

Ran into a problem on a fresh Jaunty server install on a NAS box with 2 SATA cards controlling 6 total disks. The install runs fine, but once it completes and asks for reboot, I get Grub Error 2 on startup. Doesn't seem to matter which disk I install to, or whether I opt for LVM or not. A little research indicates that I need to edit files in /boot/grub, but I'm having trouble mounting /boot when booting from the CD in repair mode.

Any Jaunty-specific tips out there for this? Thanks.

Best Answer

Figured this out, but it wasn't pretty. I'd install from the server cd, and on reboot it would fail right off the bat, saying only 'grub error 2' (changed eventually to 22). Repairing grub from the install cd didn't fix the problem.

First, it turns out that the order of the sata controllers got switched around on the new install. All the disks were wiped but the hardware wasn't shuffled around, so I'm not sure why this would happen. The problem with this is that only one of the sata cards (the one previously controlling sda-sdc, now sdd-sdf) is bootable. Having figured this out I installed to sdd, but prior installation attempts on the non-bootable disks were visible by grub once it loaded, and deleting them left it loading grub from sdd and looking for a non-existent root on sda-sdc. The solution was to wipe everything again, install to sdd, and run a terminal from the live cd:

sudo grub
grub> find /boot/grub/stage1
 (hd3,0)
grub> root (hd3,0)
grub> setup (hd3)
grub> quit

Makes sense since in /boot/grub/device.map hd3 is mapped to /dev/sdd.

I couldn't find a way in the bios to give the bootable controller any kind of priority for the device ordering, and rearranging the HD boot order in bios didn't seem to matter. Last resort would be to open it up and switch the pci slots of the controller cards around, but since it boots fine now I'm not going to try this -- maybe next upgrade.