Monday, April 13, 2009

Grub2 on an old Asus A7V

I happen to own an old computer with a Asus A7V mainboard (state of the art back in 2000), which happens to have a Promise PDC20265 controller on it. Said controller provides a few additional IDE ports for additional harddrives, on one of them hangs my Linux drive. So far so good, that setup works quite fine in Linux, the trouble however is booting it with Grub2.

First problem is that the Bios has a different idea about the drive ordering then Linux has, so editing /boot/grub/ is needed to swap the two drives around.

Second problem is a little more tricky, since not only is the ordering wrong, the second drive is completly missing in the first stage of Grub2, as can be seen by typing "ls", so neither the second stage nor any files can be loaded from it. So booting will fail.

Solution: Mount the Windows drive, the one tha Grub2 can see (sdb), to /mnt, then do a:

grub-install /dev/sdb --root-directory=/mnt

This will give you a /boot/grub/ directory on yoru Windows drive and a working Grub2, but without the menu. To fix this up I simply created a minimal menuentry that boots into the real Grub2 menu on the second drive, which Grub2 luckly can see without problem once Grub2 is fully booted.

$ cat /mnt/boot/grub/grub.cfg
set default=0
set timeout=0
menuentry "Real Grub" {
configfile (hd1,1)/boot/grub/grub.cfg

Some notes:
  • With Grub1 I had similar trouble, but I seem to have somehow managed to work around that, not sure how I did that, as there ain't a Grub1 install on sdb.
  • grub-install creates a /boot/grub/ with hd0 and hd1 in it, that can't be right, since Grub2 starts numbering with 1, not 0. (Edit: Only partitions start at 1, disks still start at 0)
  • I remember that there once was a grub-install --config-file option or something similar to make the grub.cfg hack unneeded, but that seems gone.
  • sudo wodim /usr/lib/grub-rescue/grub-rescue-cdrom.iso, as you don't want to break your booting without a rescue disc

1 comment:

Valonia said...
This comment has been removed by a blog administrator.