Closed adavidzh closed 11 months ago
With many difficulties i managed to find that (a) https://build.almalinux.org/search?rpmName=zram-generator
⎇ c9-beta some tests failed some tests failed all tests failed all tests failed all tests failed
and (b) https://git.almalinux.org/rpms/rust-zram-generator which has three different branches (two of which seemingly identical but with different SHAs), and none of them have a patch
Given this, it's rather obvious that if you said
mount-point = /tmp/zramdisk # must be created beforehand
and this generated
# /run/systemd/generator/systemd-zram-setup@zram0.service.d/bindsto-mount.conf
# Automatically generated by /usr/lib/systemd/system-generators/zram-generator
[Unit]
BindsTo=tmp-zramdisk # must be created beforehand.mount
then z-g should've escaped the path. Thankfully, I think this is the only place this needs to be done.
Actually, 1.1.2 does escape it, and notes the other errors in your config:
$ ZRAM_GENERATOR_ROOT=$PWD target/release/zram-generator $PWD/dest
Scanning directory '/home/nabijaczleweli/code/systemd-zram-generator/usr/lib/systemd/zram-generator.conf.d'
Scanning directory '/home/nabijaczleweli/code/systemd-zram-generator/usr/local/lib/systemd/zram-generator.conf.d'
Scanning directory '/home/nabijaczleweli/code/systemd-zram-generator/etc/systemd/zram-generator.conf.d'
Scanning directory '/home/nabijaczleweli/code/systemd-zram-generator/run/systemd/zram-generator.conf.d'
Error: zram0 zram-size
Caused by:
UnparsedTokensRemaining("# in MB")
but removing that, I see
$ ZRAM_GENERATOR_ROOT=$PWD target/release/zram-generator $PWD/dest
Scanning directory '/home/nabijaczleweli/code/systemd-zram-generator/usr/lib/systemd/zram-generator.conf.d'
Scanning directory '/home/nabijaczleweli/code/systemd-zram-generator/usr/local/lib/systemd/zram-generator.conf.d'
Scanning directory '/home/nabijaczleweli/code/systemd-zram-generator/etc/systemd/zram-generator.conf.d'
Scanning directory '/home/nabijaczleweli/code/systemd-zram-generator/run/systemd/zram-generator.conf.d'
Creating unit file tmp-zramdisk\x20\x23\x20must\x20be\x20created\x20beforehand.mount (/dev/zram0 with 80000MB)
$ find dest/
dest/
dest/systemd-zram-setup@zram0.service.d
dest/systemd-zram-setup@zram0.service.d/bindings.conf
dest/local-fs.target.wants
dest/local-fs.target.wants/tmp-zramdisk\x20\x23\x20must\x20be\x20created\x20beforehand.mount
dest/tmp-zramdisk\x20\x23\x20must\x20be\x20created\x20beforehand.mount
$ find dest/ -type f -exec head -n99 {} +
==> dest/systemd-zram-setup@zram0.service.d/bindings.conf <==
# Automatically generated by /mnt/filling/store/nabijaczleweli/Rust-target/release/zram-generator
[Unit]
BindsTo=tmp-zramdisk\x20\x23\x20must\x20be\x20created\x20beforehand.mount
==> dest/tmp-zramdisk\x20\x23\x20must\x20be\x20created\x20beforehand.mount <==
# Automatically generated by /mnt/filling/store/nabijaczleweli/Rust-target/release/zram-generator
[Unit]
Description=Compressed Storage on /dev/zram0
Documentation=man:zram-generator(8) man:zram-generator.conf(5)
Requires=systemd-zram-setup@zram0.service
After=systemd-zram-setup@zram0.service
[Mount]
What=/dev/zram0
Where=/tmp/zramdisk # must be created beforehand
Options=X-mount.mode=1777
so this is already fixed in 2f2d5fbf0b6925ea55b37e2783e06177f4838fc0, and is thus a duplicate of #101.
Thanks for the low latency!
I moved all the comments and the problem is gone:
$ cat /etc/systemd/zram-generator.conf
[zram0]
zram-size = 80000
# in MB
mount-point = /tmp/zramdisk
# automatically created
fs-type = ext2
# simple, no frills, no CoW, no journaling, etc
options= X-mount.mode=1777
$ sudo systemctl daemon-reload
$ sudo systemctl start systemd-zram-setup@zram0.service
$ sudo systemctl cat systemd-zram-setup@zram0.service
# /usr/lib/systemd/system/systemd-zram-setup@.service
# SPDX-License-Identifier: MIT
# This file is part of the zram-generator project
# https://github.com/systemd/zram-generator
[Unit]
Description=Create swap on /dev/%i
Documentation=man:zram-generator(8) man:zram-generator.conf(5)
After=dev-%i.device
DefaultDependencies=false
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/systemd/system-generators/zram-generator --setup-device '%i'
ExecStop=/usr/lib/systemd/system-generators/zram-generator --reset-device '%i'
# /run/systemd/generator/systemd-zram-setup@zram0.service.d/bindsto-mount.conf
# Automatically generated by /usr/lib/systemd/system-generators/zram-generator
[Unit]
BindsTo=tmp-zramdisk.mount
$ zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lzo-rle 4G 1.3M 25.7K 132K 32 /tmp/zramdisk
I somehow thought that inline comments were purged.
Now I have to figure out why DISKSIZE
is 4G
regardless of what I put in zram-size
...
Now I have to figure out why
DISKSIZE
is4G
regardless of what I put inzram-size
...
It's the old version using old options. 😅
All good!
All is almost good.
Since 0.3.2
does not support options=
the mount is only writable by root
, an annoyance.
I have opened a request for bumping the version of zram-generator
in AlmaLinux 9. Let's see how that goes.
Thanks again for the quick turnaround.
I see that zram-generator
rpm hasn't been updated beyond v0.3.2 on EL9.
Not sure why, but there might be an upstream issue that was never resolved.
Not sure what the issue is.
Hi there,
I am trying to replace a
tmpfs
ramdisk to store temporary (and highly compressible) data andzram-generator
looked like a really neat and organised way to do that.TL;DR: Alma Linux 9 is installing
zram-generator v0.3.2
, things do not work because of a missing dependency onBindsTo=tmp-zramdisk
, and I am wondering if the old version is the problem or a red herring.Details follow:
I have rolled out
but it fails with
I could not find much about this
beforehand.mount
and I am not sure what it is supposed to be for.I do see some unintuitive stuff in the service:
I am confused by:
Create swap on
whenmount-point
is provided, that I guess is "just" a template issue. Should there be a second template or a parametric template for whenmount-point
is used?[Unit]
withBindsTo=tmp-zramdisk
that I cannot find in units/systemd-zram-setup@.service.in.I am running:
and I see that there is a
v1.1.2
release. The0.3.2
version comes fromI am running