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

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-users Archives ]




William G. Unruh   |  Canadian Institute for|     Tel: +1(604)822-3273
Physics&Astronomy  |     Advanced Research  |     Fax: +1(604)822-5324
UBC, Vancouver,BC  |   Program in Cosmology |     unruh@xxxxxxxxxxxxxx
Canada V6T 1Z1     |      and Gravity       |  www.theory.physics.ubc.ca/

On Wed, 18 Nov 2015, 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.

I presume you mean after the intial boot, because the clock could be way out
at boot.


The system is equipped with an RTC performing reasonably well.

Which means what?


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.

It sounds like the initialization is not being done.


In general workflow at boot should be as follows:

1) boot (obviously ;) )
2) read sysclock from RTC (ASAP! before network connection goes up)

Usually done via hwclock not chrony.

3) read last recorded time and, IF later than sysclock THEN sysclock = last recorded time + 1sec.

Again could be done with an init script.

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

Tell chrony not to step.


At shutdown time sysclock should be saved.

You mean rtc should be set from system clock I presume. Although chrony does
not really require this.


I understand all this should be possible with chrony, but I didn't find the right spell.

Can someone help me? I'm lost in a maze of twisting little options, all conflicting!

TiA!

==== chrony.conf ====

|initstepslew 30 2.it.pool.ntp.org 0.pool.ntp.org 1.pool.ntp.org server 0.it.pool.ntp.org offline server 1.it.pool.ntp.org offline server 2.pool.ntp.org offline server 3.pool.ntp.org offline logdir /var/log/chrony log rtc statistics measurements tracking logchange 1 driftfile /var/lib/chrony/drift keyfile /etc/chrony.keys generatecommandkey makestep 1.0 3 maxupdateskew 100.0 dumponexit dumpdir /var/lib/chrony rtconutc rtcautotrim 1 rtcfile /var/lib/chrony/rtc |

Aaaghaloop. I do hope that is not what your chrony.conf actually looks like--
one horrible long line (My pine has chopped it into line. What I saw in your
post was one Looooooooooong line.)
You need the various things each on their own line. And initstepslow say the clock is supposed to be stepped, not slewed if the
time is out by more than 30 sec.

And note that offline means that the source is NOT queried until you put it
online. The online and offline are iprviledged commands which will only work after
you have given a password. (use chrony-helper if you are running this as root)
Either use chrony-helper or use the -a option to chrony down below.




==== dhcpd.conf ====

|hostname duid persistent option rapid_commit option domain_name_servers, domain_name, domain_search, host_name option classless_static_routes option ntp_servers require dhcp_server_identifier nohook lookup-hostname ipv4only background release timeout 0 |

==== dhcpd.enter-hook ====

|#!/bin/ash #echo >>/tmp/log "********* $interface : $reason *********" |

==== dhcpd.exit-hook ====

|#!/bin/ash case $reason in NOCARRIER) # echo >>/tmp/log "--------- chrony offline ---------" /usr/bin/chronyc offline ;; BOUND) # echo >>/tmp/log "--------- chrony online ---------" /usr/bin/chronyc online ;; esac |



--
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+ http://listengine.tuxfamily.org/