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

systemd-swap not checking if the path is a subvolume when the filesystem is btrfs #180

Closed EnderShadow closed 4 years ago

EnderShadow commented 4 years ago

https://github.com/Nefelim4ag/systemd-swap/blob/669e71750252f9a4f923c02d6e2c0364b07f8a0a/systemd-swap#L267

My root partition is btrfs and I mounted a btrfs subvolume at /mnt/swap. When I try to start systemd-swap it fails with this error

systemctl status systemd-swap
● 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 Thu 2020-08-20 19:41:21 CDT; 11s ago
    Process: 664682 ExecStart=/usr/bin/systemd-swap start (code=exited, status=1/FAILURE)
   Main PID: 664682 (code=exited, status=1/FAILURE)
     Status: "Monitoring memory status..."

Aug 20 19:41:21 planeptune systemd-swap[664682]:   File "/usr/bin/systemd-swap", line 733, in start
Aug 20 19:41:21 planeptune systemd-swap[664682]:     swap_fc = SwapFc(config, sem)
Aug 20 19:41:21 planeptune systemd-swap[664682]:   File "/usr/bin/systemd-swap", line 172, in __init__
Aug 20 19:41:21 planeptune systemd-swap[664682]:     subprocess.run(
Aug 20 19:41:21 planeptune systemd-swap[664682]:   File "/usr/lib/python3.8/subprocess.py", line 512, in run
Aug 20 19:41:21 planeptune systemd-swap[664682]:     raise CalledProcessError(retcode, process.args,
Aug 20 19:41:21 planeptune systemd-swap[664682]: subprocess.CalledProcessError: Command '['btrfs', 'subvolume', 'create', '/mnt/swap']' returned non-zero exit status 1.
Aug 20 19:41:21 planeptune systemd[1]: systemd-swap.service: Main process exited, code=exited, status=1/FAILURE
Aug 20 19:41:21 planeptune systemd[1]: systemd-swap.service: Failed with result 'exit-code'.
Aug 20 19:41:21 planeptune systemd[1]: Failed to start Manage swap spaces on zram, files and partitions..

I've tracked the issue down to the referenced line where it appears to only check if the path is a btrfs sub volume when it previously didn't know what type of file system it was.