[chrony-users] Question about chrony use in a system without RTC battery

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


I have a question regarding Chrony use in (Yocto-based) systems that
have no RTC battery, or at least a very short-lived one. The devices
I'm working with regularly have unstable internet connections, and
sometimes lose power all of the sudden (clearing the RTC value).

My main goal is to prevent the system time to jump back. My
application data recording mechanism assumes time to increase
monotonously, and a jump back in time will prevent my application from
writing any data. In a case of a temporary poweroff + RTC value loss,
I'd rather have an erroneous time indication that disregards the
outage time, but at least does not jump back in time. In any normal
situation NTP is always enabled and the internet connection is stable,
but power outages do happen.

I've been testing with Chrony which seems like the right tool for the
job. The NTP synchronization works really well, but I can't seem to
get the power loss situation covered well.

My /etc/chrony.conf looks like this:

include /etc/chrony.d/00-custom.conf

pool 0.pool.ntp.org iburst
pool 1.pool.ntp.org iburst
pool 2.pool.ntp.org iburst
pool 3.pool.ntp.org iburst

makestep 1.0 3
driftfile /var/lib/chrony/drift
rtcfile /var/lib/chrony/rtc
rtcautotrim 1
dumpdir /var/lib/chrony
logdir /var/log/chrony
log tracking

The extra configuration file '/etc/chrony.d/00-custom.conf' is empty
for now, but lives in persistent memory, the root filesystem is
readonly. Of course /var is writable too.

I'm using systemd as the startup management system, and have chronyd
set to start up with "-s -r":

$ cat /etc/default/chronyd
export OPTIONS='-s -r'

This will pass the $OPTIONS to the system service file. But I don't
really know how to verify this.

My observation with power loss simulations is that the system keeps on
jumping back in time (~a week). What I do is I break the internet
connection such that the NTP synchronization is lost, then pull the
power plug, re-insert the power plug (but leave the internet
connection broken). As far as I could read in the documentation,
Chrony should be able to pick up the last modification time from the
driftfile, but this file is not always there. Is there some other way
to force resetting the time at boot to the last modification time
until NTP synchronization is restored?

Any help is appreciated, thanks in advance!

Kind regards,

Kris van Rens

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/