Swapfile issue after kernel upgrade
After upgrading to Linux kernel 5.7 or higher you may encounter an issue with a swapfile created using fallocate.
[ 3.675736] swapon: swapfile has holes [ 3.684412] systemd[1]: swapfile.swap: Swap process exited, code=exited, status=255/EXCEPTION [ 3.684417] systemd[1]: swapfile.swap: Failed with result 'exit-code'. [ 3.685196] systemd[1]: Failed to activate swap /swapfile.
Solution: re-create the swapfile using dd.
# truncate -s 0 /swapfile # dd if=/dev/zero of=/swapfile bs=1M count=1024 status=progress # mkswap /swapfile # swapon -a