[solved] Linux kernel 5.7 and swapfile problems


Since I originally installed Arch by following Jay’s guide at [1], I wanted to point out this problem I came across by upgrading to kernel 5.7, coming from 5.6.

Jun 12 10:03:22 osprey systemd[1]: Activating swap /swapfile...
Jun 12 10:03:22 osprey kernel: swapon: swapfile has holes
Jun 12 10:03:22 osprey systemd[1]: swapfile.swap: Swap process exited, code=exited, status=255/EXCEPTION
Jun 12 10:03:22 osprey systemd[1]: swapfile.swap: Failed with result 'exit-code'.
Jun 12 10:03:22 osprey systemd[1]: Failed to activate swap /swapfile.

Until the bug in [2] gets patched, looks like dd is a better way of creating a swapfile than fallocate.

I solved this problem by following the advice in [3]. Some more info in [4].

Additionally, I would like to ask whether there is any difference in putting defaults in the mount options in fstab, as opposed to sw as suggested in Jay’s guide. I suppose different fs types, like swap, have different defaults than rw,suid,dev,exec,auto,nouser,async for other usual mount points.


[1] https://wiki.learnlinux.tv/index.php/How_to_Install_Arch_Linux#Create_swap_file
[2] https://bugs.archlinux.org/task/66921
[3] https://wiki.archlinux.org/index.php/Swap#Manually
[4] https://manpages.courier-mta.org/htmlman8/swapon.8.html#swapon-8_sect3

Yes, there is an actual problem with newer kernels and the method of swap used. This is the main challenge of creating tutorials for a rolling distro, something is always changing. I’m a bit behind on recording, but I intend on creating a video on this as soon as I possibly can. Sorry for the delay.