LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Gentoo (http://www.linuxquestions.org/questions/gentoo-87/)
-   -   root on lvm on dm-crypt (http://www.linuxquestions.org/questions/gentoo-87/root-on-lvm-on-dm-crypt-745893/)

CoderMan 08-07-2009 05:06 PM

root on lvm on dm-crypt
 
Hi. I am a fairly new gentoo user, and building a system on my laptop using the root filesystem layered on top of lvm layered on top of dm-crypt encryption. I know that sounds a little difficult for a new user, but I am not willing to use gentoo if I can not set that up.

There are two partitions on my system:
/dev/hda1 xfs /boot
/dev/hda2 dm-encrypted partition

I encrypted /dev/hda2 with dm-crypt, and then created volume group 'vg' on top of that. Boot files go into /boot on /dev/hda1, and all system files are on the logical volume 'system'.

I compiled and installed my kernel with using genkernel and with --luks and --lvm support, and had all needed-components statically compiled in, and installed grub.

However, I can not get successful boot into the new system. I can manually boot into it using the install cd + cryptsetup + mounting everything myself, but I can't do it with just Grub.

I keep trying recommended menu.lst entries provided by pages all over the Internet, but only this one comes close to working:

Code:

title Gentoo Kernel
root (hd0,0)
kernel /boot/kernel-genkernel-x86-2.6.30-gentoo-r4 crypt_root=/dev/hda2 real_root=/dev/mapper/vg-system
initrd /boot/initramfs-genkernel-x86-2.6.30-gentoo-r4

When I boot, this entry will ask for my passphrase and decrypt /dev/hda2, but then it says it cannot find /dev/mapper/vg-system.

As far as I can tell, it seems that I am missing some parameter or something that causes the kernel to detect the volume group. (Like I would get when I run vgchange -ay). I dropped to shell and /dev/mapper/root is there but no /dev/mapper/vg-*, which seems to confirm this.

Does anyone know how I would modify this so it works?

CoderMan 08-07-2009 08:54 PM

Solved!!!
 
After dropping to the ash shell, and reading the init file in the initramfs image for 20 minutes, I found out that there is a parameter called 'dolvm'. Passing that in to the kernel causes it to run vgchange after Luks but before mounting the lvm.

So the modified entry:

Code:

title Gentoo Kernel
root (hd0,0)
kernel /boot/kernel-genkernel-x86-2.6.30-gentoo-r4 crypt_root=/dev/hda2 dolvm real_root=/dev/mapper/vg-system
initrd /boot/initramfs-genkernel-x86-2.6.30-gentoo-r4

Side note: When I dropped to the ash shell inside the initramfs, I couldn't find a text editor. Is there one in there?


All times are GMT -5. The time now is 04:35 PM.