Skip to content

Commit 1fb40a5

Browse files
Kabuki94claude
andcommitted
fix(wslg): boot-time X11 socket symlink + start user@1000.service
* usr/lib/tmpfiles.d/mios-wslg.conf (new): `L+ /tmp/.X11-unix - - - - /mnt/wslg/.X11-unix` -- forces the X11 socket symlink at BOOT via systemd-tmpfiles, instead of the previous shell-only `ln -sf` in /usr/lib/profile.d/mios-wsl2.sh which only ran when an interactive shell sourced profile. System-launched processes (Quadlets, .desktop launchers, dbus-activated services, GUI apps spawned by `nautilus &`) start without shell profile and hit: F: X11 socket /tmp/.X11-unix/X0 does not exist in filesystem. libportal-CRITICAL: Cannot autolaunch D-Bus without X11 $DISPLAY `L+` forces the symlink even if /tmp/.X11-unix already exists as an empty dir (some distro layers pre-create it that way and block a regular `ln -sf`). No-op on bare-metal hosts because /mnt/wslg doesn't exist there; tmpfiles silently skips L-rules with absent source. * usr/lib/systemd/system/mios-wsl-runtime-dir.service: ExecStart now also drops /var/lib/systemd/linger/mios (canonical logind linger marker -- though logind itself is condition-gated off on WSL) and runs `systemctl start user@1000.service`. systemd-logind would normally start the user manager from the linger marker, but on WSL with logind absent we have to kick it ourselves. Without this the user D-Bus session bus never starts and GTK apps fail with `Cannot autolaunch D-Bus without X11 $DISPLAY` even when DISPLAY is correctly set. Failures are non-fatal -- the unit still succeeds even if user@<uid>.service can't fully come up, so the /run/user/$uid bit (the original purpose of the service) always lands. Pairs with the existing user@1000.service preset entry in 90-mios.preset (added earlier to address the same "no user systemd manager" issue from the operator's first WSL boot journal). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent e5598f3 commit 1fb40a5

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

usr/lib/systemd/system/mios-wsl-runtime-dir.service

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ RemainAfterExit=yes
2424
ExecStart=/bin/bash -c '\
2525
getent passwd mios >/dev/null 2>&1 || exit 0; \
2626
UID_=$(id -u mios); GID_=$(id -g mios); \
27-
install -d -m 0700 -o "$UID_" -g "$GID_" "/run/user/$UID_"'
27+
install -d -m 0700 -o "$UID_" -g "$GID_" "/run/user/$UID_"; \
28+
: > "/var/lib/systemd/linger/mios" 2>/dev/null || true; \
29+
systemctl start "user@$UID_.service" 2>/dev/null || true'
2830

2931
[Install]
3032
WantedBy=multi-user.target

usr/lib/tmpfiles.d/mios-wslg.conf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# /usr/lib/tmpfiles.d/mios-wslg.conf
2+
#
3+
# Boot-time WSLg substrate wiring. Replaces the per-shell `ln -sf` in
4+
# /usr/lib/profile.d/mios-wsl2.sh which only ran when an interactive
5+
# shell sourced profile -- system-launched processes (Quadlets, GUI
6+
# apps spawned via .desktop launcher, dbus-activated services) start
7+
# WITHOUT shell profile and missed the symlink, so they hit:
8+
#
9+
# F: X11 socket /tmp/.X11-unix/X0 does not exist in filesystem.
10+
# dbind-WARNING: Could not open X display
11+
# libportal-CRITICAL: Cannot autolaunch D-Bus without X11 $DISPLAY
12+
#
13+
# `L+` forces the symlink even if /tmp/.X11-unix already exists (some
14+
# distros pre-create it as an empty dir at boot, blocking the symlink
15+
# the profile.d script tried to make later). Targets /mnt/wslg/ which
16+
# WSL2 mounts unconditionally on every distro with guiApplications=true
17+
# in .wslconfig (set by the MiOS bootstrap).
18+
#
19+
# No-op on bare-metal / Hyper-V / QEMU MiOS hosts because /mnt/wslg/
20+
# doesn't exist there; tmpfiles silently skips C-/L-rules whose source
21+
# paths are absent.
22+
23+
# /tmp/.X11-unix -> /mnt/wslg/.X11-unix (X11 socket directory)
24+
L+ /tmp/.X11-unix - - - - /mnt/wslg/.X11-unix

0 commit comments

Comments
 (0)