chrony: make chrony-hotplug more reliable
authorFlorian Wagner <redacted>
Tue, 17 Feb 2026 15:21:22 +0000 (16:21 +0100)
committerHannu Nyman <redacted>
Sun, 15 Mar 2026 18:40:39 +0000 (20:40 +0200)
At startup there's a race situation where "chronyc waitsync" (and thus
chrony-hotplug) will exit right away because it can't bind to loopback.

This change tries quite hard to make chrony-hotplug wait for loopback to
come up before running chronyc.

Fixes #28434.

Signed-off-by: Florian Wagner <redacted>
net/chrony/Makefile
net/chrony/files/chrony.ntp-hotplug

index a49627952f2171c54c5ff2d59a7549f2623c5855..aa9e45c3174cb8c639063965cd17acf5e0f93e48 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=chrony
 PKG_VERSION:=4.8
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://chrony-project.org/releases/
index 1651b95fb2e14156261792100fb349321e357861..06cf6e579efb9936289a0834a0e0b16d3117f401 100644 (file)
@@ -1,4 +1,25 @@
 #!/bin/sh
+
+# Find interface corresponding to lo device
+IFACE=$(ubus call network.interface dump | \
+            jsonfilter -e '@.interface[@.device="lo"].interface')
+
+# During boot network.interface dump can be empty; try UCI instead
+if [ -z "${IFACE}" ]; then
+    . /lib/functions.sh
+    handle_interface () {
+        local iface="$1"
+        local device
+        config_get device "${iface}" device
+        [ "${device}" = "lo" ] && IFACE=${iface}
+    }
+    config_load network
+    config_foreach handle_interface interface
+fi
+
+[ -z "${IFACE}" ] || \
+    ubus -t 30 wait_for network.interface.${IFACE}
+
 # Wait for sync for up to 5 minutes and notify other services
 
 /usr/bin/chronyc waitsync 300 1 0.0 1 || exit 0
git clone https://git.99rst.org/PROJECT