After the last kernel update I noticed that there was a warning during the boot process, but it was displayed too short to see where the problem was. Also, the system booted correctly so it couldn’t be critical.
My first thought was that it had something to do with the network as I had some problems with it recently, but to be sure I checked the logs:
After scrolling trough the log there it was.
kernel: swapon: swapfile has holes systemd: swapfile.swap: Swap process exited, code=exited, status=255/EXCEPTION systemd: swapfile.swap: Failed with result 'exit-code'. systemd: Failed to activate swap /swapfile. systemd: Dependency failed for Swap. systemd: swap.target: Job swap.target/start failed with result 'dependency'.
So it looks like my swap1 file has holes, but what does that mean? I did a quick search and found the following explanation:
The swap file implementation in the kernel expects to be able to write to the file directly, without the assistance of the filesystem. This is a problem on preallocated files (e.g. fallocate(1)) on filesystems like XFS or ext4, and on copy-on-write filesystems like btrfs.
Well, that wasn’t really helpful, so I kept searching and found the issue FS#66921 - [linux] “Swapfile has holes” on Linux 5.7 in the archlinux bug report list. That sounded more like what I was looking for.
Gladly, there was also a solution. So I followed the instructions and deleted the old swap file so I could create a new one.
As described in the issue I first created a new swapfile with
dd if=/dev/zero of=/swapfile bs=1M count=16384 status=progress
Afterwards I set the correct permissions and set the swap area to the swapfile.
chmod 600 /swapfile mkswap /swapfile
Finally I used
swapon to specify the
/swapfile on which swapping will take place.
After a restart the problem was gone, success!