After setting up hibernation on ubuntu 20.04 and modifying it that it works for encrypted swap partitions, I'm getting several issues:
First, after rebooting from hibernation, I got "Gave up waiting for suspend/resume device" along with "Volume group luks not found". Fortunately, I could boot the system normally afterwards.
Still, when going through the steps of the aforementioned websites again, I get the following errors and warnings when executing sudo update-initramfs -c -k all
:
update-initramfs: Generating /boot/initrd.img-5.4.0-56-generic
cryptsetup: ERROR: Couldn't resolve device
/dev/disk/by-uuid/5834cf70-0919-4c53-98a6-355d69bbd6a4
cryptsetup: ERROR: Couldn't resolve device
UUID=5834cf70-0919-4c53-98a6-355d69bbd6a4
cryptsetup: WARNING: target 'sda3_crypt' not found in /etc/crypttab
update-initramfs: Generating /boot/initrd.img-5.4.0-58-generic
cryptsetup: ERROR: Couldn't resolve device
/dev/disk/by-uuid/5834cf70-0919-4c53-98a6-355d69bbd6a4
cryptsetup: ERROR: Couldn't resolve device
UUID=5834cf70-0919-4c53-98a6-355d69bbd6a4
cryptsetup: WARNING: target 'sda3_crypt' not found in /etc/crypttab
Note that the UUID=5834cf70-0919-4c53-98a6-355d69bbd6a4
belonged to the previously non-encrypted swap partition sda3
.
I replaced this UUID
with the one of the encrypted partition sda3_crypt
in every configuration file (see below) I know of.
I hope with the following printouts provided the problems can be resolved. The contents of the configuration files involved (concerning the swap partition) are:
1. /etc/fstab
/dev/mapper/sda3_crypt none swap sw 0 0
2. /etc/initramfs-tools/conf.d/resume
RESUME=UUID=1e1793ab-315d-4797-a4df-ba5675f4c177
3. /etc/crypttab
sda3_crypt /dev/sda3 /dev/urandom cipher=aes-xts-plain64,size=256,swap,discard
4. /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="cryptdevice=UUID=abcb93a9-b73a-4e57-9f78-91b292b6bfb2:luks-abcb93a9-b73a-4e57-9f78-91b292b6bfb2 root=/dev/mapper/luks-abcb93a9-b73a-4e57-9f78-91b292b6bfb2 resume=UUID=1e1793ab-315d-4797-a4df-ba5675f4c177"
5. cat /proc/swaps
Filename Type Size Used Priority
/dev/dm-1 partition 16561148 55296 -2
6. free -mh
total used free shared buff/cache available
Mem: 7.6Gi 3.6Gi 139Mi 545Mi 3.9Gi 3.2Gi
Swap: 15Gi 54Mi 15Gi
7. sudo swapon --all --verbose
swapon: /dev/mapper/sda3_crypt: already active -- ignored
8. blkid | grep swap
/dev/mapper/sda3_crypt: UUID="1e1793ab-315d-4797-a4df-ba5675f4c177" TYPE="swap"
9. lsblk | grep SWAP
`-sda3_crypt 253:1 0 15.8G 0 crypt [SWAP]
The entire printouts of all mounted devices:
~/$ blkid
/dev/mapper/luks-abcb93a9-b73a-4e57-9f78-91b292b6bfb2: UUID="3dad5211-99f3-4513-bbcc-de820c2dbe8b" TYPE="ext4"
/dev/sda1: UUID="11F5-FCE6" TYPE="vfat" PARTUUID="59397319-bfe7-1841-b259-c157e97b19bd"
/dev/sda2: UUID="abcb93a9-b73a-4e57-9f78-91b292b6bfb2" TYPE="crypto_LUKS" PARTUUID="11c68a93-8cdf-e04f-ad0d-d4c1bfce2796"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/mapper/sda3_crypt: UUID="1e1793ab-315d-4797-a4df-ba5675f4c177" TYPE="swap"
~/$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 55.4M 1 loop /snap/core18/1932
loop1 7:1 0 55.4M 1 loop /snap/core18/1944
loop2 7:2 0 31.1M 1 loop /snap/snapd/10238
loop3 7:3 0 31.1M 1 loop /snap/snapd/10492
sda 8:0 0 232.9G 0 disk
|-sda1 8:1 0 300M 0 part /boot/efi
|-sda2 8:2 0 216.8G 0 part
| `-luks-abcb93a9-b73a-4e57-9f78-91b292b6bfb2 253:0 0 216.8G 0 crypt /
`-sda3 8:3 0 15.8G 0 part
`-sda3_crypt 253:1 0 15.8G 0 crypt [SWAP]