Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X server display socket is being set incorrectly after upgrade to WSL 0.66.2.0/WSLg 1.0.42 #818

Closed
1 of 2 tasks
LBates2000 opened this issue Aug 24, 2022 · 12 comments
Closed
1 of 2 tasks
Labels
bug Something isn't working fixinbound

Comments

@LBates2000
Copy link

LBates2000 commented Aug 24, 2022

Version

Microsoft Windows [Version 10.0.22622.575]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.15.57.1

Distro Version

Pengwin WLinux (Debian 11)

Other Software

Docker Desktop (Windows), version 4.11.1 (84025)/Docker engine version 20.10.17, build 100c701
also seems to have sporadic issues spinning up, but I think that is because of the issue with WSLg

Repro Steps

Launch distro and observe the following at boot:

xdpyinfo:  unable to open display ":0".
xprop:  unable to open display ':0'
xprop:  unable to open display ':0'
xprop:  unable to open display ':0'
xprop:  unable to open display ':0'

Check the DISPLAY environment variable:

$ echo $DISPLAY
:0

Launch a GUI program. i.e. if xeyes is installed, use it to verify:

$ xeyes
Error: Can't open display: :0

View the socket:

$ ls -la /tmp/.X11-unix/
total 44
drwxrwxrwx 2 root   root      60 Aug 23 20:21 .
drwxrwxrwt 5 root   root   40960 Aug 23 21:15 ..
srwxrwxrwx 1 lbates lbates     0 Aug 23 20:21 X3

Change the DISPLAY environment variable to match the socket:
DISPLAY=:3
Test again:
$ xeyes
GUI program displays correctly

Expected Behavior

Socket should be set to /tmp/.X11-unix/X0 every time.

Actual Behavior

Socket is set to /tmp/.X11-unix/X1, X2, X3, etc.

Diagnostic Logs

Default Distribution: WLinux
Default Version: 2
WSL version: 0.66.2.0
Kernel version: 5.15.57.1
WSLg version: 1.0.42
MSRDC version: 1.2.3401
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22622.575
@LBates2000
Copy link
Author

For now, I've added this to my .bashrc file:

 # set X server display
 export DISPLAY=:$(ls /tmp/.X11-unix/ | cut -d "X" -f2)

@LBates2000 LBates2000 changed the title X display socket is being set incorrectly after upgrade to WSL 0.66.2.0/WSLg 1.0.42 X server display socket is being set incorrectly after upgrade to WSL 0.66.2.0/WSLg 1.0.42 Aug 24, 2022
@rye2020
Copy link

rye2020 commented Aug 24, 2022

I am having the same problem and this solution is working for me.

@seancorfield
Copy link

I've also been running into this the past few days and found that rebooting a few times seems to get me back to /tmp/.X11-unix/X0 but knowing this workaround is better. Thank you!

@benhillis benhillis transferred this issue from microsoft/WSL Aug 25, 2022
@benhillis
Copy link
Member

@hideyukn88 - I think I've seen this as well, it seems intermittent and like a new regression with WSLg. Can you think of anything that would have caused this?

@keai4le
Copy link

keai4le commented Aug 30, 2022

OMG, workinging for me!

@soerenhenkel
Copy link

I see the same issue when I auto-start Docker Desktop for Windows at login. When I disable that option, and start my WSL distro (Ubuntu-20.04) first (before Docker), the issue does not seem to pop up.
Maybe the two distros that Docker starts (docker-desktop, docker-desktop-data) somehow block the X0 and X1 socket, so that for Ubuntu, only X2 is left usuable?

@acarrillo
Copy link

acarrillo commented Sep 28, 2022

I experience this frequently on my machine, and it definitely seems related to the order in which the docker-desktop container starts. I often seem to be able to fix this by shutting both wsl and docker down, then starting wsl first, then starting docker.

In this screenshot, the top terminal is shelled into docker-desktop, and the bottom terminal is shelled into my Ubuntu-20.04 container. In this example, docker-desktop has taken X1, and my Ubuntu container has taken X0 (this is a working config):

image

After reading through a few of these related open GH issues, I have figured out that I can hotfix a running session by running cd /tmp/.X11-unix && mv X1 X0, where X1= is what showed when I ls /tmp/.X11-unix. Pretty interesting!

@hideyukn88
Copy link
Member

This should be fixed by WSL 0.67.6 or newer, thanks!

@hideyukn88 hideyukn88 added bug Something isn't working fixinbound labels Oct 6, 2022
@matthewpersico
Copy link

This should be fixed by WSL 0.67.6 or newer, thanks!

I just installed WSL fresh on a Windows 11 upgrade:

C:\Users\matth>wsl --status
Default Distribution: Ubuntu-22.04
Default Version: 2
WSL version: 0.66.2.0
...
WSLg version: 1.0.42
...

When will 0.67.6 hit the Microsoft Store?

@hideyukn88
Copy link
Member

Hi all, WSL 0.70.0 is just released from Store, and this should address the issue, please update it by wsl --update, and if the problem still persists, please let us know by reopening this issue, thanks!

@acarrillo
Copy link

Thank you @hideykn88! Appreciate the fix turnaround. I shut all WSL instances down, started Docker first, then my WSL distro, and /tmp/.X11/X0 was set correctly for my distro 🎉

@matthewpersico
Copy link

matthewpersico commented Oct 15, 2022

Hi all, WSL 0.70.0 is just released from Store, and this should address the issue, please update it by wsl --update, and if the problem still persists, please let us know by reopening this issue, thanks!

PS C:\Users\matth> wsl --shutdown
PS C:\Users\matth> wsl --update
Checking for updates.
Error: 0x80244022
Error code: Wsl/UpdatePackage/0x80244022
PS C:\Users\matth>

Can you advise?

Update: Never mind - it worked on a subsequent try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixinbound
Projects
None yet
Development

No branches or pull requests

9 participants