Hi all. I’m trying to make zram swap persistent and everything is ok except that swap has low priority after booting.
Steps I did:
Added zram to /etc/modules-load.d
Created environment file for zram-setup service in /usr/local/lib/zram.conf.d/zram0-env with content:
ZRAM_DEV_SIZE=4294967296
SWAP=y
But zram-setup service mounts swap with -3 priority that lower than my swap partition on HDD.
As I can see in /usr/lib/systemd/system/zram-setup@.service, service does not has option to set priority. So is there’s way to set it with condition that swupd repair will not replace service’s file (if I add -p option to swapon command)?
Ok. Because of stateless, I had to edit service via systemctl edit zram-setup@zram0.service to be sure that swupd repair won’t “repair” modified service file.
I also made some modifications to service so I can specify compression algorithm and priority in /usr/local/lib/zram.conf.d
In override.conf (opened by executing systemctl edit zram-setup@zram0.service) I wrote:
You should create modified unit files with systemctl edit. This puts the changes in the correct location automatically. It’ll go under /etc/systemd/system.
In this case systemd executes both files for some reason
P.S. Edited with --full option, but ExecStart=/bin/sh -c [ ! -z ${ZRAM_COMP_ALG+x} ] && echo $ZRAM_COMP_ALG > /sys/class/block/zram0/comp_algorithm
fails for some reason considering that command works fine if executed from terminal