Package: chrony
Version: 4.6.1-3+deb13u1
Severity: normal
X-Debbugs-Cc: [email protected]

I’ve found out that sometimes, networking.service is failed after boot
because the if-up.d snippet runs “chronyc onoffline”, returning
“501 Not authorised” and a nōn-zero exit status.

This is because its service file has no dependency either way on
the network being up (apparently, chrony can be started before that
relying on chronyc to register ifstate changes?) so chrony is sometimes
started in the same second as that command runs and then is in a state
where it accepts the chronyc command but refuses it, instead of e.g.
keeping it in a queue until ready to serve it.

I’ve solved this locally by changing the if-up.d script to retry with
backoff, but would welcome an official fix or workaround.

│       #!/bin/bash
│
│       test -x /usr/sbin/chronyd || exit 0
│       test -e /run/chrony/chronyd.pid || exit 0
│
│       chronyc onoffline 2>&1 | logger -it chronyc-onoffline
│       rv=${PIPESTATUS[0]}
│       logger -it chronyc-onoffline "=== ${rv:-'???'}"
│       i=0
│       for try_interval in 1 3 12; do
│               if test "$rv" -gt 0; then
│                       sleep $try_interval
│                       chronyc onoffline 2>&1 | logger -it 
chronyc-onoffline-retry
│                       rv=${PIPESTATUS[0]}
│                       logger -it chronyc-onoffline-retry$((++i)) "=== 
${rv:-'???'}"
│               fi
│       done
│       exit $rv


-- System Information:
Debian Release: 13.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.12.90+deb13-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to C.UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages chrony depends on:
ii  adduser              3.152
ii  init-system-helpers  1.69~deb13u1
ii  iproute2             6.15.0-1
ii  libc6                2.41-12+deb13u3
ii  libcap2              1:2.75-10+deb13u1+b1
ii  libedit2             3.1-20250104-1
ii  libgnutls30t64       3.8.9-3+deb13u4
ii  libnettle8t64        3.10.1-1
ii  libseccomp2          2.6.0-2
ii  tzdata               2026b-0+deb13u1
ii  ucf                  3.0052

chrony recommends no packages.

Versions of packages chrony suggests:
ii  bind9-dnsutils [dnsutils]  1:9.20.23-1~deb13u1
ii  dnsutils                   1:9.18.41-1~deb12u1
pn  networkd-dispatcher        <none>

-- Configuration Files:
/etc/network/if-up.d/chrony changed:
test -x /usr/sbin/chronyd || exit 0
test -e /run/chrony/chronyd.pid || exit 0
chronyc onoffline 2>&1 | logger -it chronyc-onoffline
rv=${PIPESTATUS[0]}
logger -it chronyc-onoffline "=== ${rv:-'???'}"
exit $rv


-- no debconf information

Reply via email to