Red Hat Bugzilla – Bug 885770
Chrony not always setting hw clock correctly
Last modified: 2012-12-13 05:24:41 EST
Description of problem:
Chrony can fail to set the hardware clock leading to incorrect time on boot, in my case off by one hour after a DST change.
Version-Release number of selected component (if applicable):
How reproducible: Always
Steps to Reproduce:
1. Set hardware clock to incorrect value.
2. reboot system
(Actual problem was likely a result of DST change not being written to HW, that
likewise could be reproduced, but requires more effort.)
The hardware clock remains at the set value, though system time is corrected.
Hardware clock adjusted to system time, or UTC if configured.
I only noticed this due to a sort of race condition, I have cacti polling from this machine on a one minute interval. chronyd starts before cron, but it did not complete the time adjustments before cron ran the poller script, which inserted a poller_lastrun value 45 minutes into the future into the cacti DB and stopping polling either until adjusted or 45 minutes had elapsed.
I looked for a chronyd file in /etc/sysconfig but it's use seems to have been depreciated when looking at rpm spec files and in it's systemd script so there seems to be no way to easily test changing it's startup options.
I installed adjtimex to see if it will be used, that is not clear in documentation I was able to locate, if it does perhaps this is just a packaging problem and adjtimex needs to be included when chronyd is installed?
I'm assuming this is with the default chrony configuration, which uses the rtcsync directive. Please let me know if chrony is configured with the rtcdrift directive instead, that would be a different bug.
With rtcsync, chronyd only tells the kernel that the system clock is synchronized and it's up to the kernel to correct the RTC. Unfortunately, the kernel doesn't care about timezones or DST and it's not able the fix the one hour error. This used to be handled by synchronizing the RTC from system clock on every shutdown/reboot, but that was for some strange reasons removed. Please see the bug #816752.
adjtimex is a system call and also a package which uses the system call. chrony cares only about the system call, which is always present (it's in the kernel).
*** This bug has been marked as a duplicate of bug 816752 ***
The chronyd configuration file is /etc/chrony.conf.