Bug 2101063
| Summary: | when chronyd cannot reach sources at startup they remain offline | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | Andrew Schorr <ajschorr> |
| Component: | Documentation | Assignee: | Šárka Jana <sjanderk> |
| Documentation sub component: | default | QA Contact: | |
| Status: | CLOSED CURRENTRELEASE | Docs Contact: | |
| Severity: | unspecified | ||
| Priority: | high | CC: | bstinson, emartyny, jwboyer, mlichvar, rhel-docs, sjanderk |
| Version: | CentOS Stream | Keywords: | Documentation, Triaged |
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
| 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: | 2023-03-01 20:20:13 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
Andrew Schorr
2022-06-25 03:43:12 UTC
Is the network configured by NetworkManager? Static configuration or DHCP? There is a NetworkManager-dispatcher script (/usr/lib/NetworkManager/dispatcher.d/20-chrony-onoffline) which calls "chronyc onoffline" on some specific events. If the NTP sources remain in the offline state, that indicates it ran at least once when there was no route to the servers and it didn't run again when they become reachable. Yes. It is configured by NetworkManager. It is a static configuration using legacy-style /etc/sysconfig/network-scripts/ifcfg-* files. However, I am configuring static routes separately at a later stage. Maybe that's the problem. I guess that the "chronyc onoffline" command is getting called after NetworkManager brings up the interfaces but before the default route is in place. My solution was to add a dropin script for chronyd to start after the network was up. Is there some benefit to starting chronyd before network-online.target? Maybe this is a quirk of how I'm configuring routes, but isn't it actually a problem on any system that doesn't have a static routing configuration that is loaded by NetworkManager? What happens if a system is a router running quagga or FRRouting? In such a case, the route to the time servers may not become available until after a bit of a delay as routes are learned. Does chronyc stay stuck in that case? I did not have this issue in RHEL 8. Why isn't chronyc smart enough to retry contacting its sources periodically? chrony supports reference clocks and other modes of operation where it doesn't make sense to wait for the network connection. chronyd polls all online sources regularly. The point of switching the sources between the offline and online states is to minimize the time needed for a resync on machines that are only rarely or briefly connected to network. If you don't need that, you can disable the dispatcher script by adding a symlink to /dev/null: ln -s /dev/null /etc/NetworkManager/dispatcher.d/20-chrony-onoffline Otherwise you would need to be modify your scripts to run the chronyc onoffline command. With the routing daemons it probably won't work. It doesn't seem to be a common configuration, or at least I don't recall any bug reports. I'm not sure why it worked for you on RHEL8. Do you know what was the chrony package version and release? Note that servers specified by hostname are not switched to the offline state if their address is not resolved yet. If DNS depends on the same network route as NTP, this wouldn't be an issue. I use numeric IPv4 addresses in /etc/chrony.conf to avoid hostname lookup issues. On 8, I'm using chrony-4.1-1.el8.x86_64, but to be fair, I use the legacy network.service to bring up interfaces instead of NetworkManager, so that could affect the timing. I don't see a good solution as there are conflicting requirements, but I think it would be good to at least document how the dispatcher script can be enabled to keep the sources online. Agreed. Thanks for the explanation. For a site like mine where all of the clock sources are over the network, I think simply adding /etc/systemd/system/chronyd.service.d/after-network.conf is the simplest solution: [Unit] After=network-online.target Regards, Andy Closing on the current release. RHEL 9: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html-single/configuring_basic_system_settings/index#proc_disabling-a-chrony-dispatcher-script_using-chrony RHEL 8: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_basic_system_settings/index#proc_disabling-a-chrony-dispatcher-script_using-chrony |