Repository navigation
Description
systemd version the issue has been seen with
239
Used distribution
Debian unstable
When testing Cockpit on Debian testing we noticed a timedated/timesyncd regression, apparently introduced in systemd 239. Debian testing is the only distribution that has 239 - Fedora 28, RHEL etc. all still have 238 where this problem does not occur.
Steps to reproduce the problem
Try to disable and re-enable NTP:
busctl call org.freedesktop.timedate1 /org/freedesktop/timedate1 org.freedesktop.timedate1 SetNTP bb false false
busctl get-property org.freedesktop.timedate1 /org/freedesktop/timedate1 org.freedesktop.timedate1 NTP
sleep 1
busctl call org.freedesktop.timedate1 /org/freedesktop/timedate1 org.freedesktop.timedate1 SetNTP bb true false
busctl get-property org.freedesktop.timedate1 /org/freedesktop/timedate1 org.freedesktop.timedate1 NTP
One would expect the output "false" and then "true". Sometimes the second property get is false initially, and then true, i. e. it can take some time to settle; that's fine. However, sometimes (in about one out of three runs for me) it doesn't become true even after several minutes.
When that happens, the D-Bus property is false, but timesyncd is running:
● systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2018-07-20 11:35:17 EDT; 39s ago
Docs: man:systemd-timesyncd.service(8)
Main PID: 8299 (systemd-timesyn)
Status: "Synchronized to time server 193.141.27.1:123 (0.debian.pool.ntp.org)."
Tasks: 2 (limit: 1152)
Memory: 948.0K
CGroup: /system.slice/systemd-timesyncd.service
└─8299 /lib/systemd/systemd-timesyncd
Jul 20 11:35:16 unassigned-hostname systemd[1]: Starting Network Time Synchronization...
Jul 20 11:35:17 unassigned-hostname systemd[1]: Started Network Time Synchronization.
Jul 20 11:35:17 unassigned-hostname systemd-timesyncd[8299]: Synchronized to time server 193.141.27.1:123 (0.debian.pool.ntp.org).
Interestingly, when I call timedatectl in this steady broken state, it initially agrees ("NTP service: inactive"), but a second or so later both the D-Bus property and the output of timedatectl NTP service: become true. So calling timedatectl somehow "tickles" timedated to update the property.
Activity
yuwata commentedon Jul 21, 2018
@martinpitt Could you test #9684?
martinpitt commentedon Jul 22, 2018
I looked at this more closely, and the underlying reason for our test failure is that
timedatednow sends out wrongPropertiesChangedsignals when changing NTP. This can be demonstrated with watching for these:(Note that
busctl --matchdoes not seem to actually work, so using good old dbus-monitor here). When disabling NTP, the property change is correct:But when enabling it, it's wrong:
At this point,
GetPropertyand the abovePropertiesChangeddisagree:This is true even with the fix from #9684.
[-]timedated SetNtp race condition[/-][+]timedated SetNtp: wrong PropertiesChanged value[/+]martinpitt commentedon Jul 22, 2018
I've now also seen the wrong PropertiesChanged value in the other direction: Disabling NTP sends a property change with value
true. I'll run a bisect now.martinpitt commentedon Jul 22, 2018
git bisect confirms that this is also related to commit 5d28074. Until then, the property changes were correct, that is the first bad commit.
bots: Add naughty override for systemd 239 SetNTP regression
martinpitt commentedon Jul 26, 2018
Works perfectly again now, thanks!
timedate: defer the property changed signal until job of starting/sto…
systemd: timedate - fix SetNtp: wrong PropertiesChanged value