Bug 1660846
Summary: | timedatectl shows NTP synchronized: no, while with ntpstat the server is synchronized | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Markus Schibli <mschibli> |
Component: | ntp | Assignee: | Miroslav Lichvar <mlichvar> |
Status: | CLOSED WONTFIX | QA Contact: | qe-baseos-daemons |
Severity: | medium | Docs Contact: | |
Priority: | unspecified | ||
Version: | 7.6 | CC: | dtardon, jss, systemd-maint-list, thozza, ysoni |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | x86_64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2019-06-27 11:47:46 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Markus Schibli
2018-12-19 11:09:33 UTC
The value for "NTP synchronized" is obtained by calling adjtimex() and then checking if the .status field of struct timex contains STA_UNSYNC. I assume it's ntpd that sets/unsets that flag... The -x option of ntpd disables the kernel discipline. The kernel doesn't know the system clock is synchronized by ntpd, and cannot report a synchronized status. timedatectl doesn't know anything about ntpd/chronyd and just looks at the kernel status. This may be unexpected, but it is working as designed. One possible solution would be to patch ntpd to use the ntp_adjtime() system function to just set the clock status and not control the clock when the -x option is enabled and ntpd uses adjtime() for controlling the clock. Here is a more detailed explanation of how it works: The kernel maintains an "unsynchronized" flag for the system clock. The timedatectl program from systemd will print "NTP synchronized: yes" only if this flag is cleared (set to zero). It doesn't support the protocol which ntpq and ntpstat use to query the state of ntpd. ntpd can control the system clock using two different system functions: - ntp_adjtime() enables a phase-locked loop implemented in the kernel (aka kernel discipline), which automatically corrects the frequency offset of the clock (drift) and it needs to be called only when a new measurement is made. It clears the "unsynchronized" flag in the kernel. The main limitation is that it cannot correct offsets larger than 0.5 seconds. - adjtime() is an older method, which makes a one-time adjustment of the clock (slew). It doesn't correct the frequency offset, so it needs to be called frequently to compensate for it, even when no measurement is made. It cannot clear the "unsynchronized" flag in the kernel, but it can correct any offset. ntpd can use ntp_adjtime() or adjtime(), but not both at the same time. By default it uses ntp_adjtime(). If the step threshold is set to a larger value than 0.5 seconds (e.g. by enabling the -x option), it has to switch to adjtime(), because ntp_adjtime() does not work with larger offsets. That means the kernel "unsynchronized" status will not be cleared and timedatectl will report "NTP synchronized: no" when ntpd is started with the -x option. Development Management has reviewed and declined this request. You may appeal this decision by reopening this request. *** Bug 1726671 has been marked as a duplicate of this bug. *** *** Bug 1726671 has been marked as a duplicate of this bug. *** *** Bug 1785488 has been marked as a duplicate of this bug. *** |