From 4fce925b07a9f1358a217c7b09bc0d7f0b1ca2eb Mon Sep 17 00:00:00 2001 From: RobertGoltz Date: Mon, 17 Aug 2026 20:49:44 +0200 Subject: [PATCH] fix: add systemd-networkd ordering and wait-online timeout policy-routes@.service can enter an endless retry loop when a DHCP lease is lost during boot (e.g. due to networkctl reload by another service). The systemd-networkd DHCP client may stop requesting rather than retrying, and wait-online blocks indefinitely with no explicit timeout. Changes: - Add After=systemd-networkd.service to ensure networkd is running before policy-routes attempts to wait for the interface - Increase StartLimitIntervalSec from 10 to 60 to prevent permanent failure when wait-online fails quickly in a transient state - Add --timeout=60 to systemd-networkd-wait-online for bounded wait and faster retry cycle Fixes: #168 --- bin/setup-policy-routes.sh | 4 ++-- systemd/system/policy-routes@.service | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/setup-policy-routes.sh b/bin/setup-policy-routes.sh index 23f7d98..37f4ba5 100755 --- a/bin/setup-policy-routes.sh +++ b/bin/setup-policy-routes.sh @@ -64,8 +64,8 @@ start) fi done debug "Starting configuration for $iface" - debug /lib/systemd/systemd-networkd-wait-online -i "$iface" - /lib/systemd/systemd-networkd-wait-online -i "$iface" + debug /lib/systemd/systemd-networkd-wait-online -i "$iface" --timeout=60 + /lib/systemd/systemd-networkd-wait-online -i "$iface" --timeout=60 export EC2_IF_INITIAL_SETUP=1 do_setup ;; diff --git a/systemd/system/policy-routes@.service b/systemd/system/policy-routes@.service index fe3ff31..3533bee 100644 --- a/systemd/system/policy-routes@.service +++ b/systemd/system/policy-routes@.service @@ -1,6 +1,7 @@ [Unit] Description=Set up policy routes for %I -StartLimitIntervalSec=10 +After=systemd-networkd.service +StartLimitIntervalSec=60 StartLimitBurst=5 Wants=refresh-policy-routes@%i.timer CollectMode=inactive-or-failed