Time and date resets at boot

Topics about the Software of Revolution Pi
Post Reply
alf@emcom.no
Posts: 20
Joined: 25 Sep 2018, 10:17
Answers: 0

Time and date resets at boot

Post by alf@emcom.no »

I have a few RevPi Connects, and they now started setting the date 3 months back.
Every time I boot - the clock goes back to april 6'th 10:58:35.
I noticed that if I did # timedatectl set-ntp true - the time would NOT be reset through a boot.

What would you recommend to ENSURE that the clock/system time stays correct no matter what ?
alf@emcom.no
Posts: 20
Joined: 25 Sep 2018, 10:17
Answers: 0

Re: Time and date resets at boot

Post by alf@emcom.no »

I now have new input on this.
On a RevPi where I ran "timedatectl set-ntp false" and it ran ok in lab for a couple of days.

When it was deployed in real installation - a tech connected PC via eth B and saw the date was correct, but the RJ45 connector was not properly inserted/secured, so it popped out again.
When he got to reattaching the cable and logged in again, the date was changed to last timedate that was set doing "timedatectl set-time".

I really need help coping with this.
User avatar
lukas
Expert
Posts: 186
Joined: 13 Feb 2017, 10:29
Answers: 0

Re: Time and date resets at boot

Post by lukas »

All our products have a super capacitor to supply power to the real time clock for a couple of hours (about a day actually). If the machine is detached from a power source for a longer period of time, the supercap will drain, the RTC will lose power and the time will be lost. I believe the use of a supercap instead of a battery was a deliberate decision to avoid having to ever open the case for battery replacement over a lifetime of potentially decades. The expectation is that the machines are usually powered 24/7 and that any power outages would normally not exceed several hours.

Once the RTC has lost power, the time will be reset on boot to the release date of systemd. You can then set the clock automatically via NTP (which is enabled by default in our image) or by attaching a GPS or DCF77 receiver. Alternatively, disable ntp and set the clock manually using timedatectl(1).

What you've reported in your post of Oct 23 sounds like the machines were removed from a power source for a sufficiently long period of time such that the supercap was drained. After enabling ntp, they picked up the correct time on boot.

I'm somewhat confused about what you reported in your post of Oct 29. You've disabled ntp, set the time manually and it later jumped back to the manually assigned time? That would be odd indeed.
User avatar
p.rosenberger
KUNBUS
Posts: 89
Joined: 03 Jul 2020, 11:07
Answers: 1

Re: Time and date resets at boot

Post by p.rosenberger »

I know it is almost a year since this was discussed, but for everyone who finds this.
On system boot systemd (timesyncd) will check the file /var/lib/systemd/clock (with newer versions of systemd: /var/lib/systemd/timesync/clock) and checks the file modification date/time.
https://www.freedesktop.org/software/sy ... rvice.html

The file gets updated on every sysnc from an ntp.
Post Reply