Skip to content

Instantly share code, notes, and snippets.

@cerebrate
Created September 26, 2022 18:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cerebrate/5cc6b2d6b9a42812ced020ea3e59b059 to your computer and use it in GitHub Desktop.
Save cerebrate/5cc6b2d6b9a42812ced020ea3e59b059 to your computer and use it in GitHub Desktop.
Bind mount solution for restoring WSLg under systemd
# /lib/systemd/system/tmp-.X11\x2dunix.mount
[Unit]
Description=WSLg Remount Service
DefaultDependencies=no
After=systemd-tmpfiles-setup.service
Before=sysinit.target
ConditionPathExists=/tmp/.X11-unix
ConditionPathIsMountPoint=!/tmp/.X11-unix
ConditionPathExists=/mnt/wslg/.X11-unix
[Mount]
What=/mnt/wslg/.X11-unix
Where=/tmp/.X11-unix
Type=none
Options=bind
[Install]
WantedBy=sysinit.target
# /lib/tmpfiles.d/wslg.conf
# Recreate the mount point for the X11 socket.
d /tmp/.X11-unix - - - - -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment