From 43961be949f645960ed58054f97bdbde42e591b4 Mon Sep 17 00:00:00 2001 From: agessaman Date: Fri, 7 Aug 2026 13:44:42 -0700 Subject: [PATCH] fix(service): move StartLimit* to [Unit] so the restart limit applies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit StartLimitInterval and StartLimitBurst were set under [Service], where systemd 230 and later ignore them — they moved to [Unit] in 2016. The unit silently fell back to the system defaults of 5 starts in 10 s, and because RestartSec=10 spaces attempts further apart than that window, the limiter could never trip: a bot that could not reach its radio restarted every 10 seconds indefinitely instead of stopping in failed state. Moved to [Unit] as StartLimitIntervalSec=60 / StartLimitBurst=3, the values the file already declared. Applied to both the shipped unit and the one generated for the .deb, which had drifted the same way. --- meshcore-bot.service | 10 ++++++---- scripts/build-deb.sh | 8 ++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/meshcore-bot.service b/meshcore-bot.service index f9a59ef..0df67e9 100644 --- a/meshcore-bot.service +++ b/meshcore-bot.service @@ -4,6 +4,12 @@ Documentation=https://github.com/agessaman/meshcore-bot After=network.target Wants=network.target +# Restart policy. These belong in [Unit], not [Service] — systemd 230 moved them, +# and it silently ignores them anywhere else. Give up after 3 starts in 60 s so a +# bot that cannot reach its radio lands in `failed` instead of looping forever. +StartLimitIntervalSec=60 +StartLimitBurst=3 + [Service] Type=simple User=meshcore @@ -42,9 +48,5 @@ LimitNOFILE=65536 MemoryMax=1G CPUQuota=200% -# Restart policy -StartLimitInterval=60 -StartLimitBurst=3 - [Install] WantedBy=multi-user.target diff --git a/scripts/build-deb.sh b/scripts/build-deb.sh index 2b39ab8..f019b6c 100755 --- a/scripts/build-deb.sh +++ b/scripts/build-deb.sh @@ -109,6 +109,12 @@ Documentation=https://github.com/agessaman/meshcore-bot After=network.target Wants=network.target +# Restart policy. These belong in [Unit], not [Service] — systemd 230 moved them, +# and it silently ignores them anywhere else. Give up after 3 starts in 60 s so a +# bot that cannot reach its radio lands in `failed` instead of looping forever. +StartLimitIntervalSec=60 +StartLimitBurst=3 + [Service] Type=simple User=meshcore @@ -140,8 +146,6 @@ ReadWritePaths=/var/lib/meshcore-bot LimitNOFILE=65536 MemoryMax=1G CPUQuota=200% -StartLimitInterval=60 -StartLimitBurst=3 [Install] WantedBy=multi-user.target