FS#30226 - [openntpd] systemd unit should depend on systemd-timedated-ntp.target
Attached to Project:
Community Packages
Opened by Rodrigo Rivas Costa (rodrigorc) - Saturday, 09 June 2012, 22:17 GMT
Last edited by Dave Reisner (falconindy) - Monday, 20 August 2012, 18:01 GMT
Opened by Rodrigo Rivas Costa (rodrigorc) - Saturday, 09 June 2012, 22:17 GMT
Last edited by Dave Reisner (falconindy) - Monday, 20 August 2012, 18:01 GMT
|
Details
Description:
Currently, openntpd (and maybe other NTP clients) ship with a openntpd.service file to be used with systemd. It contains: [Install] WantedBy=multi-user.target But according to http://www.freedesktop.org/wiki/Software/systemd/timedated it probably should contain instead: [Unit] BindTo=systemd-timedated-ntp.target [Install] WantedBy=systemd-timedated-ntp.target So that it can be controlled automatically using the systemd-timedated API (used by gnome-control-center, for example). Additional info: * openntpd 3.9p1-15 |
This task depends upon
Closed by Dave Reisner (falconindy)
Monday, 20 August 2012, 18:01 GMT
Reason for closing: Fixed
Additional comments about closing: Fixed the larger problem and added ntp-units.d files for ntp, openntpd, and chrony.
Monday, 20 August 2012, 18:01 GMT
Reason for closing: Fixed
Additional comments about closing: Fixed the larger problem and added ntp-units.d files for ntp, openntpd, and chrony.
Anyway, the systemd-timedated daemon doesn't even need to be started. You just need to enable the "systemd-timedated-ntp.target". This target is WantedBy multi-user.target, so any service that depends on it will be started automatically.
The systemd-timedated daemon is only used to enabe/disable the systemd-timedated-ntp.target via the DBus API.
Maybe the "systemd-timedated-ntp.target" should be enabled by default, I really can't tell. But IMHO, if you switch to systemd, it is better to switch to the systemd way of doing things.
[openntpd] systemd unit should depend on systemd-timedated-ntp.target
TIA!
No, this is completely false. It's entirely possible to use systemd, even with an NTP daemon, without ever having this extra daemon running.
> The systemd-timedated daemon is only used to enabe/disable the systemd-timedated-ntp.target via the DBus API.
It's meant as an abstraction for non-root users to be able to disable/enable NTP via dbus.
I see no problem with adding the BindTo= to pull in the extra target, but I'm not changing the WantedBy and forcing people to magically figure out that they need an extra target in order for their NTP daemon to start up as they expect.
> No, this is completely false. It's entirely possible to use systemd, even with an NTP daemon, without ever having this extra daemon running.
Of course it is possible. But, as I said before, unless you mask systemd-timedated.service, it will be started automatically whenever you open the gnome time/date applet, for example, but the "Use network time" switch will simply do nothing.
And also, the daemon is not needed at all for openntpd to be running: openntpd would depend on systemd-timedated-ntp.target, not systemd-timedated.service. They are 2 different units.
Naturally, anybody can copy the openntpd.service to /etc/systemd/system and edit it as they see fit. But we are talking about defaults here.
>> The systemd-timedated daemon is only used to enabe/disable the systemd-timedated-ntp.target via the DBus API.
> It's meant as an abstraction for non-root users to be able to disable/enable NTP via dbus.
Yes, an abstraction that simply will not work without my suggested changes.
> I see no problem with adding the BindTo= to pull in the extra target, [...]
But with BindTo= and without WantedBy=, that will make openntpd to stop whenever the DBus API tells it to, but not to start when it is needed again.
> but I'm not changing the WantedBy and forcing people to magically figure out that
> they need an extra target in order for their NTP daemon to start up as they expect.
Not so magically.
a) it can be said in the Wiki.
b) the GUI for "Use network time" will work automatically, instead of doing nothing.
c) it is obvious if you read the openntpd.service.
d) the systemd-timedated-ntp.target _could_ be enabled by default in systemd: openntpd.service is wanted by systemd-timedated-ntp.target; systemd-timedated-ntp.target is wanted by multi-user.target.
Note that the same is happening with other daemons... It took me a while to notice that I had to enable the bluetooth.target for the bluetooth.service to be started (BTW, I think it should be enabled by default, also). But that's the systemd way!
Really, without this configuration, the existence of systemd-timedated is just meaningless.
We'll need to ship a .list file with NTP implementations to denote valid NTP services, and that should just take care of this.
Relevant: http://cgit.freedesktop.org/systemd/systemd/commit/?id=b32d167503b0d98