You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
timesyncd: Store last-known IP address of NTP server #34230
Commonly, all the NTP servers in timesyncd.conf are specified as domains names, however, there are some circumstances where DNS resolving fails meaning no NTP server can be contacted.
In the case of some DNS resolvers, this can actually be caused by the time being out of sync itself (usually in the case where the system has no functioning RTC clock to rely on at boot).
Describe the solution you'd like
To robustly handle hardware clock failure or DNS resolver failure/misconfiguration, it'd be useful if systemd-timesyncd could save the IP address of the last successfully connected to NTP server (e.g. /var/lib/systemd/timesync/last-known).
Then, if timesyncd fails to connect to any NTP servers after a timeout, the saved IP address could be attempted (with the appropriate log to warn admins that something isn't right with the system).
Note
I haven't considered the circumstances of how, when, or if the saved IP address should be cleared; I don't have any opinion on this part.
Describe alternatives you've considered
The other alternative I'm aware of is including IP addresses in the default FallbackNTP= list (which would be a per-distro responsibility), however, this would mean constantly needing to update the list whenever a server changes IP address, which for some network setups could be a frequent occurence.
The systemd version you checked that didn't have the feature you are asking for
In the case of some DNS resolvers, this can actually be caused by the time being out of sync itself (usually in the case where the system has no functioning RTC clock to rely on at boot).
systemd-timesyncd.service sets Environment=SYSTEMD_NSS_RESOLVE_VALIDATE=0. If systemd-resolved.service is running and nss-resolve is used in nsswitch.conf, then such failure should be ignored.
I guess the root cause of #34232 is something different.
To clarify, I'm not using systemd-resolved for the actual DNS record fetching, but instead, I'm pointing it to a loopback address of another DNS resolver (and that resolver does require the time to be synced at the protocol level as far as I know, aka. DNSCrypt).
Activity
yuwata commentedon Sep 2, 2024
systemd-timesyncd.service sets
Environment=SYSTEMD_NSS_RESOLVE_VALIDATE=0. If systemd-resolved.service is running and nss-resolve is used in nsswitch.conf, then such failure should be ignored.I guess the root cause of #34232 is something different.
Winterhuman commentedon Sep 2, 2024
To clarify, I'm not using
systemd-resolvedfor the actual DNS record fetching, but instead, I'm pointing it to a loopback address of another DNS resolver (and that resolver does require the time to be synced at the protocol level as far as I know, aka. DNSCrypt).