Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#1008059: systemd-timesyncd restarted on every router advertisment

80 views
Skip to first unread message

Adam Dinwoodie

unread,
Mar 21, 2022, 12:30:03 PM3/21/22
to
Package: systemd-timesyncd
Version: 250.4-1
Severity: normal
Tags: ipv6

Dear Maintainer,

I'm seeing systemd restart systemd-timesyncd.service approximately every
10 seconds, lining up with when I see a log showing that my router has
advertised its IPv6 address.

If I run `journalctl -f`, the output is full of lines like the
following:

```
Mar 21 15:53:56 lucy.dinwoodie.org dhcpcd[452]: eth0: Router Advertisement from fe80::be99:11ff:fe69:4300
Mar 21 15:53:57 lucy.dinwoodie.org systemd[1]: Stopping Network Time Synchronization...
Mar 21 15:53:57 lucy.dinwoodie.org systemd[1]: systemd-timesyncd.service: Deactivated successfully.
Mar 21 15:53:57 lucy.dinwoodie.org systemd[1]: Stopped Network Time Synchronization.
Mar 21 15:53:57 lucy.dinwoodie.org systemd[1]: Starting Network Time Synchronization...
Mar 21 15:53:57 lucy.dinwoodie.org systemd[1]: Started Network Time Synchronization.
Mar 21 15:53:57 lucy.dinwoodie.org systemd-timesyncd[6426]: Initial synchronization to time server 162.159.200.1:123 (0.debian.pool.ntp.org).
Mar 21 15:54:06 lucy.dinwoodie.org dhcpcd[452]: eth0: Router Advertisement from fe80::be99:11ff:fe69:4300
Mar 21 15:54:07 lucy.dinwoodie.org systemd[1]: Stopping Network Time Synchronization...
Mar 21 15:54:07 lucy.dinwoodie.org systemd[1]: systemd-timesyncd.service: Deactivated successfully.
Mar 21 15:54:07 lucy.dinwoodie.org systemd[1]: Stopped Network Time Synchronization.
Mar 21 15:54:07 lucy.dinwoodie.org systemd[1]: Starting Network Time Synchronization...
Mar 21 15:54:07 lucy.dinwoodie.org systemd[1]: Started Network Time Synchronization.
Mar 21 15:54:07 lucy.dinwoodie.org systemd-timesyncd[6463]: Initial synchronization to time server 178.62.18.76:123 (0.debian.pool.ntp.org).
```

There's no great immediate impact, but it seems like this shouldn't be
happening. And there is clearly some impact in terms of unnecessary
disk churn, unnecessary network usage, unnecessary load on NTP servers,
and -- still minor, but most relevant to my immediate interests --
ability to spot interesting logs in journald.

Some searching online led me to a very old systemd bug[0], but that was
apparently resolved in systemd 219, so definitely shouldn't be relevant
now.

[0]: https://bugs.freedesktop.org/show_bug.cgi?id=87505

Other searches pointed me to other people reporting similar
problems[1][2] with no resolution. It's possibly of interest is that
they're all folk (like me) running on a Raspberry Pi. At least in my
case, however, I understand the only difference between what I'm running
and a regular arm64 Debian installation is that there are a few driver
and firmware packages shipped from the Raspberry Pi Foundation.
Certainly all the systemd packages I'm using have come straight from
deb.debian.org repositories.

[1]: https://raspberrypi.stackexchange.com/q/133605/145463
[2]: https://forums.raspberrypi.com/viewtopic.php?t=324473

Given that, I suspect whatever the issue is may be due to one or more of
(a) folks using Raspberry Pis are going to be running an arm-based
architecture, or (b) folks using Pis are more likely to be running very
minimal Debian installations, so are more likely to have not installed
packages that might not be listed as dependencies but whose absence
causes non-obvious problems.

Admittedly there's also (c) there's something up with the config that's
used on Raspberry Pis by default, but I've done my best to rule that
out: I can't see anything in the documentation for dhcpcd,
systemd-networkd or systemd-timesyncd that would cause this behaviour,
nor anything in any of the configuration in /etc/systemd/.

I'm seeing this behaviour on /bullseye (247.3-6), /bullseye-backports
(250.4-1~bpoll+1), and /sid (250.4-1).

-- System Information:
Debian Release: 11.2
APT prefers stable-updates
APT policy: (990, 'stable-updates'), (990, 'stable-security'), (990, 'stable'), (850, 'testing'), (500, 'unstable')
Architecture: arm64 (aarch64)
Foreign Architectures: armhf

Kernel: Linux 5.10.103-v8+ (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_CRAP
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages systemd-timesyncd depends on:
ii adduser 3.118
ii libc6 2.33-7
ii systemd 250.4-1

systemd-timesyncd recommends no packages.

systemd-timesyncd suggests no packages.

-- no debconf information

Michael Biebl

unread,
Mar 21, 2022, 12:40:04 PM3/21/22
to
Am 21.03.22 um 17:23 schrieb Adam Dinwoodie:
> Package: systemd-timesyncd
> Version: 250.4-1
> Severity: normal
> Tags: ipv6
>
> Dear Maintainer,
>
> I'm seeing systemd restart systemd-timesyncd.service approximately every
> 10 seconds, lining up with when I see a log showing that my router has
> advertised its IPv6 address.
>
> If I run `journalctl -f`, the output is full of lines like the
> following:
>
> ```
> Mar 21 15:53:56 lucy.dinwoodie.org dhcpcd[452]: eth0: Router Advertisement from fe80::be99:11ff:fe69:4300
> Mar 21 15:53:57 lucy.dinwoodie.org systemd[1]: Stopping Network Time Synchronization...
> Mar 21 15:53:57 lucy.dinwoodie.org systemd[1]: systemd-timesyncd.service: Deactivated successfully.
> Mar 21 15:53:57 lucy.dinwoodie.org systemd[1]: Stopped Network Time Synchronization.
> Mar 21 15:53:57 lucy.dinwoodie.org systemd[1]: Starting Network Time Synchronization...
> Mar 21 15:53:57 lucy.dinwoodie.org systemd[1]: Started Network Time Synchronization.
> Mar 21 15:53:57 lucy.dinwoodie.org systemd-timesyncd[6426]: Initial synchronization to time server 162.159.200.1:123 (0.debian.pool.ntp.org).
> Mar 21 15:54:06 lucy.dinwoodie.org dhcpcd[452]: eth0: Router Advertisement from fe80::be99:11ff:fe69:4300
> Mar 21 15:54:07 lucy.dinwoodie.org systemd[1]: Stopping Network Time Synchronization...
> Mar 21 15:54:07 lucy.dinwoodie.org systemd[1]: systemd-timesyncd.service: Deactivated successfully.
> Mar 21 15:54:07 lucy.dinwoodie.org systemd[1]: Stopped Network Time Synchronization.
> Mar 21 15:54:07 lucy.dinwoodie.org systemd[1]: Starting Network Time Synchronization...
> Mar 21 15:54:07 lucy.dinwoodie.org systemd[1]: Started Network Time Synchronization.
> Mar 21 15:54:07 lucy.dinwoodie.org systemd-timesyncd[6463]: Initial synchronization to time server 178.62.18.76:123 (0.debian.pool.ntp.org).
> ```


Is that a result of /etc/dhcp/dhclient-exit-hooks.d/timesyncd ?

What happens if you remove that dhclient hook

OpenPGP_signature

Michael Biebl

unread,
Mar 21, 2022, 12:50:04 PM3/21/22
to

Am 21.03.22 um 17:36 schrieb Michael Biebl:

> Is that a result of /etc/dhcp/dhclient-exit-hooks.d/timesyncd ?
>
> What happens if you remove that dhclient hook


Actually, I think it might be
dhcpcd5: /lib/dhcpcd/dhcpcd-hooks/64-timesyncd.conf

which triggers the service restart, i.e. it would be a dhcpcd5 issue.
OpenPGP_signature

Michael Biebl

unread,
Mar 21, 2022, 1:10:04 PM3/21/22
to
Control: reassign dhcpcd5

Am 21.03.22 um 17:39 schrieb Michael Biebl:
Reassigning accordingly.

# cat /lib/dhcpcd/dhcpcd-hooks/64-timesyncd.conf
# vi: ft=sh

SERVERFILE_IPV4="/run/systemd/timesyncd.conf.d/01-dhcpcd.ipv4.$interface.conf"
SERVERFILE_IPV6="/run/systemd/timesyncd.conf.d/01-dhcpcd.ipv6.$interface.conf"

reload_config() {
systemctl try-restart systemd-timesyncd.service || :
}

OpenPGP_signature

Adam Dinwoodie

unread,
Mar 21, 2022, 4:10:03 PM3/21/22
to
Fantastic, thank you! I've confirmed that replacing that line with a
simple `:` stops this behaviour.

Adam Dinwoodie

unread,
Mar 21, 2022, 4:20:03 PM3/21/22
to
And I think I've found the bug: the `add_servers` function in
60-ntp-common.conf attempts to work out if it needs to rebuild the
server file, and only actually rebuild and reload the configuration if
it's necessary. But the test it uses doesn't work when there are no
configured NTP servers, such as because someone is using SNTP with
systemd-timesyncd and the default Debian time server.

I think the patch below should resolve this:

diff -ur old/60-ntp-common.conf new/60-ntp-common.conf
--- old/debian/hooks/60-ntp-common.conf 2022-03-21 19:49:03.518699860 +0000
+++ new/debian/hooks/60-ntp-common.conf 2022-03-21 19:51:32.216039388 +0000
@@ -3,6 +3,8 @@
add_servers() {
if [ -f "$SERVERFILE" ] && [ "$new_ntp_servers" = "$old_ntp_servers" ]; then
return
+ elif [ ! -f "$SERVERFILE" ] && [ -z "$new_ntp_servers" ]; then
+ return
fi

rm -f "$SERVERFILE"
0 new messages