Time resets

AlfEMann

New Member
I have the weirdest issue that I hope someone can help solve and/or prevent.
I used a ruggedized version of Raspberry Pi (with clock, battery, extended voltage etc etc) to make a (specialized) Modbus logger in a semi-harsh environment with no hope of getting internet access.

I rely on cronjobs to actually do stuff, and so it is important that time is more or less correct - or at least linear.
The problem is that we discovered that a few of these machines set the clock a date long past. This seemed to happen very randomly, and only after a few months running.
I got hold of a couple and saw that indeed - everytime I booted, the time&date was now reset.
I wasn't quite sure what the problem might be, but I found out that if I did a "timedatectl set-ntp false" it would no longer reset the time when booted.
After making this correction we redeployed, but a coworker now saw the following ;
He logged in with an ethernet cable in eth1 (device has 2 eths and eth1 is ment for LAN) and saw that the date was correct, just before the RJ45 slipped out.
He reattached the ethernet cable and made sure to push it far enough in this time, but now, the clock had reset itself to the last time set manually by me (timedatectl set-time....).

Does anyone have any inkling on how that could happen, and how I can prevent this from happening again ?

Best regards, Alf.
 


poorguy

Well-Known Member

AlfEMann

New Member
Thanks Poorguy, but the last observation was with a device set to UTC (which is just the timezone and shouldn't really have any bearing on what we are experiencing ?).
 

JulienCC

Active Member
This is most likely and NTP problem. What happened with the ethernet cable lets me think that it's not a hardware clock failure.

I wasn't quite sure what the problem might be, but I found out that if I did a "timedatectl set-ntp false" it would no longer reset the time when booted.
You disabled NTP at that time, which is good, but this command doesn't make permanent changes. NTP client is set by some systemd configurations files, and systemd will apply these configurations depending on various events, including network state change.

To fully permanently disable NTP, use these commands :
Code:
# systemctl stop systemd-timesyncd
# systemctl disable systemd-timesyncd
EDIT : also make sure that there is not explicit NTP client commands in /etc/network/interfaces or /etc/network/interfaces.d
 



Members online



Top