Instance stops SIGKILLed: systemd 'not our child' under PrivatePIDs Issueopen
claude agent, operated by paul@keymail.devdriven by paul@keymail.devsession 922e5421 · claude-code/2.1.312 · DOCS-T1
Found by the agent-start-demo Plan 1 kernel witness on the dev demo box (2026-11-04, evidence on #527), but it is platform-wide and predates that work.
What happens: some instance unit stops end with Result=signal. systemd logs "Supervising process … which is not our child" and then SIGKILLs it, so the app never gets a clean shutdown. The base instance templates set PrivatePIDs=yes, which is the likely cause: the supervised main PID is no longer systemd's direct child.
How often (dev, last 7 days): sophie had 62 of about 283 instance stops end Failed with result 'signal' (69 "not our child" lines), and leo had 15 of about 72.
Why it matters: apps don't get SIGTERM handling at idle stops or deploy swaps, and stop results are noisy. SQLite recovers from the kill, so no data loss is known, but anything doing work in a shutdown handler loses it.
What it blocks: nothing now. Paul ruled on 2026-11-04 to switch demos on on dev regardless (option a on #527). TestDemoDenyAllKernel requires Result=success at stop and will keep failing until this is fixed, so re-run it as the acceptance check.
LLM
About 1 in 5 instance stops on dev end with SIGKILL instead of a clean stop; likely PrivatePIDs supervision; found by the demo kernel witness.
claude agent, operated by paul@keymail.devdriven by paul@keymail.devsession 57f7b202 · claude-code/2.1.318 · DOCS-T1
Root cause found (branch instance-stop-528). systemd 257's PrivatePIDs start forks once more and races the intermediate's exit; when it loses, the main PID is marked "not our child" (alien). At stop, unit_kill_context() returns "nothing to wait for" for an alien main, and KillMode=mixed signals nothing else in the SIGTERM phase, so systemd SIGKILLs at once. Journal correlation by INVOCATION_ID: demo box 17/17 signal failures alien (27/27 non-alien stops clean); sophie gens 73/73 alien (259/259 non-alien clean).
Fix on the branch: KillMode=control-group + CARLOS_INIT_STOP=cgroup (trampoline forwards no second SIGTERM), Retire uses SIGPWR. Root runner 20261108T160744-e76dbf PASS: mixed reproduces (3/40 alien, 3/40 signal); shipped template 80/80 clean incl. alien starts, one SIGTERM each; SIGTERM-ignoring app killed in the bound.
Not merged: Astra R2 P1 on version mixing during rolls/rollback (old trampoline under new unit = two SIGTERMs; new trampoline under restored mixed = no SIGTERM, SIGKILL after 20 s). Escalated to the coordinator as a stopping-rule-2 call.
claude agent, operated by paul@keymail.devdriven by paul@keymail.devsession 57f7b202 · claude-code/2.1.318 · DOCS-T1
Superseded. Paul chose option (2): a root ExecStop that sends one SIGTERM to $MAINPID and waits for it within the stop budget, with KillMode=mixed and the trampoline unchanged; no pins, locks or rollback state. Work moves to instance-stop-execstop-528 under a fresh Astra review series. instance-stop-528 is parked unmerged; its root-cause analysis and witness runs stand.
claude agent, operated by paul@keymail.devdriven by paul@keymail.devsession 57f7b202 · claude-code/2.1.318 · DOCS-T1
Merged as fe8df21 (Paul's option 2, branch instance-stop-execstop-528): a root ExecStop=-+/opt/carlos/carlos instance-stop $MAINPID sends the main process one SIGTERM through a pidfd, waits up to 18 s, then SIGKILLs; TimeoutStopFailureMode=kill; KillMode=mixed and the trampoline unchanged. Root-runner witness 20261108T183451-994df0 PASS across old/new unit × binary mixes, roll and rollback under running instances, alien starts, RuntimeMaxSec, stopped main, and both manager-timeout cases. Out of scope (follow-ups): rootfs templates and the running-oneshot stop. Not released; rides v0.34.30.