From 1e4066b9cb997dc038a74dc38bbc98908cb8ccc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?m=C3=BCde?= Date: Tue, 2 Jun 2026 23:49:51 +0200 Subject: [PATCH] =?UTF-8?q?fix(#702):=20hive-c0re=20ExecStartPre=20fails?= =?UTF-8?q?=20203/EXEC=20=E2=80=94=20coreutils=20has=20no=20sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The state-migration chown invoked ${pkgs.coreutils}/bin/sh, which does not exist (coreutils ships chown, not sh), so ExecStartPre exited 203/EXEC on every boot. hive-c0re hit its start limit and never came up, so the gateway returned 502 Bad Gateway. Call chown directly with the +- prefix (run as root, tolerate failure) instead of going through a shell for '|| true'. --- nix/modules/hive-c0re.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/nix/modules/hive-c0re.nix b/nix/modules/hive-c0re.nix index 25c0a7d7..5d8fe6bc 100644 --- a/nix/modules/hive-c0re.nix +++ b/nix/modules/hive-c0re.nix @@ -425,10 +425,13 @@ in ExecStart = "${cfg.package}/bin/hive-c0re --socket /run/hyperhive/host.sock serve --hyperhive-flake ${cfg.hyperhiveFlake} --nixpkgs-flake ${cfg.nixpkgsFlake} --nixpkgs-unstable-flake ${cfg.nixpkgsUnstableFlake} --dashboard-port ${toString cfg.dashboardPort} --operator-pronouns ${lib.escapeShellArg cfg.operatorPronouns} --context-window-tokens ${lib.escapeShellArg (builtins.toJSON cfg.contextWindowTokens)}"; # One-time migration: chown existing state tree to the service # user after upgrading from a root-run install. The `+` prefix - # runs this step as root even though User = hive-core. systemd's - # StateDirectory chowns the top-level dir at every start, but - # pre-existing files inside may still be root-owned. - ExecStartPre = "+${pkgs.coreutils}/bin/sh -c 'chown -R hive-core:hive-core /var/lib/hyperhive || true'"; + # runs this step as root even though User = hive-core; the `-` + # prefix tolerates failure (e.g. an empty tree) without blocking + # startup. coreutils ships `chown` but no `sh`, so invoke chown + # directly rather than through a shell. systemd's StateDirectory + # chowns the top-level dir at every start, but pre-existing files + # inside may still be root-owned. + ExecStartPre = "+-${pkgs.coreutils}/bin/chown -R hive-core:hive-core /var/lib/hyperhive"; Restart = "on-failure"; RestartSec = 2; User = "hive-core";