fix(systemd): give the receiver service its own VT instead of tty1

The receiver service never started on the Pi: systemd blocks before
exec in acquire_terminal(), waiting for a controlling terminal that
the console session or getty on tty1 already owns. Symptoms: the
status shows the main PID as "(screencast)" with Tasks:1 and ~40ms
CPU, a silent journal, and no mDNS announcement — the binary never
ran. Reproduced locally with a transient unit (the desktop's Wayland
session owns tty1) and diagnosed by gdb-attaching the stuck process.

The service now owns a dedicated free VT (tty7) so acquisition is
immediate, with a tolerant ExecStartPre chvt to make the screencast
the on-screen console at boot. tty1 keeps the console login;
Ctrl+Alt+F1/Ctrl+Alt+F7 switch between them. The previous advice to
enable Console Autologin actively caused the hang and is removed
from the unit, RUNBOOK, and install script notes.

Validated locally: the same properties via systemd-run give a
running receiver with all ~15 threads alive that announces itself
and is found by --discover; verified unit passes systemd-analyze
verify; graceful stop withdraws mDNS.
This commit is contained in:
2026-09-07 13:45:47 +02:00
parent 414c2c39ee
commit 343c6b45e6
4 changed files with 33 additions and 12 deletions
+12 -3
View File
@@ -34,9 +34,18 @@ loopback; current phase is Phase 7.
- **systemd autostart**: `systemd/screencast-receiver.service` is a
template (`__SC_RECEIVER_BIN__`/`__SC_RECEIVER_USER__`); the install
script substitutes and enables it (opt out: `SC_RECEIVER_SERVICE=0`),
adding the run user to video/render/input for headless KMSDRM. The unit
gets a controlling tty (StandardInput=tty, tty1) because SDL's KMSDRM
backend needs one for VT handling.
adding the run user to video/render/input for headless KMSDRM.
- **systemd tty trap (hit on the real Pi, reproduced locally)**: with
StandardInput=tty + TTYPath=tty1, the service NEVER started — systemd
blocks PRE-EXEC in acquire_terminal() waiting for a tty that the console
session/getty already owns. Symptoms: status shows the main PID as
"(screencast)" with Tasks:1 and ~40ms CPU, silent journal, no mDNS.
Diagnosed by gdb-attaching the stuck process (acquire_terminal backtrace)
after reproducing with a local transient unit. Fix: the service owns a
dedicated free VT (tty7) + tolerant `ExecStartPre=-/usr/bin/chvt 7`;
tty1 keeps the console. Also: `systemctl status` Tasks counts THREADS
(a healthy receiver shows ~15), and "Console Autologin" advice was
WRONG (it made the hang deterministic) — removed from all docs.
- **Fullscreen headless rendering**: under the KMSDRM video driver (no
window manager) the renderer goes fullscreen automatically; --fullscreen
forces it on desktops. Aspect is preserved via