LVM on encrypted partition drops me to initramfs root missing

I installed Ubuntu 13.10 64bit on my PC. I have single hard disk (/dev/sda) with LVM encrypted partition.

So the problem is that after reboot I cannot start Ubuntu (it dropped me to initramfs prompt with message: /dev/mapper/kubuntu....-root missing)

So I think it is because during boot it cannot open /dev/sda5 with cryptsetup. If I do chrooting I can open partition and mount encrypted root partition. I tried to add in grub parameter:

cryptopts=target=sda5_crypt,source=/dev/sda5,lvm=vg-root

But in cosole during boot I see that No LVM volume is found on sda5? I also find message:

scripts/local_top/cryptroot:line 1 /sbin/cryptsetup: not found

Can anybody have idea what is wrong?

I tried system upgrade, created cryptroot file, regenerated initram file.


Solution 1:

The cryptsetup modules are only added to the initramfs image "when there is a device that needs to be unlocked at initramfs stage (such as root or resume devices)" (See: conf-hook). But this currently only works (reliably) if the root device is not in an (encrypted) LVM.

To force the cryptsetup modules to the initramfs image you have to set CRYPTSETUP=y in /etc/cryptsetup-initramfs/conf-hook.

You can also remove the cryptopts grub/kernel parameter when adding the initramfs option in /etc/crypttab:

sda5_crypt /dev/sda5 none luks,initramfs

I just answered a similar question at Unix & Linux, you might want to have a look there too.

Solution 2:

I had this problem yesterday. I was using BTRFS and Ubuntu had automatically created root and home subvolumes on the filesystem that I wasn't aware of. I needed to edit my /etc/fstab to mount these volumes properly.

A tip: once you're in the initramfs shell, play around a bit and see if ls /root brings back anything. That led me to my answer.