fix(#702): hive-c0re ExecStartPre fails 203/EXEC — coreutils has no sh
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'.
This commit is contained in:
parent
9e12012a95
commit
1e4066b9cb
1 changed files with 7 additions and 4 deletions
|
|
@ -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";
|
||||
|
|
|
|||
Loading…
Reference in a new issue