Tookmund / Swapspace

A fork of Jeroen T. Vermeulen's excellent dynamic swap space manager
GNU General Public License v2.0
139 stars 13 forks source link

swapspace failed to create swap files on kernel 5.8 #27

Closed axet closed 4 years ago

axet commented 4 years ago

Ubuntu bug report, not sure what is causing it.

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1894910

Can we have an option to use fallocate vs dd?

Oct 18 17:45:32 axet-laptop swapspace[20368]: Setting up swapspace version 1, size = 948.4 MiB (994443264 bytes)
Oct 18 17:45:32 axet-laptop kernel: [13395.761365] swapon: swapfile has holes
Oct 18 17:45:32 axet-laptop swapspace[20368]: no label, UUID=5df82e74-d166-4570-9260-4ff42170b025
Oct 18 17:45:32 axet-laptop swapspace[714]: Error: Could not enable swapfile '1': Invalid argument
Tookmund commented 4 years ago

As of 1.17 we automatically fall back to manually zeroing the file (discussed in #23 implemented in https://github.com/Tookmund/Swapspace/commit/4e867cc94e5bb9b9ce7ef33a714c8956a41f68c2 )

In any previous versions after 1.14 the zero option should disable fallocate (https://github.com/Tookmund/Swapspace/commit/81afcbd31484f5fcb61ece41157254491e7dea40 )

The fallback logic in 1.17 should consistently error the first time it tries to create a swapfile but it should retry and succeed with the manual approach. If that’s not what you’re seeing, then there’s a major bug here.

Jacob

On Oct 18, 2020, at 10:57, axet notifications@github.com wrote:

 Ubuntu bug report, not sure what is causing it.

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1894910

Can we have an option to use fallocate vs dd?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

axet commented 4 years ago

Adding "zero" into /etc/swapspace.conf works. I'm using 1.14 on debian (10) buster. kernel 5.8, and kernel 5.7 failed to create swap files for some reason. Ubuntu seems also affected, can be a kernel bug.

Tookmund commented 4 years ago

To clarify, the zero option solves the problem for both kernels on Debian and Ubuntu?

axet commented 4 years ago

I've tested debian only. Yes it does solve the issue

axet commented 3 years ago

Just tested Ubuntu 20.04 (LTS 5.4.0-53-generic), with BTRFS as root with compression enabled and "zero" option added in /etc/swapspace.conf:

swapspace 1.14-1

Jun 11 21:14:51 axet-laptop kernel: [ 2152.476784] BTRFS warning (device dm-0): swapfile must not be copy-on-write
Jun 11 21:14:55 axet-laptop systemd[1441]: tracker-store.service: Succeeded.
Jun 11 21:14:55 axet-laptop swapspace[15273]: Setting up swapspace version 1, size = 848,9 MiB (890126336 bytes)
Jun 11 21:14:55 axet-laptop swapspace[15273]: no label, UUID=beba3b5c-729d-49c3-80df-3fd790e30f32
Jun 11 21:14:55 axet-laptop swapspace[11788]: Error: Could not enable swapfile '1': Invalid argument

It failed, probably because BTRFS requires additional swap file configuration (truncate + compression off)

Tookmund commented 3 years ago

Full BTRFS support was added in 1.15. Could you please test with a newer version? Note that the zero option was removed in favor of automatic detection in 1.17.

axet commented 3 years ago

Thanks. 1.15 works.