-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
Zram is not loaded after a power outage (e.g. when disconnecting power cable from rpi).
Default ztab config, zram-config v1.7.0, RaspiOS Trixie, Pi Zero 2W, disabled dphys-swapfile.service
Terminal output
pi@rpizero:~ $ systemctl status zram-config.service
● zram-config.service - zram-config
Loaded: loaded (/etc/systemd/system/zram-config.service; enabled; preset: enabled)
Active: active (exited) since Sun 2025-09-14 09:53:26 CEST; 2min 24s ago
Invocation: 4e4b3756d54b4a2f9b01446487622b7a
Docs: https://github.com/ecdye/zram-config/blob/main/README.md
Process: 302 ExecStart=/usr/local/sbin/zram-config start (code=exited, status=0/SUCCESS)
Main PID: 302 (code=exited, status=0/SUCCESS)
Mem peak: 4.8M
CPU: 249ms
Notice: journal has been rotated since unit was started, output may be incomplete.
pi@rpizero:~ $ zramctl
pi@rpizero:~ $
pi@rpizero:~ $ sudo systemctl restart zram-config.service
pi@rpizero:~ $ systemctl status zram-config.service
● zram-config.service - zram-config
Loaded: loaded (/etc/systemd/system/zram-config.service; enabled; preset: enabled)
Active: active (exited) since Sun 2025-09-14 09:58:38 CEST; 3s ago
Invocation: 17cc4eead28145cbb6fc278fd5acff63
Docs: https://github.com/ecdye/zram-config/blob/main/README.md
Process: 1373 ExecStart=/usr/local/sbin/zram-config start (code=exited, status=0/SUCCESS)
Main PID: 1373 (code=exited, status=0/SUCCESS)
Mem peak: 5.1M
CPU: 489ms
Sep 14 09:58:38 rpizero zram-config[1391]: vm.page-cluster = 0
Sep 14 09:58:38 rpizero zram-config[1392]: vm.swappiness = 150
pi@rpizero:~ $ zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram2 lzo-rle 150M 320K 5.5K 172K 4 /opt/zram/zram2
/dev/zram1 lzo-rle 750M 64K 3.5K 256K 4 [SWAP]For now I created workaround:
zram-config-restart.service
sudo tee /etc/systemd/system/zram-config-restart.service > /dev/null <<EOF
[Unit]
Description=Conditional restart of zram-config service if active
After=multi-user.target
[Service]
Type=oneshot
ExecStart=/bin/bash -c 'systemctl is-active --quiet zram-config.service && systemctl restart zram-config.service || echo "zram-config not running, skipping restart"'
[Install]
WantedBy=multi-user.target
EOF
Metadata
Metadata
Assignees
Labels
No labels