Watch
0
0
Fork
You've already forked hyperhive
0

fix(matrix): the deferred starter logs the state its boot ended in

A degraded guest still starts the services, and now the journal says so next
to the start. The VM test pins the line.
This commit is contained in:
maia 2026-11-28 06:13:12 +01:00 • committed by mara
commit c12e231d32
3 changed files with 9 additions and 3 deletions

View file

@ -114,8 +114,10 @@ in
path = [ pkgs.systemd ]; path = [ pkgs.systemd ];
serviceConfig.Type = "simple"; serviceConfig.Type = "simple";
script = '' script = ''
# `degraded` (a unit of the boot failed) exits 1 and is still over. # `degraded` (a unit of the boot failed) exits 1 and is still over;
systemctl is-system-running --wait >/dev/null || true # the state goes to the journal next to the start.
state=$(systemctl is-system-running --wait || true)
echo "swarm-container-deferred-start: the boot ended $state; starting ${lib.concatStringsSep " " cfg.startAfterReady}"
systemctl start --no-block ${lib.concatMapStringsSep " " (n: "${n}.service") cfg.startAfterReady} systemctl start --no-block ${lib.concatMapStringsSep " " (n: "${n}.service") cfg.startAfterReady}
''; '';
}; };

View file

@ -1013,7 +1013,7 @@ let
&& starter.wantedBy == [ "multi-user.target" ] && starter.wantedBy == [ "multi-user.target" ]
&& starter.serviceConfig.Type == "simple" && starter.serviceConfig.Type == "simple"
&& !(bootWait.holdsJob starter) && !(bootWait.holdsJob starter)
&& lib.hasInfix "systemctl is-system-running --wait >/dev/null || true\nsystemctl start --no-block tuwunel.service" starter.script && lib.hasInfix "state=$(systemctl is-system-running --wait || true)\necho \"swarm-container-deferred-start: the boot ended $state; starting tuwunel\"\nsystemctl start --no-block tuwunel.service" starter.script
&& !(lib.elem "tuwunel.service" booted) && !(lib.elem "tuwunel.service" booted)
&& lib.elem "swarm-container-deferred-start.service" booted && lib.elem "swarm-container-deferred-start.service" booted
&& lib.elem "swarm-matrix-appservice-sync.service" booted && lib.elem "swarm-matrix-appservice-sync.service" booted

View file

@ -110,6 +110,10 @@ pkgs.testers.runNixOSTest {
"test \"$(nixos-container run new -- systemctl show -p ActiveState --value slow.service)\" = activating", "test \"$(nixos-container run new -- systemctl show -p ActiveState --value slow.service)\" = activating",
timeout=60, timeout=60,
) )
# The starter says which state the boot ended in, next to the start.
out = inside("new", "journalctl -u swarm-container-deferred-start.service --no-pager -o cat")
assert "swarm-container-deferred-start: the boot ended " in out, out
assert "starting slow" in out, out
with subtest("the dependant fails while the daemon starts"): with subtest("the dependant fails while the daemon starts"):
assert inside("new", "systemctl show -p ActiveState --value client.service") != "active" assert inside("new", "systemctl show -p ActiveState --value client.service") != "active"