Debian – How to Fix Grub Installation Failure with mdadm RAID1 and GPT

debiangptgrubmdadmraid

I've been trying all day to get my new Wheezy install completed but it fail to install Grub every time. I'm using x64 netinstall iso.

Here is my partition table:

Model: ATA ST3000DM001-1CH1 (scsi)
Disk /dev/sda: 5860533168s
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start      End          Size         File system  Name  Flags
 1      2048s      6143s        4096s                     grub  bios_grub
 2      6144s      1953791s     1947648s                  boot  raid
 3      1953792s   31250431s    29296640s                 root  raid
 4      31250432s  5860532223s  5829281792s               home  raid

Disk /dev/sdb has the same partition table. You can see I've added that infamous small partition and marked it as bios_grub to give Grub space because GPT takes more than legacy msdos table.

Error message I get from installer is "Failed to install Grub to /dev/sda" (or similar).

Partitions 2, 3 and 4 make three RAID1 partitions for /boot, /, and /home. All properly selected and formatted in Debian installer.

Please help!

Best Answer

Looks like somehow Debian installer screws up the partition table. The "bios_grub" flag gets removed and becomes "raid" flag. The fix is to rework the partition table again with parted and set it back.

parted /dev/sda
set 1 bios_grub on
quit

Same for /dev/sdb, and then chrooting and installing grub with answer from this question: How can I fix/install/reinstall grub?