From f50a823adfb8d8882ec3b4301b3d53d190f91dd4 Mon Sep 17 00:00:00 2001 From: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com> Date: Mon, 27 Jul 2026 21:20:11 +0200 Subject: [PATCH 1/3] fix(aziot-identityd): let precondition service reach failed state With Restart=on-failure/RestartSec=5 and the default start limit (5 in 10 s) the rate limit could never trip: a persistently failing precondition looped in 'activating' forever and never showed up in the system state. Add a start limit that can trip and a retry timer for self-healing on transient failures. Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com> --- recipes-azure-iot/azure-identityd/aziot-identityd.inc | 3 +++ .../aziot-identityd/aziot-identityd-precondition.service | 2 ++ .../aziot-identityd/aziot-identityd-precondition.timer | 8 ++++++++ 3 files changed, 13 insertions(+) create mode 100644 recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.timer diff --git a/recipes-azure-iot/azure-identityd/aziot-identityd.inc b/recipes-azure-iot/azure-identityd/aziot-identityd.inc index 0a62ef91c..93869f476 100644 --- a/recipes-azure-iot/azure-identityd/aziot-identityd.inc +++ b/recipes-azure-iot/azure-identityd/aziot-identityd.inc @@ -17,6 +17,7 @@ SRC_URI += " \ # workspace SRC_URI += " \ file://aziot-identityd-precondition.service \ + file://aziot-identityd-precondition.timer \ file://iot-identity-service.conf \ file://iot-identity-service-certd.template.toml \ " @@ -189,6 +190,7 @@ do_install() { else sed -i "s/@@AZIOTCLI@@/aziotctl/" ${D}${systemd_system_unitdir}/aziot-identityd-precondition.service fi + install -m 0644 ${WORKDIR}/aziot-identityd-precondition.timer ${D}${systemd_system_unitdir}/aziot-identityd-precondition.timer } pkg_postinst:${PN}() { @@ -209,6 +211,7 @@ SYSTEMD_SERVICE:${PN} = " \ aziot-identityd.service \ aziot-identityd.socket \ aziot-identityd-precondition.service \ + aziot-identityd-precondition.timer \ aziot-keyd.service \ aziot-keyd.socket \ " diff --git a/recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.service b/recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.service index 959cb432d..ee95a9504 100644 --- a/recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.service +++ b/recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.service @@ -15,6 +15,8 @@ ConditionPathExists=|/run/omnect-device-service/omnect_validate_update_failed ConditionPathExists=|/run/omnect-device-service/omnect_bootloader_updated ConditionFileNotEmpty=|!/etc/aziot/identityd/config.d/00-super.toml +StartLimitBurst=5 +StartLimitIntervalSec=60 [Service] Type=oneshot diff --git a/recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.timer b/recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.timer new file mode 100644 index 000000000..c323fd31a --- /dev/null +++ b/recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.timer @@ -0,0 +1,8 @@ +[Unit] +Description=Retry Azure IoT Identity Service Precondition + +[Timer] +OnUnitInactiveSec=10min + +[Install] +WantedBy=timers.target From 9eb2c412d415951f999caa7621eeafffd4a3ade1 Mon Sep 17 00:00:00 2001 From: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com> Date: Thu, 30 Jul 2026 11:21:49 +0200 Subject: [PATCH 2/3] docs(aziot-identityd): explain precondition start limit values Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com> --- .../aziot-identityd/aziot-identityd-precondition.service | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.service b/recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.service index ee95a9504..2e117817b 100644 --- a/recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.service +++ b/recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.service @@ -15,6 +15,10 @@ ConditionPathExists=|/run/omnect-device-service/omnect_validate_update_failed ConditionPathExists=|/run/omnect-device-service/omnect_bootloader_updated ConditionFileNotEmpty=|!/etc/aziot/identityd/config.d/00-super.toml + +# with RestartSec=5 the default limit (5 starts per 10s) is never reached, so +# the unit would loop in auto-restart forever instead of failing; keep the +# window short, the aziot stack is ordered after this unit StartLimitBurst=5 StartLimitIntervalSec=60 From 0cbceaf4dc678a093f40d7782e5948455c1e662f Mon Sep 17 00:00:00 2001 From: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com> Date: Fri, 31 Jul 2026 11:57:51 +0200 Subject: [PATCH 3/3] fix(aziot-identityd): widen precondition start-limit window The burst only trips if StartLimitBurst * (RestartSec + runtime of one 'config apply') fits into the window. 60s left less than 7s per attempt, which a slower device or 'iotedge config apply' can exceed - and then the unit loops in auto-restart again, which is the bug this should fix. 120s leaves about 19s per attempt. The time to reach 'failed' is driven by StartLimitBurst * RestartSec and stays at ~25s. Also document why OnUnitInactiveSec has to exceed the window. Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com> --- .../aziot-identityd/aziot-identityd-precondition.service | 7 ++++--- .../aziot-identityd/aziot-identityd-precondition.timer | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.service b/recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.service index 2e117817b..71f33e96a 100644 --- a/recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.service +++ b/recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.service @@ -17,10 +17,11 @@ ConditionPathExists=|/run/omnect-device-service/omnect_bootloader_updated ConditionFileNotEmpty=|!/etc/aziot/identityd/config.d/00-super.toml # with RestartSec=5 the default limit (5 starts per 10s) is never reached, so -# the unit would loop in auto-restart forever instead of failing; keep the -# window short, the aziot stack is ordered after this unit +# the unit would loop in auto-restart forever instead of failing; the window +# has to hold the whole burst, i.e. StartLimitBurst * (RestartSec + runtime of +# one 'config apply') StartLimitBurst=5 -StartLimitIntervalSec=60 +StartLimitIntervalSec=120 [Service] Type=oneshot diff --git a/recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.timer b/recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.timer index c323fd31a..7f0ce9db2 100644 --- a/recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.timer +++ b/recipes-azure-iot/azure-identityd/aziot-identityd/aziot-identityd-precondition.timer @@ -2,6 +2,7 @@ Description=Retry Azure IoT Identity Service Precondition [Timer] +# must exceed the unit's start-limit window, else the retry is rejected as well OnUnitInactiveSec=10min [Install]