yuk7 / ArchWSL

ArchLinux based WSL Distribution. Supports multiple install.
https://git.io/archwsl
MIT License
6.55k stars 194 forks source link

X11 display socket gone ("Error: Can't open display: :0") #342

Open dindon-sournois opened 5 months ago

dindon-sournois commented 5 months ago

Describe the issue No X11 display socket

To Reproduce Boot the vm, start xeyes

Expected behavior xeyes opens

Screenshots

$ xeyes
Error: Can't open display: :0
$ ls -la /tmp/.X11-unix
total 0
drwxrwxrwt 2 root root  40 Jan 10 15:34 .
drwxrwxrwt 8 root root 160 Jan 10 15:34 ..
$ sudo rm -r /tmp/.X11-unix
[sudo] password for dindon:
rm: remove directory '/tmp/.X11-unix'? y
$ ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix

image

Enviroment:

Additional context Somehow the X11 display broke recently without me figuring out exactly when/how. I could reproduce from a clean ArchWSL (zip) installation followed by a pacman update. Looking at wslg troubleshot page I can see it's a X11 display socket issue. I was able to fix this issue, and make it persistent with a config file in /etc/tmpfiles.d. Any idea if there are better solutions or why this is necessary in the first place?

jiaqi228 commented 5 months ago

I was able to fix this issue, and make it persistent with a https://github.com/microsoft/wslg/issues/43#issuecomment-826039096.

I am faced this problem too, and after researching, I think it is the best resolution at present.

yslib commented 5 months ago

I have the same problem. It helps me a lot. Thanks. But without this solution, it acts more weird in my WSL. This will cause SDL_Init stucked and never return, and some programs stucks when they run, including glxinfo and glxgears. But some apps like gedit don't.

eduardo-hyodo commented 4 months ago

I was getting a similiar problem. I tried to start firefox.

and got the following error: image

not so easy to search for the error, the firefox worked on a ubuntu image. So I assume the problem is only on the Arch image. I don't know if some new update on Arch broke the use of wslg.

I tried the fix comment by @jiaqi228 and it worked for now.

mx commented 4 months ago

Some Arch update must have broken this; same issue here, same solution (create the symlink, or have systemd create the symlink with tmpfiles.d, or have systemd proxy the socket...).