I have a triple boot setup (3xLinux). All Linuces share /home
and swap
, and their /
partitions are next to each other. All reside in an LVM on LUKS:
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259:0 0 951.8G 0 disk
|-nvme0n1p1 259:1 0 800M 0 part /boot/efi
|-nvme0n1p2 259:2 0 32G 0 part
|-nvme0n1p3 259:3 0 619M 0 part
`-nvme0n1p4 259:4 0 706.5G 0 part
`-cryptolvm 254:0 0 706.5G 0 crypt
|-cryptolvm-swap 254:1 0 32G 0 lvm [SWAP]
|-cryptolvm-home 254:2 0 430.0G 0 lvm /home
|-cryptolvm-centos 254:3 0 41G 0 lvm /mnt/centos
|-cryptolvm-arch 254:4 0 41G 0 lvm /
`-cryptolvm-opensuse 254:5 0 41G 0 lvm /mnt/opensuse
openSUSE manages the GRUB2 (with full encryption, i.e. disk unlock password needed before grub menu which resides on the openSUSE system partition /
).
Problem: Arch does not unlock the cryptodisk /dev/nvme0n1p4
and therefore cannot access its /
during boot. It drops me to an emergency prompt.
This is the setup an Arch Linux:
mkinitcpio
configuration (and yes, I have re-created /boot/initramfs-linux.img
after changing this):
# grep crypt /etc/mkinitcpio.conf | tail -1
HOOKS=(base udev autodetect modconf keyboard block encrypt lvm2 filesystems fsck)
GRUB2 configuration on openSUSE:
# grep --after=18 Arch /mnt/opensuse/boot/grub2/grub.cfg
menuentry 'Arch Linux (rolling) (on /dev/mapper/cryptolvm-arch)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' {
insmod part_gpt
insmod cryptodisk
insmod luks
insmod gcry_rijndael
insmod gcry_rijndael
insmod gcry_sha256
insmod lvm
insmod ext2
cryptomount -u 99999999999999999999999999999999
set root='lvmid/VVVVVV-VVVV-VVVV-VVVV-VVVV-VVVV-VVVVVV/qqqqqq-qqqq-qqqq-qqqq-qqqq-qqqq-qqqqqq'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='lvmid/VVVVVV-VVVV-VVVV-VVVV-VVVV-VVVV-VVVVVV/qqqqqq-qqqq-qqqq-qqqq-qqqq-qqqq-qqqqqq' aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
else
search --no-floppy --fs-uuid --set=root aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
fi
linuxefi /boot/vmlinuz-linux cryptdevice=UUID=99999999999999999999999999999999:cryptolvm root=/dev/mapper/cryptolvm-arch resume=/dev/cryptolvm/swap splash=silent quiet showopts
initrdefi /boot/initramfs-linux.img
}
LVM devices:
# vgs -v
VG Attr Ext #PV #LV #SN VSize VFree VG UUID VProfile
cryptolvm wz--n- 4.00m 1 5 0 706.45g <120.51g VVVVVV-VVVV-VVVV-VVVV-VVVV-VVVV-VVVVVV
# lvs -v | grep arch
arch cryptolvm 1 -wi-ao---- <40.96g -1 -1 254 4 qqqqqq-qqqq-qqqq-qqqq-qqqq-qqqq-qqqqqq
Disk/partition UUIDs:
# blkid | egrep '(p4|arch)'
/dev/nvme0n1p4: UUID="99999999-9999-9999-9999-999999999999" TYPE="crypto_LUKS" PARTUUID="cccccccc-cccc-cccc-cccc-cccccccccccc"
/dev/mapper/cryptolvm-arch: UUID="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" PARTUUID="cccccccc-cccc-cccc-cccc-cccccccccccc"
Workaround:
GRUB2 (or initramfs) drops me to a prompt because it cannot mount /dev/mapper/cryptolvm-arch
to /
(or, to /new_root
). So during each boot I enter manually:
> cryptsetup open /dev/nvme0n1p4 cryptolvm
(...)
> mount /dev/mapper/cryptolvm-arch /new_root
> ^D
Why is this necessary? The mount is given twice (cryptomount
and cryptdevice
) in grub.cfg
(and this is indeed used).
EDIT:
Perhaps this has to do with EFI? Would I receive an EFI error if it were? openSUSE boots via EFI, chain-loads the grub.cfg
from its /
, then boots Arch - is linuxefi
correct here?
Just before GRUB2 drops me to the emergency shell I can type keys and they appear on the screen. When the shell opens the typed characters are still in the buffer and are entered in that shell.