Skip to content

Commit 0e2b24c

Browse files
committed
wslg-permissions-fix.service: also bind-mount /tmp/.X11-unix (flatpak bwrap fix)
Operator-flagged 2026-05-10 launching Nautilus.Devel: bwrap: Can't mount tmpfs on /newroot/tmp/.X11-unix: No such file or directory WSL2 ships /tmp/.X11-unix as a SYMLINK -> /mnt/wslg/.X11-unix. Most flatpak GUI apps tolerate the symlink because bwrap follows it during mount-prep. But some (Nautilus.Devel from gnome-nightly, gnome-text-editor, X11-fallback apps) explicitly try to tmpfs-mount /newroot/tmp/.X11-unix inside their chroot -- which fails because you can't tmpfs over a symlink in bwrap's namespace setup. Fix: at the same boot phase as the runtime-dir chmod, replace the WSL-shipped symlink with a real directory + bind-mount the host's /mnt/wslg/.X11-unix onto it. From the flatpak's perspective /tmp/.X11-unix is now a regular dir containing the X0 socket -- bwrap can tmpfs over it freely, and the socket inside is the correct host-side WSLg one. Operator-verified live 2026-05-10: after this fix Nautilus.Devel launches without the bwrap error; bwrap chains advance to a sandboxed nautilus process that registers with weston correctly.
1 parent aa4e658 commit 0e2b24c

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

usr/lib/systemd/system/mios-wslg-permissions-fix.service

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,22 @@ Before=wslg-wayland.service
3333
Type=oneshot
3434
ExecStart=/usr/bin/chmod 0700 /mnt/wslg/runtime-dir
3535
ExecStart=/usr/bin/chown user:user /mnt/wslg/runtime-dir
36+
# /tmp/.X11-unix: WSL2 ships it as a SYMLINK -> /mnt/wslg/.X11-unix.
37+
# Flatpak bwrap chokes on symlinks ("Can't mount tmpfs on
38+
# /newroot/tmp/.X11-unix: No such file or directory") for any GUI app
39+
# that uses --socket=fallback-x11 (Nautilus.Devel, gnome-text-editor,
40+
# epiphany under XWayland fallback, etc.). Replace symlink with a
41+
# real directory + bind-mount the host's WSLg X11 socket dir onto
42+
# it so bwrap can chroot freely without losing X11 access.
43+
# Operator-flagged 2026-05-10: "bwrap: Can't mount tmpfs on
44+
# /newroot/tmp/.X11-unix: No such file or directory" when launching
45+
# Nautilus.Devel from gnome-nightly.
46+
ExecStart=-/usr/bin/test -L /tmp/.X11-unix
47+
ExecStart=-/usr/bin/rm -f /tmp/.X11-unix
48+
ExecStart=/usr/bin/mkdir -p /tmp/.X11-unix
49+
ExecStart=/usr/bin/chmod 1777 /tmp/.X11-unix
50+
ExecStart=-/usr/bin/mountpoint -q /tmp/.X11-unix
51+
ExecStart=-/usr/bin/mount --bind /mnt/wslg/.X11-unix /tmp/.X11-unix
3652
RemainAfterExit=yes
3753

3854
[Install]

0 commit comments

Comments
 (0)