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

Swapfc path in another partition(? #212

Open YudhaDev opened 1 year ago

YudhaDev commented 1 year ago

before that, English is not my first language so please excuse any mistakes.

so today I try to change the path of swapfc into another directory that placed in a partition(ext4). and when I try to start the systemd service I got an error that mentioned PermissionError. I have no clue what to do next except using the default path for now. is it not posibble to do that?

OS: Manjaro 22.0.0 Kernel 5.15.41-1

Systemd status

× systemd-swap.service - Manage swap spaces on zram, files and partitions. Loaded: loaded (/usr/lib/systemd/system/systemd-swap.service; enabled; preset: disabled) Active: failed (Result: exit-code) since Mon 2022-10-17 08:57:56 WIB; 2s ago Duration: 4min 36.809s Process: 5694 ExecStart=/usr/bin/systemd-swap start (code=exited, status=1/FAILURE) Main PID: 5694 (code=exited, status=1/FAILURE) Status: "Allocating swap file..." CPU: 197ms

Okt 17 08:57:56 xndrive-linux systemd-swap[5694]: File "/usr/bin/systemd-swap", line 203, in init Okt 17 08:57:56 xndrive-linux systemd-swap[5694]: self.create_swapfile("swapFC: allocate chunk: ") Okt 17 08:57:56 xndrive-linux systemd-swap[5694]: File "/usr/bin/systemd-swap", line 311, in create_swapfile Okt 17 08:57:56 xndrive-linux systemd-swap[5694]: swapfile = self.prepare_swapfile( Okt 17 08:57:56 xndrive-linux systemd-swap[5694]: File "/usr/bin/systemd-swap", line 359, in prepare_swapfile Okt 17 08:57:56 xndrive-linux systemd-swap[5694]: os.mknod(path) Okt 17 08:57:56 xndrive-linux systemd-swap[5694]: PermissionError: [Errno 13] Permission denied Okt 17 08:57:56 xndrive-linux systemd[1]: systemd-swap.service: Main process exited, code=exited, status=1/FAILURE Okt 17 08:57:56 xndrive-linux systemd[1]: systemd-swap.service: Failed with result 'exit-code'. Okt 17 08:57:56 xndrive-linux systemd[1]: Failed to start Manage swap spaces on zram, files and partitions..

This is my configuration

zswap_enabled=1 zswap_compressor=zstd zswap_max_pool_percent=25 zswap_zpool=z3fold

swapfc_enabled=1

swapfc_force_use_loop=0

swapfc_frequency=1 swapfc_chunk_size=512M

swapfc_max_count=32

swapfc_min_count=1 swapfc_free_ram_perc=35 swapfc_free_swap_perc=15 swapfc_remove_free_swap_perc=55 swapfc_priority=50

swapfc_path=/var/lib/systemd-swap/swapfc/

swapfc_path=/mnt/ForSwap/

swapfc_nocow=1

swapfc_directio=1

swapfc_force_preallocated=0

heysion commented 5 months ago

Your issue are python os.mknod trouble , This trouble is your filesystem /mnt/ForSwap can not wirte by systemd .

You can check /mnt/ForSwap directory with ls -alh /mnt/ForSwap and getfacl /mnt/ForSwap command .

Or not you can change your path that path can wirte by systemd.