From 891a5e1659a409e50841b080d3f0c6eedd842b16 Mon Sep 17 00:00:00 2001 From: Maurice Zhou Date: Sun, 6 Feb 2022 15:56:32 +0100 Subject: [PATCH] NixOS: remove encrypted swap section due to system bug See https://github.com/NixOS/nixpkgs/issues/157989 Signed-off-by: Maurice Zhou --- .../Root on ZFS/3-optional-configuration.rst | 55 ------------------- 1 file changed, 55 deletions(-) diff --git a/docs/Getting Started/NixOS/Root on ZFS/3-optional-configuration.rst b/docs/Getting Started/NixOS/Root on ZFS/3-optional-configuration.rst index c8ff05c..f94788e 100644 --- a/docs/Getting Started/NixOS/Root on ZFS/3-optional-configuration.rst +++ b/docs/Getting Started/NixOS/Root on ZFS/3-optional-configuration.rst @@ -189,58 +189,3 @@ root pool will be replaced by keyfile, embedded in initrd. In the possible event of LUKS container corruption, data on root set will only be available with this key. - -Persistent swap and hibernation -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -#. Optional: enable persistent swap partition. By default - encryption key of swap partition is discarded on reboot:: - - INST_SWAPKEY=/mnt/etc/cryptkey.d/${INST_PRIMARY_DISK##*/}-part4-key-luks-swap - INST_SWAPMAPPER=${INST_PRIMARY_DISK##*/}-part4-luks-swap - - # fstab - # remove existing swap entries - for i in $DISK; do echo $i; done | grep -v ${INST_PRIMARY_DISK##*/} \ - | while read j; do sed -i "\,$j-part4\"; randomEncryption.enable,d" /mnt/etc/nixos/${INST_CONFIG_FILE} ; done - sed -i "s|${INST_PRIMARY_DISK}-part4\"; randomEncryption.enable = true|/dev/mapper/${INST_SWAPMAPPER}\"|g" /mnt/etc/nixos/${INST_CONFIG_FILE} - - # create key and format partition as LUKS container - dd bs=32 count=1 if=/dev/urandom of=${INST_SWAPKEY}; - chmod u=r,go= /mnt/etc/cryptkey.d/* - cryptsetup luksFormat -q --type luks2 --key-file ${INST_SWAPKEY} ${INST_PRIMARY_DISK}-part4 - cryptsetup luksOpen ${INST_PRIMARY_DISK}-part4 ${INST_SWAPMAPPER} --key-file ${INST_SWAPKEY} - - # initialize swap space - mkswap /dev/mapper/${INST_SWAPMAPPER} - - # add initrd key - tee -a /mnt/etc/nixos/${INST_CONFIG_FILE} <`__.