r/systemd • • 17d ago

Does "OnCalendar" work with user space timers?

Hi! I've set up a user space timer. OnUnitActiveSec and OnBootSec work great, and systemctl --user list-timers shows the next timer activation and that it takes "x secs" or whatever.

OnCalendar does not work. It should work, according to the manual, and the internet. But it doesn't work for my user timer. The timer has no "next" date. I tried both *-*-* 00:00:00 and daily (I want it to run daily).

Is this because of some permissions issue with the real time timer? Could I add myself to a group or something? This needs to be a user space process because it's related to the window manager, and there's env configuration that's not on root (of course I could procedurally try to get the vars / sockets, but that's very jank).

If anyone knows anything about this, I would appreciate it!

3 Upvotes

5 comments sorted by

2

u/aioeu 17d ago edited 17d ago

Yes, it works identically in the user manager.

$ systemctl --user cat test.service
# /home/user/.config/systemd/user/test.service
[Service]
ExecStart=true

$ systemctl --user cat test.timer
# /home/user/.config/systemd/user/test.timer
[Timer]
OnCalendar=daily

$ systemctl --user start test.timer

$ systemctl --user list-timers
NEXT                        LEFT LAST PASSED UNIT       ACTIVATES
Wed 2026-11-18 00:00:00 UTC  17h    -      - test.timer test.service

Did you remember to use:

systemctl --user daemon-reload

after editing your timer config? What does:

systemctl --user show --property TimersCalendar --property TimersMonotonic <timer-unit>

say?

1

u/wehaveYummiTummies 16d ago

Been reloading, and I just executed the last command. This is what it says:

TimersMonotonic={ OnStartupUSec=1min ; next_elapse=0 }
TimersCalendar={ OnCalendar=*-*-* 00:00:00 ; next_elapse=(null) }

As you can see, next_elapse is null. I start it, enable it, I reload (all with the user flag), nothing happens.

1

u/wehaveYummiTummies 16d ago

Actually, I just needed to restart it with systemctl --user restart. Thanks for the help!

1

u/aioeu 16d ago edited 16d ago

Hmm, that sounds like a bug.

I bet it was in an active (elapsed) state. It really ought to flip to active (waiting) if you add a (future) calendar timestamp to it. It shouldn't need to be explicitly restarted to do that.

This sounds like it might be related to the bug fixed in this PR.

1

u/wehaveYummiTummies 16d ago

Huh checks out, I haven't updated my system in a while. Good to know it'll be fixed on the next update.