nefelim4ag / systemd-swap

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

Parse error #184

Closed gnzlbg closed 4 years ago

gnzlbg commented 4 years ago

I've updated systemd-swap and after the update it fails as follows:

$ systemctl status systemd-swap
WARNING: terminal is not fully functional
-  (press RETURN)● systemd-swap.service - Manage swap spaces on zram, files and partitions.
     Loaded: loaded (/usr/lib/systemd/system/systemd-swap.service; disabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Fri 2020-08-28 15:51:03 CEST; 3s ago
    Process: 18468 ExecStart=/usr/bin/systemd-swap start (code=exited, status=1/FAILURE)
   Main PID: 18468 (code=exited, status=1/FAILURE)
     Status: "Swap unit activation finished"

Aug 28 15:51:03 yoga systemd-swap[18468]:   File "/usr/bin/systemd-swap", line 156, in __init__
Aug 28 15:51:03 yoga systemd-swap[18468]:     self.assign_config(config)
Aug 28 15:51:03 yoga systemd-swap[18468]:   File "/usr/bin/systemd-swap", line 289, in assign_config
Aug 28 15:51:03 yoga systemd-swap[18468]:     self.swapfc_frequency = config.get("swapfc_frequency", int)
Aug 28 15:51:03 yoga systemd-swap[18468]:   File "/usr/bin/systemd-swap", line 103, in get
Aug 28 15:51:03 yoga systemd-swap[18468]:     return as_type(self.config[key])
Aug 28 15:51:03 yoga systemd-swap[18468]: ValueError: invalid literal for int() with base 10: '1s'
Aug 28 15:51:03 yoga systemd[1]: systemd-swap.service: Main process exited, code=exited, status=1/FAILURE
Aug 28 15:51:03 yoga systemd[1]: systemd-swap.service: Failed with result 'exit-code'.
Aug 28 15:51:03 yoga systemd[1]: Failed to start Manage swap spaces on zram, files and partitions..

It appears that it tries to parse a config value as an integer, but the value contains the string 1s. This error message is not very helpful, e.g., it would be useful to know which key contains the incorrect value. Also, this error was not appearing before.

vilgotf commented 4 years ago

121 the configuration file was updated MONTHS ago, there used to be a check if the swapfc_frequency was invalid but it seems that was removed with the python rewrite.

Fix it by using an up to date configuration file! Yours is probably missing loads of flags...