I have LVM partitions which are encrypted using LUKS. My root partition is
LVM group "HDD" (at /dev/HDD): Encrypted LUKS device "root" at /dev/HDD/root
I'm trying to decrypt it via grub parameters,
dolvm crypt_root=/dev/HDD/root root=/dev/mapper/root root_keydev=UUID=<usb-uuid> root_key=hdd.key
The key for LUKS is located on usb-device at
But when it is loading, it shows error message:
>> Scanning for and activating Volume Groups Reading all physical volumes. This may take a while... Found volume group "HDD" using metadata type lvm 3 logical volume(s) in volume group "HDD" now active >> Using key device /dev/sdc2. >> Removable device /dev/sdc2 mounted. >> hdd.key on device /dev/sdc2 found No key available with this passphrase. !! Failed to open LUKS device /dev/HDD/root !! Could not find the root in /dev/HDD/root. !! Please specify another value or: !! - press Enter for the same !! - type "shell" for a shell !! - type "q" to skip...
According to logs the volume group was found, the device with key was mounted successfully, the key on the device was found, but then it failed to open it using LUKS.
Then I'm using
shell option to fix it manually. Device with the key is mounted to
/mnt/key, so I can find it here and open LUKS device with this key:
cat /mnt/key/hdd.key | cryptsetup luksOpen /dev/HDD/root root
this command opens LUKS device at
/dev/mapper/root, so I can exit the shell and press
q to skip this error. After that the system is booting successfully.
It seems that something is wrong with my grub configuration, because it is possible to open LUKS device and mount it using my key manually, so my question is how to fix it to open LUKS device automatically on boot using grub2?