Install cryptsetup utils:

Be sure not to install cryptsetup-initramfs as it seems to cause problems booting.

sudo apt-get install cryptsetup-run

Find and disable current swap device:

swapon -s
swapoff -a

Give device a label:

sudo mkfs.ext2 -L cryptswap /dev/nvme0n1p7 1M


# <target name>	<source device>		<key file>	<options>
swap      LABEL=cryptswap    /dev/urandom   swap,cipher=aes-xts-plain64,size=256


/dev/mapper/swap none            swap    sw              0       0

Start encrypted swap device and add swap:

cryptdisks_start swap
swapon -a

Remove old swap resume swap UUID:

rm -f /etc/initramfs-tools/conf.d/resume

Update initiramfs:

sudo update-initramfs -u