Grub install fails when using raid dm-crypt and lvm

Fabrice MATHIEU's picture

Forums: 

Hello,

Recently playing with debian installer on system with two or more disk managed by mdadm and LVM, I have decided to add dm-crypt for root file system and swap space.

Install with debian squeeze CD disk1 on raid mirror hard disk with logical volumes works without any errors during all the installation process.

It get worse when I added dm-crypt (LUKS) module between raid and LVM; as a whole partition encryption which will get physical volume for LMV.
Install works until reaching grub install menu, it fails and tell me "unable to install grub in /dev/sda". See "http://tmpmbox.no-ip.org/squeeze_install_grub_error.jpg".

In all case, /boot partition is created at the beginning disk partition and is not encrypted, nor in logicial volume.

Trying to figure out why, I decided to pass through guided partitioning option "guided with encrypted and LVM". Install works fine and system boot up with asking pass phrase to decrypt system partition.

Using system tool, in the previous case, partitioning scheme looks like :
- one primary ext2 partition which get /boot and isn't encrypted (of course, this make grub able to booting up and then ask for pass to decrypt system).
- the last one is an extend partition with crypto type which in trun contain LVM layout with two logical volume => root and swap

This test confirm that using dm-crypt with LVM works, so adding dm-crypt with raid and LVM should work too; dm-crypt isn't the unique source problem.

Doing the same partition layout (as the one created by the guided option) in manual partitioning works too, the only difference is that the second partition is primary, not extend.
As said, at the top of this message, install with raid and LVM works.

Next steep was to invert dm-crypt and LVM, each logical volume will be encrypted, so disk layout is:
A) RAID
Dirol LVM
C) crypto on each logical volume
It works but we must enter pass phrase for each volume :-(, in contrast with only one for a whole encrypted partition.

Only using layout in this order (raid - md-crypt - LVM) does not work for me.

Test are made on a virtual machine, so I can test all I want without any constraint.

When grub fail, I have goes on in the installation process without using any boot manager.
Next boot was on a live cd (system rescue cd), re-assembling raid works (mdadm --assemble --scan), unlock encrypted partition too (cryptsetup crypt /dev/md/gtp2:1) but pvsacn find nothing.
Grub (as I understand) scan hard disk found by "grub-mkdevicemap" for partition layout in order to find the root file system, /boot and their respective file system type (ext4 in my case).
Grub-probe don't find it.

I don't know were to look for and I am ready to read all your comment and your question.

Thank you,