Debian randomly encrypted swap partition
mouse 1533 · person cloud · link
Last update
2021-02-12
2021
02-12
« — »
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
apt install cryptsetup-initramfs cryptsetup-run

swapoff -a

# blank current partition header
dd if=/dev/zero of=/dev/sdXY bs=1M count=100
# if you are on an SSD use this:
blkdiscard /dev/sdXY

# /etc/crypttab
cswap /dev/disk/by-id/xxx-part6 /dev/urandom swap

# /etc/fstab
/dev/mapper/cswap none swap sw 0 0

shutdown -r 0

If you see wait for device errors in the boot sequece, comment out the line in /etc/fstab then put this in /etc/rc.local:

1
[ -e /dev/mapper/cswap ] && swapon -p 100 /dev/mapper/cswap || true