NixOS v23.05
When I reboot my server I am getting a swapfile start failure during boot. I tried both encrypted and unencrypted and get the same error message. If I run systemct restart mkswap-var-cache-swapfile
manually, it succeeds and swap is activated. Journal for the service:
Nov 15 10:50:59 vps mkswap-var-cache-swapfile-start[832]: Attaching loopback device failed (loop device with autoclear flag is required>
Nov 15 10:50:59 vps systemd[1]: mkswap-var-cache-swapfile.service: Main process exited, code=exited, status=1/FAILURE
Nov 15 10:50:59 vps systemd[1]: mkswap-var-cache-swapfile.service: Failed with result 'exit-code'.
Nov 15 10:50:59 vps systemd[1]: Failed to start Initialisation of swap device /var/cache/swapfile.
Swap config:
swapDevices = [ {
device = "/var/cache/swapfile";
size = 4*1024;
randomEncryption.enable = true;
} ];
Filesystem is ext4.
Any ideas? Thanks!