diff --git a/docs/superpowers/specs/2026-05-09-l4d2-server-lifecycle-reboot-and-drift-design.md b/docs/superpowers/specs/2026-05-09-l4d2-server-lifecycle-reboot-and-drift-design.md index 66638b7..5ede01f 100644 --- a/docs/superpowers/specs/2026-05-09-l4d2-server-lifecycle-reboot-and-drift-design.md +++ b/docs/superpowers/specs/2026-05-09-l4d2-server-lifecycle-reboot-and-drift-design.md @@ -23,6 +23,19 @@ Make L4D2 server instances survive a host reboot by switching their lifecycle ve - **Replacing `Restart=on-failure`** with anything more elaborate. The unit's existing restart policy stays. - **Reactive-style state propagation.** No SSE/websocket pushes to the UI when actual_state changes. The next page render reads the fresh value from the DB. +## Premise check: system units, not user units + +`systemctl --user enable --now` has different lifecycle rules — auto-start only at user login (unless `loginctl enable-linger ` is set), symlinks land in `~/.config/systemd/user/.wants/`. It would be wrong here. + +This project uses **system units**, confirmed by: + +- Unit path: `/usr/local/lib/systemd/system/left4me-server@.service` is the system search path; user units live in `/etc/systemd/user/` or `~/.config/systemd/user/`. +- The `left4me-systemctl` helper (`deploy/files/usr/local/libexec/left4me/left4me-systemctl:31-44`) calls plain `systemctl` (no `--user` flag) and runs as **root** via the sudoers rule at `deploy/files/etc/sudoers.d/left4me:2`. +- The unit's `[Install] WantedBy=multi-user.target` (line 43 of the unit) is a system target; user units would use `default.target`. +- The same machinery is already in production for `left4me-web.service` — `deploy-test-server.sh` runs `sudo systemctl enable --now left4me-web.service`, and that's how the web service auto-came-back after today's reboot. We're applying the same pattern to the game-server template instances. + +`systemctl enable left4me-server@1.service` will create `/etc/systemd/system/multi-user.target.wants/left4me-server@1.service` symlinked to `/usr/local/lib/systemd/system/left4me-server@.service`. systemd handles the template instantiation via the `@` syntax automatically. + ## Background Today's behavior, confirmed by forensics on `ckn@10.0.4.128` after the operator ran `sudo systemctl poweroff` at 11:48:02 CEST: