Re: [chrony-users] systemd-time-wait-sync and chrony

2021-03-16 Thread Miroslav Lichvar
On Tue, Mar 16, 2021 at 03:41:01AM +, Ryan Govostes wrote:
> As a fallback for alternatives like chrony, it does some trick where it 
> creates a timer which the kernel cancels when the clock is synchronized. But 
> the documentation cautions that this is not necessarily reliable.
> 
> https://github.com/systemd/systemd/pull/8494/files
> 
> Does this work well with chrony? Or is there a better way to set up 
> time-sync.target?

I doubt it works well with chrony. One issue is that chronyd may not
step the clock if the initial offset is too small. You would need to
specify a zero threshold for makestep. A bigger issue is that the
clock status is set separately, after setting the clock, so there is a
race between chronyd setting the clock status and waitsync checking
it. time-wait would need to check the status periodically.

Use the chronyc waitsync command instead. There is an example
chrony-wait service in the examples directory in the chrony sources
using that command. It's packaged in some distros.

-- 
Miroslav Lichvar


-- 
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org 
with "unsubscribe" in the subject.
For help email chrony-users-requ...@chrony.tuxfamily.org 
with "help" in the subject.
Trouble?  Email listmas...@chrony.tuxfamily.org.



[chrony-users] systemd-time-wait-sync and chrony

2021-03-15 Thread Ryan Govostes
I use chrony to synchronize an embedded system’s clock. There are 
systemd-controlled services on the system that I’d like to configure to wait 
until the system clock is synchronized.

I can order these services to start after time-sync.target, but I need some 
other service to start *before* time-sync.target and delay it until the clock 
is synchronized.

There is systemd-time-wait-sync.service for exactly this purpose:

https://www.freedesktop.org/software/systemd/man/systemd-time-wait-sync.service.html#

However, it is designed for systemd-timesyncd to send it a signal directly when 
the clock is synchronized.

As a fallback for alternatives like chrony, it does some trick where it creates 
a timer which the kernel cancels when the clock is synchronized. But the 
documentation cautions that this is not necessarily reliable.

https://github.com/systemd/systemd/pull/8494/files

Does this work well with chrony? Or is there a better way to set up 
time-sync.target?


Thanks,
Ryan