From 1dd674714a9ef2d784302f17e99a276be8e74b94 Mon Sep 17 00:00:00 2001 From: mwiegand Date: Sat, 9 May 2026 12:25:34 +0200 Subject: [PATCH] =?UTF-8?q?docs(specs):=20perf=20baseline=20lifecycle=20?= =?UTF-8?q?=E2=80=94=20premise=20check=20on=20system=20vs=20user=20units?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make explicit that the project uses system units (root systemctl, unit under /usr/local/lib/systemd/system/, WantedBy=multi-user.target), so `systemctl enable --now` is the correct verb to make instances survive a host reboot. User units have different lifecycle rules and would not auto-start at boot without enable-linger. Co-Authored-By: Claude Opus 4.7 (1M context) --- ...l4d2-server-lifecycle-reboot-and-drift-design.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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: