I created the transient systemd timer with the command:
systemd-run --collect --unit=alarm-clock --on-active="1h" --timer-property=WakeSystem=true flatpak run io.bassi.Amberol /home/user/Music/test.flac
However despite WakeSystem=true
the timer does not count down when the system is suspended. systemctl list-timers --all
shows the timer still having almost 1h left.
Transient timer file content
# This is a transient unit file, created programmatically via the systemd API. Do not edit.
[Unit]
Description=/usr/bin/flatpak run io.bassi.Amberol /home/user/Music/test.flac
CollectMode=inactive-or-failed
[Timer]
OnActiveSec=1h
WakeSystem=yes
RemainAfterElapse=no
Any idea on how to debug this?
Edit:
The command also didn’t run after timer elapsed on a waking system… but at least it counted down.
Solved this. The combination of Wayland app and system unit is bad [1] [2]. Newer systemd version will allow WakeSystem with --user.
Though I don’t know why systemd wouldn’t just ask for sudo password instead of failing when certain operations require privilege. (So that I could specify --user and also set wake system.)
Edit2:
The clocks work as expected when queried with Python (suspended 40s in below).
>>> time.clock_gettime(time.CLOCK_MONOTONIC)
494.535988456
>>> time.clock_gettime(time.CLOCK_BOOTTIME)
546.947069797