[chrony-users] Question about chrony use in a system without RTC battery |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-users Archives
]
- To: chrony-users@xxxxxxxxxxxxxxxxxxxx
- Subject: [chrony-users] Question about chrony use in a system without RTC battery
- From: Kris van Rens <kris.van.rens@xxxxxxxxxxx>
- Date: Wed, 9 Mar 2022 15:36:34 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vinotion-nl.20210112.gappssmtp.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=ogeJsF/bRk7iGn4Y372qrZOV8p/+mPetOSEIj/sVkdk=; b=7KYX8XVa6yluESsz4UcBHreDeMblU0doDGDFftXP3gPsKBrFfshtMOGiVZQrGNFmpC lrBTq87JHlRk2X95Ntv4I3Dmm5NRL8jfMqPrJXT9XhAG3WDThoXytHU/qBZMWhgtodIl IZhSuiJE0nuGx2uANVtS3Mg9M5NJF+eCcAcOjNZ+4fMOkFTszkS+6SEUl5cldbPGwTex gqbAc+ITMeqx18dAlRCVWf0O0LSf/PYfsviY6LJOppATEf/eDRxzBRg47u5NOvt++axS Y4lq4p8pXIXh8KndYOZZK1F/J08C8ZLUrddfSsfII0d352N2pD0ahcgm6G8wawcY1vXE px1Q==
Hello!
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.