nefelim4ag / systemd-swap

Script for creating hybrid swap space from zram swaps, swap files and swap partitions.
GNU General Public License v3.0
550 stars 81 forks source link

subprocess.CalledProcessError: Command '['mkswap', '-L', 'SWAP_f2fs_1', '/var/lib/systemd-swap/swapfc/1']' returned non-zero exit #204

Closed Zeioth closed 2 years ago

Zeioth commented 2 years ago

It fails to start if I set swapfc_min_count=1, also If I run out of ram, the system freezes which mean, it fails to spawn a chunk, no matter when.

Disk format: F2FS

My config

zswap_enabled=0
swapfc_enabled=1
swapfc_chunk_size=4192
swapfc_max_count=32
swapfc_min_count=1

Systemctl status

 sudo systemctl status systemd-swap.service                                                                                                                                            
× systemd-swap.service - Manage swap spaces on zram, files and partitions.
     Loaded: loaded (/usr/lib/systemd/system/systemd-swap.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Wed 2021-09-22 23:46:50 CEST; 56s ago
    Process: 714 ExecStart=/usr/bin/systemd-swap start (code=exited, status=1/FAILURE)
   Main PID: 714 (code=exited, status=1/FAILURE)
     Status: "Allocating swap file..."
        CPU: 0

sep 22 23:46:50 zeioth-pc systemd-swap[714]:   File "/usr/bin/systemd-swap", line 203, in __init__
sep 22 23:46:50 zeioth-pc systemd-swap[714]:     self.create_swapfile("swapFC: allocate chunk: ")
sep 22 23:46:50 zeioth-pc systemd-swap[714]:   File "/usr/bin/systemd-swap", line 314, in create_swapfile
sep 22 23:46:50 zeioth-pc systemd-swap[714]:     subprocess.run(
sep 22 23:46:50 zeioth-pc systemd-swap[714]:   File "/usr/lib/python3.9/subprocess.py", line 528, in run
sep 22 23:46:50 zeioth-pc systemd-swap[714]:     raise CalledProcessError(retcode, process.args,
sep 22 23:46:50 zeioth-pc systemd-swap[714]: subprocess.CalledProcessError: Command '['mkswap', '-L', 'SWAP_f2fs_1', '/var/lib/systemd-swap/swapfc/1']' returned non-zero exit status 1.
sep 22 23:46:50 zeioth-pc systemd[1]: systemd-swap.service: Main process exited, code=exited, status=1/FAILURE
sep 22 23:46:50 zeioth-pc systemd[1]: systemd-swap.service: Failed with result 'exit-code'.
sep 22 23:46:50 zeioth-pc systemd[1]: Failed to start Manage swap spaces on zram, files and partitions..
oold commented 2 years ago

Your chunk size is not good. We work on a per-mebibyte basis when zeroing out the swap file. The chunk size (in bytes) is divided by one mebibyte, then rounded. We should rework that part of the code. At the very least we should issue a proper warning.