Bug 1785488

Summary: Consider ntpd when showing time synchronization status
Product: Red Hat Enterprise Linux 7 Reporter: John <jss>
Component: cockpitAssignee: Martin Pitt <mpitt>
Status: CLOSED DUPLICATE QA Contact: Release Test Team <release-test-team-automation>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.7CC: mlichvar
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-24 16:52:48 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:
Attachments:
Description Flags
Cockpit web UI showing exclamation mark to (incorrectly) indicate time is not synchronised. none

Description John 2019-12-20 02:28:23 UTC
Created attachment 1646726 [details]
Cockpit web UI showing exclamation mark to (incorrectly) indicate time is not synchronised.

Description of problem:
Cockpit says time is not synchronised, when in fact, it is

Version-Release number of selected component (if applicable):

# rpm -qa | grep cockpit | sort
cockpit-195.1-1.el7.x86_64
cockpit-bridge-195.1-1.el7.x86_64
cockpit-system-195.1-1.el7.noarch
cockpit-ws-195.1-1.el7.x86_64

# rpm -qa | grep ntp | sort
fontpackages-filesystem-1.44-8.el7.noarch
ntp-4.2.6p5-29.el7.x86_64
ntpdate-4.2.6p5-29.el7.x86_64


How reproducible:
Don't know.

Steps to Reproduce:
1. Install cockpit, ntpd, synchronise time
2. Watch cockpit fail.
3.

Actual results:
Cockpit shows red exclamation mark next to system time, mouseover says "Not Synchronised"

Expected results:
Time IS synchronised, so there should be no false warning in Cockpit.

Actually, to be honest, I do not EVER expect ANYTHING to work in RHEL anymore.


Additional info:

Please see attached screenshot. I pressed reload just before taking the shot, so it was a freshly loaded page. 

I also ran the following command, before and after screenshot, confirming that time IS in fact, syncrhonised:

# ntpstat
synchronised to NTP server (10.255.0.11) at stratum 3
   time correct to within 63 ms
   polling server every 1024 s

Comment 2 Miroslav Lichvar 2020-03-24 11:16:46 UTC
How exactly is ntpd configured? Is the -x option specified in /etc/sysconfig/ntpd?

Comment 3 John 2020-03-24 13:42:40 UTC
Why does it matter whether -x is enabled or not?

The Cockpit Web UI has an indicator to indicate if the time is synchronised.
It is not an indicator to indicate if slew mode is enabled or disabled.
So, -x for slew mode is irrelevant.

This is all that is needed to see that there is a problem:

# ntpstat
synchronised to NTP server (10.255.0.11) at stratum 3
   time correct to within 63 ms
   polling server every 1024 s


ntpstat says "synchronised", Cockpit says the opposite.

Cockpit is wrong, and needs to be fixed.

Comment 4 Martin Pitt 2020-03-24 14:07:43 UTC
Sure, I'm just currently trying to evaluate where exactly the bug is, as I'm not famililar with chrony or ntpd, and how they are supposed to be integrated into systemd. cockpit currently gets this information from the "System clock synchronized" flag from `timedatectl` (not literally, it usees D-Bus, but timedatectl shows the same flag). At least chrony does not have an useful API (see bug 1330465), but ntpd at least has a command line API, so we could at least do a read-only check (and not change the setting).

Comment 5 Miroslav Lichvar 2020-03-24 14:46:06 UTC
(In reply to John from comment #3)
> Why does it matter whether -x is enabled or not?

ntpd running with the -x option doesn't tell the kernel that the clock is synchronized and timedated only uses the information returned by the kernel. It doesn't talk to ntpd or chronyd. This would be a duplicate of bug #1660846.

Comment 6 Martin Pitt 2020-03-24 16:52:48 UTC
Thanks Miroslav for the detailed explanation (especially in bug 1660846)! I learned something new today.

*** This bug has been marked as a duplicate of bug 1660846 ***