1

I set for testing a virtual machine with debian machine is so configured

4 disk in raid10 software the md0(raid10) in encrypted with luks on the luks(luksmd0) I have create the vg (debian2-vg) wich finally has 2 volumes,root and swap. I configured boot in /(the latest grub2 can boot from raid,lvm and with boot in encrypted /). So I configured /etc/default/grub like this

GRUB_ENABLE_CRYPTODISK=y
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX="root=/dev/mapper/debian2--vg-root rd.luks.uuid=21d33599-a220-zddg-1b1f-b2ae82fc0856 rd.luks.name=21d33599-a220-zddg-1b1f-b2ae82fc0856=luksmd0 rd.luks.crypttab=no rd.lvm.lv=debian2-vg/root rd.luks=1 rd.md=1"

the system boot,ask for password of /,I insert the pass and the system boot and finally...initramfs without lvm :( (the md0 exist,luksmd0 no) What I miss?

1

Solution found. I have missed the initramfs part. When we change from a clear to encrypt environment, we must configure the initramfs.

a)After booting from a usbkey with iso image(slackware iso is ok, debian is ok too)

b)Open the encrypted md

cryptsetup luksOpen /dev/md0 luksmd0

c)Mount the eventual lvm

vgchange -ay
mount /dev/yourvgname/rootlv /mnt

d)mount those dirs as bind from "fakeroot"

for i in dev proc sys
do mount -o bind /$i/ /mnt/$i
done

e)usually boot is separate partition

chroot /mnt /bin/bash
mount /boot 

f)Important..we edit the /etc/crypttab,the uuid must be the uuid of encrypted dev in my case is /dev/md0, the uuid is taken from blkid NOT mdadm, another way is to use cryptsetup luksUUID /dev/md0

luksmd0 UUID=21d33599-a220-zddg-1b1f-b2ae82fc0856 none luks

g)We have to edit those two files,in this one we insert the kernel modules(ext4,md,raid10,raid0,etc..)

/etc/initramfs-tools/modules

in this other we simply enable cryptsetup

/etc/cryptsetup-initramfs/conf-hook

h)now edit /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX="root=/dev/mapper/debian2--vg-root rd.luks.uuid=21d33599-a220-zddg-1b1f-b2ae82fc0856 rd.luks.name=21d33599-a220-zddg-1b1f-b2ae82fc0856=luksmd0 rd.luks.crypttab=no rd.lvm.lv=debian2-vg/root rd.luks=1 rd.md=1"

i)if needed edit fstab and make changes

vim /etc/fstab

m)now mkinit

update-initramfs -cuv -k all

n)and finally grub

grub-install --recheck /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

if use efi

mount /boot/efi
grub-install --target=x86_64-efi --efi-directory=/boot/efi --recheck
grub-mkconfig -o /boot/grub/grub.cfg

If all is ok and no error given

umount -a
exit
reboot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.