|

hammerhead-xdm r4: start.sh cleans stale Xorg/pid before start

hammerhead-xdm r4: start.sh cleans stale Xorg/pid before start

zyginit restarts were accumulating orphaned Xorg servers (backgrounded Xorg
outlived the contract teardown) and tripping on a stale /var/run/xdm.pid.
start.sh now pkills any stale Xorg/xdm and removes the pid+lock before
launching, so a restart is idempotent.
Author: Chris Tusa <chris.tusa@leafscale.com>
Date: Jul 24, 2026 09:24
Changeset: 8a3e0f1b6b962c7e2f0514c9ed1341dd699efd79
Branch: default

Diff

diff -r 4bec91d91306 -r 8a3e0f1b6b96 base/hammerhead-xdm/package.toml
--- a/base/hammerhead-xdm/package.toml	Fri Jul 24 09:20:54 2026 -0500
+++ b/base/hammerhead-xdm/package.toml	Fri Jul 24 09:24:28 2026 -0500
@@ -10,7 +10,7 @@
 [package]
 name = "hammerhead-xdm"
 version = "1.0.0"
-release = 3
+release = 4
 description = "Zygaena marine-dark xdm greeter branding, system Xsession/Xservers wiring, and a disabled zyginit xdm service"
 url = "https://git.sharkos.one/zygaena/hammerhead"
 license = "CDDL-1.0"
diff -r 4bec91d91306 -r 8a3e0f1b6b96 base/hammerhead-xdm/start.sh
--- a/base/hammerhead-xdm/start.sh	Fri Jul 24 09:20:54 2026 -0500
+++ b/base/hammerhead-xdm/start.sh	Fri Jul 24 09:24:28 2026 -0500
@@ -15,8 +15,17 @@
 XAUTHDIR=/var/lib/xdm/authdir/authfiles
 XAUTH="$XAUTHDIR/A:0"
 
+# Robustness: a crashed prior instance (or a zyginit restart whose
+# backgrounded Xorg orphaned past the contract teardown) can leave a stale
+# server, X lock, or xdm pid file. Clear them first so a restart does NOT
+# accumulate X servers. We are still zsh here (xdm is exec'd at the end), so
+# pkill xdm cannot hit this script.
+/usr/bin/pkill -9 -x Xorg 2>/dev/null
+/usr/bin/pkill -9 -x xdm 2>/dev/null
+/bin/sleep 1
+
 /bin/mkdir -p "$XAUTHDIR"
-/bin/rm -f "$XAUTH" /tmp/.X0-lock /tmp/.X11-unix/X0 2>/dev/null
+/bin/rm -f "$XAUTH" /var/run/xdm.pid /tmp/.X0-lock /tmp/.X11-unix/X0 2>/dev/null
 
 # Fresh cookie, shared between the server (-auth) and every X client via
 # XAUTHORITY (xdm greeter, Xsetup, and the user session all inherit it).