I've tried installing Elementary OS with a custom partition scheme, using both LVM and Luks, but after the installation I can't log into the system: the kernel boots but cannot mount the encrypted root partition. It fails with:
WARNING: Failed to connect to lvmetad. Falling back to device scanning.
Volume group "elementary-vg" not found
Cannot process volume group elementary-vg
This is the way I performed the custom partition scheme. I booted Elementary OS from an USB pen, launched
gparted and created the following partitions:
/dev/sda1 efi fat32 512MB (boot, esp)
/dev/sda2 boot ext4 732MB
/dev/sda3 not mapped 10240MB
/dev/sda4 luks remaining space
Then with a command line:
# cryptsetup luksFormat --hash=sha256 --key-size=512 --cipher=aes-xts-plain64 --verify-passphrase /dev/sda4
# cryptsetup luksOpen /dev/sda4 elementary
# pvcreate /dev/mapper/elementary
# vgcreate elementary-vg /dev/mapper/elementary
# lvcreate -n root -L 32G elementary-vg
# lvcreate -n swap_1 -L 12G elementary-vg
# lvcreate -n users -l +100%FREE elementary-vg
Then I launched the installer and used the "Something else" option for the disk. I mapped the existing partitions as follows:
/dev/sda2 ext4 /boot format
/dev/mapper/elementary-vg--root ext4 / format
/dev/mapper/elementary-vg--users ext4 /media/users format
The installation correctly completes, as I said, but it fails at the next reboot.
I even logged in with the USB key, ran the usual stuff for chrooting into the installation and performed and
apt update; apt dist-upgrade. It went fine, updated the initramfs and grub, but didn't fix the problem.
The Luks setup seems fine, in fact if I enter the
grub command line I can manually mount the encrypted root:
grub> insmod luks
grub> cryptomount hd0,gpt4
grub> insmod lvm
and I can see the logical volumes.
Please suggest what I should do to fix the existing installation. Thanks.