Zswap on Manjaro how to discover its status and disable swap?

I think that last year i have installed zswap

sudo pamac install systemd-swap;sudo systemctl enable systemd-swap.service;mkdir -p /etc/systemd/swap.conf.d/;echo -e "zswap_enabled=1\nzram_enabled=0\nswapfc_enabled=1" > /etc/systemd/swap.conf.d/myswap.conf
sudo sed -i "s/zswap_max_pool_percent=25/zswap_max_pool_percent=30/g" /usr/share/systemd-swap/swap-default.conf

Now under 5.13.19-2-MANJARO i see:

$ swapon
…nothing…
$ cat /sys/module/zswap/parameters/enabled
Y
$ grep -v “#” /etc/systemd/swap.conf
…nothing…
$ grep -R . /sys/module/zswap/parameters

/sys/module/zswap/parameters/same_filled_pages_enabled:Y
/sys/module/zswap/parameters/enabled:Y
/sys/module/zswap/parameters/max_pool_percent:25
/sys/module/zswap/parameters/compressor:lz4
/sys/module/zswap/parameters/zpool:z3fold
/sys/module/zswap/parameters/accept_threshold_percent:90

$ sudo dmesg | grep zswap
…nothing…
$ 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 Sat 2021-10-02 02:11:22 CEST; 3 days ago
    Process: 1315 ExecStart=/usr/bin/systemd-swap start (code=exited, status=1/FAILURE)
   Main PID: 1315 (code=exited, status=1/FAILURE)
     Status: "Allocating swap file..."
        CPU: 1min 31.440s

i have tried to systemctl start it, but failed, and “journalctl -xeu systemd-swap.service”
shows the error “FileNotFoundError: [Errno 2] No such file or directory: ‘/run/systemd/system/var-lib-systemd\x2dswap-swapfc-28.swap’” && “Failed to start Manage swap spaces on zram, files and partitions…” full journalctl

free output shows zero swap values, (somehow i disabled swap today)

Maybe i should not be using systemd-swap.service because it is managed somehow internally.

After i have uncommented line “swapfc_enabled=1” in /etc/systemd/swap.conf and “mount -a” and again “systemctl restart systemd-swap.service” and it is running now and i do not know what helped and what caused that error. journalctl looks good now. “free” shows used swap.

$ swapon -s

|/var/lib/systemd-swap/swapfc/1          file||1073148||1073148||50|
|---|---|---|---|---|---|---|
|/var/lib/systemd-swap/swapfc/2          file||1073148||1073148||49|
...

When i want to temporarily disable swap (“swapoff -a” or “systemctl stop systemd-swap.service” command? does not matter which?), i do not need to make sure i have free RAM to cover used swap? (i can discover using “free” command)

https://wiki.archlinux.org/title/Zswap#Toggling_zswap

Thank you

To disable edit /etc/default/grub and in inside of GRUB_CMDLINE_LINUX_DEFAULT type

zswap.enabled=0

save,then do a

sudo update-grub

Reboot and that should disable zswap.

As why the systemd-swap is failing I have no idea,but systemd-swap developer says is better now to use systemd-zram-generator

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.