--- /usr/share/ubiquity/zsys-setup 2022-01-17 18:11:10.033634419 +0100 +++ /usr/share/ubiquity/zsys-setup 2022-01-17 18:04:18.013008836 +0100 @@ -518,6 +518,16 @@ echo "I: Found swapfile with size ${SWAPSIZE}. Disabling" swapoff "${SWAPFILE}" fi + + # Always use a swap partition that is big enough to support hibernation. + SWAPSIZE="$(sed -n 's/^MemTotal:\s*\([0-9]\+\).*/\1/p' /proc/meminfo)" + # /proc/meminfo is in KiB. + SWAPSIZE=$(( SWAPSIZE * 1024 )) + # Use 1.5x memory size. + SWAPSIZE=$(( SWAPSIZE * 15 / 10 )) + # Round up to nearest GiB. + SWAPSIZE=$(( ( ( SWAPSIZE / 1024 / 1024 + 1023 ) / 1024) * 1024 * 1024 * 1024 )) + # Convert to MiB to align the size on the size of a block SWAPVOLSIZE=$(( SWAPSIZE / 1024 / 1024 ))