[systemd-devel] systemd-timesyncd with read-only root filesystem

Tomasz Torcz tomek at pipebreaker.pl
Fri Dec 9 11:49:17 UTC 2016


On Fri, Dec 09, 2016 at 10:46:51AM +0100, André Hartmann wrote:
> Hi Martin,
> 
> thanks for keeping our dialog alive :)
> 
> To sum up again what I actually want to achive:
> 
> I want to use NTP after bootup by default, but in case no NTP is available,
> the user should be able to set the date and time by hand
> with timedatectl. But timedatectl refuses to do so, if "NTP is enabled".
> 
> And this is my main problem: I don't know how timedatectl decides
> if NTP is enabled or not.

  Just use the source code? Anyway, if you use systemd's implementation
of that API (systemd-timesyncd), the check is here:
https://github.com/systemd/systemd/blob/master/src/timedate/timedated.c#L180

i.e. timedated checks if systemd-timesyncd is enabled.

  If you use other implementations, the check can be different.
For example timedatex checks if any of units listed in
/etc/systemd/ntp-units.d:/usr/lib/systemd/ntp-units.d
is enabled.

  Implementation in systembsd runs "/etc/rc.d/ntpd status" and checks status.

  And so on.

-- 
Tomasz   .. oo o.   oo o. .o   .o o. o. oo o.   ..
Torcz    .. .o .o   .o .o oo   oo .o .. .. oo   oo
o.o.o.   .o .. o.   o. o. o.   o. o. oo .. ..   o.



More information about the systemd-devel mailing list