I just updated my server that runs Guix and after rebooting I see ntpd
crash repeatedly.  Full log excerpt at the end of this message, but the
crucial bit is:

2025-03-16 22:15:23 localhost ntpd[135]: Listen and drop on 0 v6wildcard 
[::]:123
2025-03-16 22:15:23 localhost ntpd[135]: Listen and drop on 1 v4wildcard 
0.0.0.0:123
2025-03-16 22:15:23 localhost ntpd[135]: Listen normally on 2 lo 127.0.0.1:123
2025-03-16 22:15:23 localhost ntpd[135]: Listen normally on 3 eth0 w.x.y.z:123
2025-03-16 22:15:23 localhost ntpd[135]: Listen normally on 4 lo [::1]:123
2025-03-16 22:15:23 localhost ntpd[135]: bind(21) AF_INET6 
[2a00:nn:nn:nn::1]:123 flags 0x11 failed: Cannot assign requested address
2025-03-16 22:15:23 localhost ntpd[135]: unable to create socket on eth0 (5) 
for [2a00:nn:nn:nn::1]:123
2025-03-16 22:15:23 localhost linux: [    6.003539] ntpd[135]: segfault at 24 
ip 0000628abeb0829b sp 00007ffe175a9a90 error 4 in 
ntpd[7f29b,628abea9b000+86000] likely on CPU 0 (core 0, socket 0)

It's trying to bind a listening socket to a specific IPv6 address and
failing because that interface isn't all the way up yet (yet somehow it
is up enough to know what its assigned IPv6 address *is*? I didn't
realize that was possible).  That is then causing ntpd to crash.  I'm
confident that the crash is because of the failure to bind the socket,
because when I manually restarted the daemon, after the system had been
running for a while, it came up fine:

2025-03-16 22:21:39 localhost ntpd[360]: Listen and drop on 0 v6wildcard 
[::]:123
2025-03-16 22:21:39 localhost ntpd[360]: Listen and drop on 1 v4wildcard 
0.0.0.0:123
2025-03-16 22:21:39 localhost ntpd[360]: Listen normally on 2 lo 127.0.0.1:123
2025-03-16 22:21:39 localhost ntpd[360]: Listen normally on 3 eth0 w.x.y.z:123
2025-03-16 22:21:39 localhost ntpd[360]: Listen normally on 4 lo [::1]:123
2025-03-16 22:21:39 localhost ntpd[360]: Listen normally on 5 eth0 
[2a00:nn:nn:nn::1]:123
2025-03-16 22:21:39 localhost ntpd[360]: Listen normally on 6 eth0 
[fe80::xx:xx:xx:xx%2]:123
2025-03-16 22:21:39 localhost ntpd[360]: Listening on routing socket on fd #23 
for interface updates
2025-03-16 22:21:40 localhost ntpd[360]: Soliciting pool server 
2a00:da00:1800:837c::1
[etc]

This is at least three bugs:

* ntpd should not *crash* just because it failed to bind a
  listening socket.
* shepherd should know that ntpd needs to bind specific listening
  sockets and should not start it until that is actually possible
* in the default client-only configuration, ntpd should not need to bind
  specific listening sockets in the first place, it should just listen on
  the wildcard address(es)!

Are any of these bugs already known?  What is the preferred way to
report a set of interrelated bugs like these?

I have not modified the ntp service in my (operating-system) spec,
and the generated ntp.conf looks completely stock:

driftfile /var/run/ntpd/ntp.drift
pool 2.guix.pool.ntp.org iburst
# Disable status queries as a workaround for CVE-2013-5211:
# 
<http://support.ntp.org/bin/view/Main/SecurityNotice#DRDoS_Amplification_Attack_using>.
restrict default kod nomodify notrap nopeer noquery limited
restrict -6 default kod nomodify notrap nopeer noquery limited
# Yet, allow use of the local 'ntpq'.
restrict 127.0.0.1
restrict -6 ::1
# This is required to use servers from a pool directive when using the 'nopeer'
# option by default, as documented in the 'ntp.conf' manual.
restrict source notrap nomodify noquery

Full crash log:

2025-03-16 22:15:23 localhost shepherd[1]: Starting service ntpd...
2025-03-16 22:15:23 localhost shepherd[1]: Service ntpd started.
2025-03-16 22:15:23 localhost shepherd[1]: Service ntpd running with value 
#<<process> id: 135 command: ("/gnu/store/hzs
ra0k8jcz4473c6clh5m5xfq29s0a0-ntp-4.2.8p18/bin/ntpd" "-n" "-c" 
"/gnu/store/7ac2i2c6dp2f9006llg3m5vkrna7pjbf-ntpd.conf" "
-u" "ntpd" "-g")>.
2025-03-16 22:15:23 localhost shepherd[1]: Service ntpd has been started.
2025-03-16 22:15:23 localhost ntpd[135]: ntpd 4.2.8p18@1.4062-o Thu Jan  1 
00:00:01 UTC 1970 (1): Starting
2025-03-16 22:15:23 localhost ntpd[135]: Command line: 
/gnu/store/hzsra0k8jcz4473c6clh5m5xfq29s0a0-ntp-4.2.8p18/bin/ntpd
 -n -c /gnu/store/7ac2i2c6dp2f9006llg3m5vkrna7pjbf-ntpd.conf -u ntpd -g
2025-03-16 22:15:23 localhost ntpd[135]: 
----------------------------------------------------
2025-03-16 22:15:23 localhost ntpd[135]: ntp-4 is maintained by Network Time 
Foundation,
2025-03-16 22:15:23 localhost ntpd[135]: Inc. (NTF), a non-profit 501(c)(3) 
public-benefit
2025-03-16 22:15:23 localhost ntpd[135]: corporation.  Support and training for 
ntp-4 are
2025-03-16 22:15:23 localhost ntpd[135]: available at 
https://www.nwtime.org/support
2025-03-16 22:15:23 localhost ntpd[135]: 
----------------------------------------------------
2025-03-16 22:15:23 localhost ntpd[135]: DEBUG behavior is enabled - a 
violation of any diagnostic assertion will cause
ntpd to abort
2025-03-16 22:15:23 localhost shepherd[1]: Starting service term-console...
2025-03-16 22:15:23 localhost shepherd[1]: Service term-console started.
2025-03-16 22:15:23 localhost ntpd[135]: proto: precision = 0.178 usec (-22)
2025-03-16 22:15:23 localhost ntpd[135]: baseday_set_day: invalid day (25556), 
UNIX epoch substituted
2025-03-16 22:15:23 localhost ntpd[135]: basedate set to 1970-01-01
2025-03-16 22:15:23 localhost ntpd[135]: gps base set to 1980-01-06 (week 0)
2025-03-16 22:15:23 localhost ntpd[135]: Listen and drop on 0 v6wildcard 
[::]:123
2025-03-16 22:15:23 localhost ntpd[135]: Listen and drop on 1 v4wildcard 
0.0.0.0:123
2025-03-16 22:15:23 localhost ntpd[135]: Listen normally on 2 lo 127.0.0.1:123
2025-03-16 22:15:23 localhost ntpd[135]: Listen normally on 3 eth0 w.x.y.z:123
2025-03-16 22:15:23 localhost ntpd[135]: Listen normally on 4 lo [::1]:123
2025-03-16 22:15:23 localhost ntpd[135]: bind(21) AF_INET6 
[2a00:nn:nn:nn::1]:123 flags 0x11 failed: Cannot assign requested address
2025-03-16 22:15:23 localhost ntpd[135]: unable to create socket on eth0 (5) 
for [2a00:nn:nn:nn::1]:123
2025-03-16 22:15:23 localhost linux: [    6.003539] ntpd[135]: segfault at 24 
ip 0000628abeb0829b sp 00007ffe175a9a90 error 4 in 
ntpd[7f29b,628abea9b000+86000] likely on CPU 0 (core 0, socket 0)
2025-03-16 22:15:23 localhost linux: [    6.003555] Code: 8b 04 25 28 00 00 00 
48 89 44 24 08 31 c0 e8 dc 2d f9 ff 44 8b 28 48 89 c5 e8 61 9e ff ff 49 89 c4 
48 85 db 0f 84 e5 00 00 00 <44> 0f b7 0b 66 41 83 f9 02 0f 84 f6 00 00 00 66 41 
83 f9 0a 74 57
2025-03-16 22:15:23 localhost shepherd[1]: Service ntpd (PID 135) terminated 
with signal 11.
2025-03-16 22:15:23 localhost shepherd[1]: Respawning ntpd.
[repeat several times]
2025-03-16 22:15:24 localhost shepherd[1]: Service ntpd has been disabled.
2025-03-16 22:15:24 localhost shepherd[1]:   (Respawning too fast.)

Reply via email to