wiki-system/encrypt-swap-Ubuntu-20.04.md

1.2 KiB

prerequisite

  • all command bellow are run has root

encrypt swap partition

sources :

apt-get install ecryptfs-utils
swapoff -a
cryptsetup luksFormat --cipher aes-xts-plain64 --verify-passphrase --key-size 256 /dev/nvme0n1p2
cryptsetup open /dev/nvme0n1p2 cryptswap
mkswap /dev/mapper/cryptswap

Now ajust /etc/fstab to use your mapper, replace your encrypt swap device like bellow :

/dev/mapper/cryptswap   none   swap   discard   0   0

add your encrypt swap device define in /etc/crypttab

cryptswap   /dev/nvme0n1p2		none	luks
swapon -a
printf "RESUME=UUID=/dev/mapper/cryptswap" | tee /etc/initramfs-tools/conf.d/resume

Register these changes.

update-initramfs -u -k all

to be solve

cryptsetup: ERROR: Couln't resolve device rpool/ROOT/ubuntu_...
cryptsetup: WARNING: Couln't determine root device