(Originally posted at the Arch Linux forums)
I just spotted a bug/small problem on now two different Arch Linux systems. Namely, combining the systemd-zram-generator together with systemctl soft-reboot is occassionally causing the systemd-zram-setup@zram0 unit to fail.
The corresponding journalctl logs look like the following:
Feb 01 04:26:51 my-super-secret-hostname systemd[1]: Starting Create swap on /dev/zram0...
Feb 01 04:26:51 my-super-secret-hostname systemd-makefs[431]: /dev/zram0 successfully formatted as swap (label "zram0", uuid 10a31eb8-c8ea-4e75-b93b-a46cd7ca8564)
Feb 01 04:26:51 my-super-secret-hostname systemd[1]: Finished Create swap on /dev/zram0.
Feb 02 04:02:32 my-super-secret-hostname systemd[1]: Stopping Create swap on /dev/zram0...
Feb 02 04:02:32 my-super-secret-hostname zram-generator[757995]: Error: Device or resource busy (os error 16)
Feb 02 04:02:32 my-super-secret-hostname systemd[1]: systemd-zram-setup@zram0.service: Control process exited, code=exited, status=1/FAILURE
Feb 02 04:02:32 my-super-secret-hostname systemd[1]: systemd-zram-setup@zram0.service: Failed with result 'exit-code'.
Feb 02 04:02:32 my-super-secret-hostname systemd[1]: Stopped Create swap on /dev/zram0.
Feb 02 04:02:35 my-super-secret-hostname zram-generator[758039]: Error: Failed to configure disk size into /sys/block/zram0/disksize
Feb 02 04:02:35 my-super-secret-hostname zram-generator[758039]: Caused by:
Feb 02 04:02:35 my-super-secret-hostname zram-generator[758039]: Device or resource busy (os error 16)
Feb 02 04:02:37 my-super-secret-hostname systemd[1]: Starting Create swap on /dev/zram0...
Feb 02 04:02:37 my-super-secret-hostname zram-generator[758096]: Error: Failed to configure disk size into /sys/block/zram0/disksize
Feb 02 04:02:37 my-super-secret-hostname zram-generator[758096]: Caused by:
Feb 02 04:02:37 my-super-secret-hostname zram-generator[758096]: Device or resource busy (os error 16)
Feb 02 04:02:37 my-super-secret-hostname systemd[1]: systemd-zram-setup@zram0.service: Main process exited, code=exited, status=1/FAILURE
Feb 02 04:02:37 my-super-secret-hostname systemd[1]: systemd-zram-setup@zram0.service: Failed with result 'exit-code'.
Feb 02 04:02:37 my-super-secret-hostname systemd[1]: Failed to start Create swap on /dev/zram0.
This problem only occurs on systemctl soft-reboot, never on a regular full-reboot.
Now I'm not sure whether this is actually a problem in the way the unit is configured or how systemctl soft-reboot is behaving.
After applying the following service drop-in, it seems that the error no longer appears though.
# /etc/systemd/system/systemd-zram-setup@zram0.service.d/override.conf
[Unit]
SurviveFinalKillSignal=yes
IgnoreOnIsolate=yes
DefaultDependencies=no
Conflicts=reboot.target kexec.target poweroff.target halt.target rescue.target emergency.target
Before=shutdown.target rescue.target emergency.target
This is roughly following the logic for resource pass-through (systemctl-soft-reboot.service), except for the After property being left as-is. Setting After=basic.target would cause an ordering cycle, which is why I omitted it.
Arch itself uses the units from this repository (PKGBUILD), therefore this is likely not limited to Arch itself.
(Originally posted at the Arch Linux forums)
I just spotted a bug/small problem on now two different Arch Linux systems. Namely, combining the systemd-zram-generator together with
systemctl soft-rebootis occassionally causing thesystemd-zram-setup@zram0unit to fail.The corresponding journalctl logs look like the following:
This problem only occurs on systemctl soft-reboot, never on a regular full-reboot.
Now I'm not sure whether this is actually a problem in the way the unit is configured or how systemctl soft-reboot is behaving.
After applying the following service drop-in, it seems that the error no longer appears though.
This is roughly following the logic for resource pass-through (systemctl-soft-reboot.service), except for the
Afterproperty being left as-is. SettingAfter=basic.targetwould cause an ordering cycle, which is why I omitted it.Arch itself uses the units from this repository (PKGBUILD), therefore this is likely not limited to Arch itself.