microsoft / wslg

Enabling the Windows Subsystem for Linux to include support for Wayland and X server related scenarios
MIT License
10.06k stars 302 forks source link

Documentation: Containers.md has wrong instructions for X mount point #952

Open thetredev opened 1 year ago

thetredev commented 1 year ago

Windows build number:

10.0.19044.0

Your Distribution version:

Arch (but applies to Debian 11 as well)

Your WSL versions:

WSL-Version: 1.0.3.0
Kernelversion: 5.15.79.1
WSLg-Version: 1.0.47
MSRDC-Version: 1.2.3575
Direct3D-Version: 1.606.4
DXCore-Version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows Version: 10.0.19044.2364

Steps to reproduce:

  1. Read https://github.com/microsoft/wslg/blob/main/samples/container/Containers.md
  2. Run step The container can be build then launch as follow.:
    sudo docker build -t xclock -f Dockerfile.xclock .
    sudo docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -v /mnt/wslg:/mnt/wslg \
    -e DISPLAY=$DISPLAY -e WAYLAND_DISPLAY=$WAYLAND_DISPLAY \
    -e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR -e PULSE_SERVER=$PULSE_SERVER xclock

WSL logs:

No response

WSL dumps:

No response

Expected behavior:

X window "xclock" is displayed.

Actual behavior:

No X window is displayed.

thetredev commented 1 year ago

What fixed it on my end, was changing the mount point from

/tmp/.X11-unix:/tmp/.X11-unix

to

/mnt/wslg/.X11-unix:/tmp/.X11-unix

Needs clarification, though. Please test on your machines as well if necessary.

elsaco commented 1 year ago

@thetredev the examples are valid, however you're encountering the can't open display issue. That's why it works when pointing to /mnt/wslg/.X11-unix/X0 socket directly. Here's a screenshot with the xclock container running:

docker_wsl_xclock

Before you launch the container again make sure /tmp/.X11-unix/X0 exists. There was an effort to have this linked to /mnt/wslg/.X11-unix/X0 but didn't worked as expected causing many can't open display issues to be filed.

thetredev commented 1 year ago

@elsaco The X0 file is available in both locations for me:

image

Can you point me to the issue you've mentioned?