Hello,
I am doing new encrypted installation and have an issue with encrypted swap partition which i want to use for hibernation.I have decided to use UEFI mode with cryptsetup + BTRFS for filesystem.
lsblk>NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 232.9G 0 disk
├─sda1 8:1 0 1G 0 part /boot/efi
├─sda2 8:2 0 223G 0 part
│ └─cryptroot 254:0 0 223G 0 crypt /
└─sda3 8:3 0 8.9G 0 part
└─cryptsetup 254:1 0 8.9G 0 crypt [SWAP]
The problem is I can not force the Swap partition to decrypt on boot.When I boot into the system I am able to decrypt it and mount it as you can see from the output above and use it. I was searching for working solution for two days however failed.
In the file /etc/default/grub I have added>
GRUB_CMDLINE_LINUX_DEFAULT="cryptdevice=UUID=b85d8f4d-e220-4000-b3b9-464bc5fc04e8:cryptroot
cryptdevice=UUID=3fd46804-fda5-48bb-9a64-325acce919a7:cryptswap root=/dev/mapper/cryptroot
resume=/dev/mapper/cryptswap loglevel=3 quiet"
In mkinitcpio.conf i added hooks as follows>
HOOKS=(base udev autodetect microcode modconf encrypt kms keyboard keymap consolefont block resume btrfs filesystems fsck)
And in /etc/crypttab have>
cryptswap UUID=3fd46804-fda5-48bb-9a64-325acce919a7 /root/.cryptswap_key.bin none,luks
Both partitions Root and Swap are encrypted with the same passphrase. And as you see I added a also a keyfile for the swap partition.
I have really tried several ways but neither have worked. Here they write about some openswap hooks>
https://wiki.archlinux.org/title/Dm-crypt/Swap_encryption
Might it work?
Thanks for any advice!