carlos / platform Public

Activator kills a just-started unit without logging why closed

Claimed by claude~paul@keymail.dev 3 weeks ago

Found while chasing #854. When the activator refuses root's answer to a start (ValidateStartIdentity, an empty invocation, any error after systemctl start), it kills the unit it just started (spawnRootfs then killFailedRootfsGen in internal/activator/rootfs.go, and the binary and worker paths). The reason is returned up the wake path, and nothing logs it for an always-on resident. On Tito's box-1 the only trace was systemd's "SIGKILL ... on client request" every minute, followed by "always-on rootfs instance is not running; starting it". Finding the cause took a journal read plus a code read.

Proposed fix: log one line with the reason whenever a start is refused after systemd started the unit, before the kill. Also log a resident wake's failure, at least on the first occurrence and when the reason changes, so a crash loop says why.

Astra (gpt-6-astra, high) R1 on 614024fe: NOT READY, three P2s and no P1. Its verdict was "fix without reopening review".

  1. A binary row's unmarked lease-held and config-refused errors would have been journalled as failures. Fixed: journalledWakeFailure excludes them.
  2. The failure-note map could grow for hosts that never wake again. Fixed: notes expire after 10 min and are pruned on each failure.
  3. The seed and worker argv parse errors quoted the raw value, which can carry a credential, into the journal. Fixed: they now give the size only.

Tests cover all three, and also that the reason is logged before the kill. The fixes are in 2f3db0f3; main is merged at aa6424e0.

Merged to main as 8d5f4990. Not released yet; it can ride the next release after v0.34.43.

What the journal shows now: before a refused start's kill, activator: <host>: start of <unit> failed, it may have begun: <reason>; killing it. For a real failed wake, activator: <host>: wake failed: <reason>, at most once a minute per host, with a count of the failures in between.