[arch-general] systemd timers: switch default target to timers.target?

Neitsab neitsab at ovh.fr
Sat Oct 4 11:44:33 UTC 2014


Hi everybody,

It seems like systemd now provides a target that is intended to gather
all timers supposed to be activated after boot. From man 7 systemd.special:

> timers.target
> A special target unit that sets up all timer units (see
> systemd.timer(5) for details) that shall be active after boot.
> It is recommended that timer units installed by applications get
> pulled in via Wants= dependencies from this unit. This is best
> configured via WantedBy=timers.target in the timer unit's
> "[Install]" section.

systemd package itself provides two timers,
/usr/lib/systemd/system/systemd-readahead-done.timer and
/usr/lib/systemd/system/systemd-tmpfiles-clean.timer, the latter being
statically enabled in the "new"
/usr/lib/systemd/system/timers.target.wants directory.

Five other packages in base group provide systemd timers: logrotate,
man-db, mdadm, shadow and util-linux. I didn't manage to use pkgfile to
get this list (globbing and regex switches didn't help, dunno why), so I
only counted .timer files present in /usr/lib/systemd/system/.

$ pacman -Qo /usr/lib/systemd/system/*.timer
/usr/lib/systemd/system/fstrim.timer is owned by util-linux 2.25.1-1
/usr/lib/systemd/system/logrotate.timer is owned by logrotate 3.8.7-3
/usr/lib/systemd/system/man-db.timer is owned by man-db 2.6.7.1-1
/usr/lib/systemd/system/mdadm-last-resort at .timer is owned by mdadm 3.3.1-2
/usr/lib/systemd/system/shadow.timer is owned by shadow 4.2.1-1
/usr/lib/systemd/system/systemd-readahead-done.timer is owned by systemd
216-3
/usr/lib/systemd/system/systemd-tmpfiles-clean.timer is owned by systemd
216-3

Currently, three timers are statically enabled via symlinks in
/usr/lib/systemd/system/multi-user.target.wants/ after install
(logrotate.timer, man-db.timer and shadow.timer), while as already said
systemd-tmpfiles-clean.timer is statically enabled via a symlink in
/usr/lib/systemd/system/timers.target.wants/ (seemingly respecting new
practice). On the other hand, util-linux' fstrim.timer, when enabled via
systemctl, gets symlinked in /etc/systemd/system/multi-user.target.wants/.

Other packages not part of base like extra/pkgstats or extra/mlocate
also provide timers that once enabled, get symlinked to
/usr/lib/systemd/system/multi-user.target.wants/.

So AFAICT, there are quite some discrepancies concerning how systemd
timers are implemented. I'd like to discuss whether Arch should switch
default timers target for packages in base group from multi-user.target
to timers.target, possibly doing so for other packages in official repos.

Cheers,
Neitsab


More information about the arch-general mailing list