From 56c04b1f70b7a4ee6b6b0a4646da4a1a6b0064ca Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Sun, 26 Jul 2026 07:32:16 +0000 Subject: [PATCH] manatee: Guard podman containers against crash-looping Add a start-limit (5 restarts / 5 min) to the romm, romm-db, romm-redis and homeassistant podman services so a failing container enters a `failed` state instead of retrying forever. A slow crash-loop (~5s per attempt) stays under systemd's default 5-starts-per-10s limit, so a longer window is needed to catch it. --- hosts/manatee/modules/home-assistant/default.nix | 10 ++++++++++ hosts/manatee/modules/romm/default.nix | 14 ++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/hosts/manatee/modules/home-assistant/default.nix b/hosts/manatee/modules/home-assistant/default.nix index 458a3a7..bb870c0 100644 --- a/hosts/manatee/modules/home-assistant/default.nix +++ b/hosts/manatee/modules/home-assistant/default.nix @@ -117,6 +117,16 @@ in hardware.bluetooth.enable = true; + # Give up and enter a `failed` state (visible in `systemctl --failed`) if the + # container restarts more than 5 times in 5 minutes, instead of crash-looping + # forever. The window is deliberately long: a slow crash-loop (~5s per attempt) + # stays under systemd's default 5-starts-per-10s limit and would otherwise + # retry indefinitely. + systemd.services.podman-homeassistant = { + startLimitIntervalSec = 300; + startLimitBurst = 5; + }; + virtualisation.oci-containers = { backend = "podman"; diff --git a/hosts/manatee/modules/romm/default.nix b/hosts/manatee/modules/romm/default.nix index 14d1008..ae6a61c 100644 --- a/hosts/manatee/modules/romm/default.nix +++ b/hosts/manatee/modules/romm/default.nix @@ -26,6 +26,16 @@ let - 'Thumbs.db' - '.DS_Store' ''; + + # Give up and enter a `failed` state (visible in `systemctl --failed`) if a + # container restarts more than 5 times in 5 minutes, instead of crash-looping + # forever. The window is deliberately long: a slow crash-loop (~5s per attempt) + # stays under systemd's default 5-starts-per-10s limit and would otherwise + # retry indefinitely. + crashLoopGuard = { + startLimitIntervalSec = 300; + startLimitBurst = 5; + }; in { options = { @@ -51,6 +61,10 @@ in "d /var/lib/romm/assets 0755 root root -" ]; + systemd.services.podman-romm = crashLoopGuard; + systemd.services.podman-romm-db = crashLoopGuard; + systemd.services.podman-romm-redis = crashLoopGuard; + systemd.services.romm-net = { description = "Create Podman network for RomM"; after = [ "podman.service" ];