Systemd-swap failing to start

I have installed and enabled zram but at boot i get the error: Failed to start manage swap and zram, it seems the systemd-swap unit is failing to start.

sudo systemctl status systemd-swap                                                                                      INT ✘  4m 56s  
× 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 2022-01-20 21:34:59 -03; 13min ago
   Main PID: 567 (code=exited, status=1/FAILURE)
        CPU: 333ms

jan 20 21:34:59 julio-550xbe350xbe systemd-swap[567]:     start()
jan 20 21:34:59 julio-550xbe350xbe systemd-swap[567]:   File "/usr/bin/systemd-swap", line 561, in start
jan 20 21:34:59 julio-550xbe350xbe systemd-swap[567]:     stop(on_init=True)
jan 20 21:34:59 julio-550xbe350xbe systemd-swap[567]:   File "/usr/bin/systemd-swap", line 778, in stop
jan 20 21:34:59 julio-550xbe350xbe systemd-swap[567]:     swapfc_path = config.get("swapfc_path")
jan 20 21:34:59 julio-550xbe350xbe systemd-swap[567]:   File "/usr/bin/systemd-swap", line 103, in get
jan 20 21:34:59 julio-550xbe350xbe systemd-swap[567]:     return as_type(self.config[key])
jan 20 21:34:59 julio-550xbe350xbe systemd-swap[567]: KeyError: 'swapfc_path'
jan 20 21:34:59 julio-550xbe350xbe systemd[1]: systemd-swap.service: Failed with result 'exit-code'.
jan 20 21:34:59 julio-550xbe350xbe systemd[1]: Failed to start Manage swap spaces on zram, files and partitions..

config file should be in /etc/systemd/swap.conf
perhaps some settings there?
something to do with swapfc (chunked dynamic swapfiles)

What changes do i need to make to the file?

sudo nano /etc/systemd/swap.conf

#  This file is part of systemd-swap.
#
# Entries in this file show the systemd-swap defaults as
# specified in /usr/share/systemd-swap/swap-default.conf
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See swap.conf(5) and /usr/share/systemd-swap/swap-default.conf for details.

#zswap_enabled=1
#zswap_compressor=zstd
#zswap_max_pool_percent=25
#zswap_zpool=z3fold
#zram_enabled=0
#zram_size=$(( RAM_SIZE / 4 ))
#zram_count=${NCPU}
#zram_streams=${NCPU}
#zram_alg=zstd
#zram_prio=32767
#swapfc_enabled=0

In /etc/systemd/swap.conf
I just uncommented this:
zram_enabled=1

and uncommented and changed this from the default “0” to “1”
swapfc_enabled=1

I probably should have started with just either one - this was just to see whether it worked.

and now I have this
(it is Manjaro Xfce in a virtual machine, installed without swap, 4 GB of RAM given to it):

LANG=C free -h
               total        used        free      shared  buff/cache   available
Mem:           3.8Gi       545Mi       1.4Gi        19Mi       1.9Gi       3.0Gi
Swap:          981Mi          0B       981Mi
LANG=C lsblk -f
NAME   FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sr0                                                                           
zram0                                                                         [SWAP]
zram1                                                                         [SWAP]
zram2                                                                         [SWAP]
zram3                                                                         [SWAP]
vda                                                                           
|-vda1 ext4   1.0         ffab1c84-669a-41be-b3ac-ae2efb7c80d2  280.2M    35% /boot
`-vda2 ext4   1.0         5a32e169-f2a5-406e-875b-652bf971a482   22.6G    32% /

On my real machine I do not use systemd-swap.
I do have a swap file and use:

AUR (en) - zramswap

as described in the Arch wiki:

Improving performance - ArchWiki

I have opted for zswap, can i use it with swapfc?

probably …
I didn’t read the documentation of the thing you chose to use. :man_shrugging:
I tried a random configuration that seemed to make sense - and it worked.
and I revealed what I use …

Be careful : this package is NOT actively maintained, it’s dev recommends NOT using it.

In addition, he clearly indicantes NOT to use zram & zswap at the same time

Thank you for the information, could you guide me to manually configure zswap?

Well, I can show you this tuto:

With due care… I don’t use it anymore, just create a large swapfile

That’s some weird language i can’t possibly read right there.

Do we have to assist you up to reading & clicking for you ?

If you do click, some magic happens:

Btw, french is not “some weird language”, it’s the language of cultured persons, the language of Olympic games and a reference language for professional diplomacy…

I haven’t seen the button at first, silly me.

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