Re: [chrony-users] Chrony setup using RTC as fallback

[ Thread Index | Date Index | More Archives ]

Thanks Miroslav,
comments are inline below.

Il 18/11/2015 11:33, Miroslav Lichvar ha scritto:
On Wed, Nov 18, 2015 at 12:04:07AM +0100, Mauro Condarelli wrote:
I have an embedded system (ARM9/Buildroot) that may or may not be connected to the Internet (usually it is, but it should work also in "detached" mode; connection may come up a long time after boot).

I need to /ensure/ dates are strictly monotonic; no "jump back" larger then one second should be allowed.

The system is equipped with an RTC performing reasonably well.

My current configuration is as follows (see below), but it doesn't seem to work very well: sometimes, even if connected, it takes several minutes to switch from "default" date (Jan 2007) to the correct one.
That sounds like initstepslew didn't work (maybe chronyd was started
before network was up?), and it took 3 polls at 64s interval before
the clock was updated.
Indeed chrony is started before net has any chance to go up.
Not this setup should work reasonably (*main* requirement is to have monotonic time across boots!) even when not connected to any net.

My recommendation would be to drop the initstepslew directive and
instead use the burst command when the network is up.
I am doing that now.
In general workflow at boot should be as follows:

1) boot (obviously ;) )
2) read sysclock from RTC (ASAP! before network connection goes up)
3) read last recorded time and, IF later than sysclock THEN sysclock = last recorded time + 1sec.
The -s option should do 2) and 3). (although there is no +1 sec added
to the recorded time).
That should already be in place.
The +1sec. is not really important.

4) wait for network to go up
5) sync time THEN
5.1) IF net time > sysclock THEN sysclock = net time
5.2) IF net time < sysclock THEN slow sysclock TILL sysclock == net time
chronyd has only one step threshold for both directions, so you would
probably need to remove the makestep directive from the config and do
that step manually in the "up" script instead. E.g.
I assume You mean to add it to dhcpcd "BOUND" signal, right?

chronyc online
chronyc burst 4/4
sleep 10
chronyc tracking | grep -q 'System time.*slow' && chronyc makestep
Added, even if it's unclear to me what this burst command really does (I read the Manual!).

At shutdown time sysclock should be saved.
When chronyd exits it touches the driftfile.

I am testing now...
Thanks Again

To unsubscribe email chrony-users-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject. For help email chrony-users-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.

Mail converted by MHonArc 2.6.19+