Open tan-yong-sheng opened 3 years ago
Hello @tys203831. It looks like your DISPLAY environment variable is incorrectly set... it should be set to :0
and not 172.26.48.1:0.0
, probably a remnant of Vcxsrv uninstall. You'll want to track down where in your startup script this is being overwritten.
@spronovo I have tried reinstalling wslg and also uninstall vcxsrv server of my machine. However, it still have same error "Error: Can't open display: :0".
Below is my .bashrc file: bashrc.txt (Note: I change the file extension name in order to be able upload to github)
tys@DESKTOP-SDACRC6:~$ echo $DISPLAY
:0
tys@DESKTOP-SDACRC6:~$ ls -la /tmp/.X11-unix
lrwxrwxrwx 1 root root 19 Nov 6 22:14 /tmp/.X11-unix -> /mnt/wslg/.X11-unix
tys@DESKTOP-SDACRC6:~$ ls -la /tmp/.X11-unix/
total 0
drwxrwxrwx 2 root root 60 Nov 6 22:14 .
drwxrwxrwt 6 root root 260 Nov 6 22:14 ..
srwxrwxrwx 1 tys users 0 Nov 6 22:14 X0
tys@DESKTOP-SDACRC6:~$ ls /tmp/.X11-unix
X0
WSL logs:
pulseaudio.log pulseaudio.log
weston.log weston.log
versions.txt versions.txt
I have a similar issue. It began when I updated the graphics driver on my system as encouraged by https://devblogs.microsoft.com/commandline/wslg-architecture/#hardware-accelerated-opengl.
Details as requested on https://github.com/microsoft/wslg/wiki/Diagnosing-%22cannot-open-display%22-type-issues-with-WSLg#still-having-a-problem, starting a fresh launch of the container:
wjt@Simulant:/mnt/c/Users/wjt$ cat /mnt/wslg/versions.txt
WSLg ( x86_64 ): 1.0.26+Branch.main.Sha.26ce2c09b86442f3c7f4f6462f770ed2afa76a25
Mariner: VERSION="1.0.20210224"
FreeRDP: b05321cd4e6a862aef76163a69db4e1910245736
weston: 46756d0e77e5c01b5995fbbee6f3ab0db9b30612
pulseaudio: 2f0f0b8c3872780f15e275fc12899f4564f01bd5
mesa:
wjt@Simulant:/mnt/c/Users/wjt$ echo $DISPLAY
:0
wjt@Simulant:/mnt/c/Users/wjt$ ls -la /tmp/.X11-unix
lrwxrwxrwx 1 root root 19 Nov 9 17:12 /tmp/.X11-unix -> /mnt/wslg/.X11-unix
wjt@Simulant:/mnt/c/Users/wjt$ ls -la /tmp/.X11-unix/
total 0
drwxrwxrwx 2 root root 60 Nov 9 17:12 .
drwxrwxrwt 6 root root 260 Nov 9 17:12 ..
srwxrwxrwx 1 wjt users 0 Nov 9 17:12 X0
OK, great, we see the socket is present. Now, let's watch /mnt/wslg/weston.log
as I start an X11 application:
wjt@Simulant:/mnt/c/Users/wjt$ tail -n0 f /mnt/wslg/weston.log &
[2] 37
wjt@Simulant:/mnt/c/Users/wjt$ glxinfo -B
[17:14:24.899] Spawned Xwayland server, pid 71
[17:14:27.332] xserver crashing too fast: 134
Error: unable to open display :0
[2]+ Done tail -n0 f /mnt/wslg/weston.log
wjt@Simulant:/mnt/c/Users/wjt$ ls -la /tmp/.X11-unix/
total 0
drwxrwxrwx 2 root root 40 Nov 9 17:14 .
drwxrwxrwt 6 root root 260 Nov 9 17:12 ..
The socket is gone. I see the same "xserver crashing too fast" warning in @tys203831's report above. I see they also have a lower-end CPU -- mine is a Intel(R) Pentium(R) Silver N5000 CPU @ 1.10GHz
.
Ignoring X for a moment, let's turn to Wayland. Some Wayland applications launch OK, such as weston-flower. But any application that attempts to use GL fails:
wjt@Simulant:/mnt/c/Users/wjt$ weston-subsurfaces
Illegal instruction
Inspecting with GDB, it's crashing inside the Intel graphics driver:
Program received signal SIGILL, Illegal instruction.
0x00007fffea4cf2d8 in ?? () from /usr/lib/wsl/drivers/iigd_dch.inf_amd64_bb614eb89871cffc/libigd12umd64.so
layout asm
shows the offending instruction as vmovaps
. Some web searches and pages like this suggests this is part of AVX. But this CPU does not support AVX:
wjt@Simulant:/mnt/c/Users/wjt$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 39 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Vendor ID: GenuineIntel
Model name: Intel(R) Pentium(R) Silver N5000 CPU @ 1.10GHz
CPU family: 6
Model: 122
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
Stepping: 1
BogoMIPS: 2188.79
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall n
x pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq vmx ssse3 c
x16 sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave rdrand hypervisor lahf_lm 3dnowprefetch pti ss
bd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi ept vpid ept_ad fsgsbase tsc_adjust smep erms rdseed smap clflus
hopt sha_ni xsaveopt xsavec xgetbv1 xsaves umip rdpid md_clear arch_capabilities
Virtualization features:
Virtualization: VT-x
Hypervisor vendor: Microsoft
Virtualization type: full
Caches (sum of all):
L1d: 96 KiB (4 instances)
L1i: 128 KiB (4 instances)
L2: 16 MiB (4 instances)
Vulnerabilities:
Itlb multihit: Not affected
L1tf: Not affected
Mds: Not affected
Meltdown: Mitigation; PTI
Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB filling
Srbds: Not affected
Tsx async abort: Not affected
If I force software rendering with LIBGL_ALWAYS_SOFTWARE=true weston-subsurfaces
then the problem does not occur. I have run out of time today but I will try applying this environment variable to the system-distro by following https://github.com/microsoft/wslg/wiki/WSLg-Configuration-Options-for-Debugging to see if that works around Xwayland crashing.
I am unsure whether /usr/lib/wsl/drivers/iigd_dch.inf_amd64_bb614eb89871cffc/libigd12umd64.so
is provided by Intel, or whether it is a shim library provided by WSL. If the former, there may not be much WSLg can do here.
If I force software rendering with
LIBGL_ALWAYS_SOFTWARE=true weston-subsurfaces
then the problem does not occur. I have run out of time today but I will try applying this environment variable to the system-distro by following https://github.com/microsoft/wslg/wiki/WSLg-Configuration-Options-for-Debugging to see if that works around Xwayland crashing.
Yes, this works around the problem.
I am unsure whether
/usr/lib/wsl/drivers/iigd_dch.inf_amd64_bb614eb89871cffc/libigd12umd64.so
is provided by Intel, or whether it is a shim library provided by WSL. If the former, there may not be much WSLg can do here.
I am reliably informed that it is indeed provided by Intel, and is their Windows DirectX driver recompiled for Linux. I wonder if it does some CPU detection on Windows that is not supported on Linux? Perhaps I should be reporting this to Intel, but I don't know where. The WSLg team may have better contacts for this kind of thing.
Not sure if it helps anyone, but I had similar issue where wayland application (e.g. gedit) works but X11 application (e.g. xclock/xcalc/firefox/gimp) does not work.
It turns out that if you used your Linux distro before with VcXserv, even after uninstall it, it left something in your Linux distro's /tmp/.X11-unix folder. The trick is to simply remove this folder, and create a symbolic link to /mnt/wslg/.X11-unix, and everything work now for me.
sudo ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix
My $Display wasn't set properly after setting up a fresh WSL Ubuntu container and installing some apps / updates.
Is WSLg packaged seperately from WSL or something? I can't find evidence of WSLg even existing following https://github.com/microsoft/wslg/wiki/Diagnosing-%22cannot-open-display%22-type-issues-with-WSLg#still-having-a-problem on windows 11, 22000.493
Not sure if it helps anyone, but I had similar issue where wayland application (e.g. gedit) works but X11 application (e.g. xclock/xcalc/firefox/gimp) does not work.
It turns out that if you used your Linux distro before with VcXserv, even after uninstall it, it left something in your Linux distro's /tmp/.X11-unix folder. The trick is to simply remove this folder, and create a symbolic link to /mnt/wslg/.X11-unix, and everything work now for me.
sudo ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix
I ran into the exact same issue with X11 apps. This resolved it for me. Thanks @yanghao!
none of this helped. I had this working before until ubuntu reinstall. I get no windowed app displaying. I had chrome launch but wont maximize. Neither will Qemu. I see circular references with no socket in here. This is a fresh install on Windows 11
.X11-unix -> /mnt/wslg/.X11-unix
danielr@Harry:/mnt/wslg/.X11-unix/.X11-unix/.X11-unix/.X11-unix$
For anyone who stumbled upon this issue and the above comments didn't help, what worked for me is realizing that I was still manually setting $DISPLAY
in my .bashrc
file. Removing that did the trick.
I also got this error too. However, my use case is by launching wsl
on login. More details below. Migrated from https://github.com/microsoft/WSL/issues/8217
Windows version: 10.0.22000.593
5.10.102.1
ArchWSL
Emacs 29.0.50 (master branch)
GUI apps (in my case emacs
) should be able to open
GUI apps cannot open. In my case (emacs
), following error returned:
(emacs:1360): Gtk-WARNING **: 12:35:51.668: cannot open display: :0
wsl --shutdown
and re-open WSL, GUI apps will be able to open.In case any body couldn't find the solution from any of the above (because none did for me)... I had a ~/.wslconfig
file with some options set that was disabling forwarding (it was needed for W10), so mayyybe check if you added any extra config files. :)
Edit: Re-reading the title, I wanted to clarify, my solution did not fix the "Can't open display" error in the title. This fixed the error where calling an X app "started" but it went to a hang state and nothing happened.
Not sure if it helps anyone, but I had similar issue where wayland application (e.g. gedit) works but X11 application (e.g. xclock/xcalc/firefox/gimp) does not work.
It turns out that if you used your Linux distro before with VcXserv, even after uninstall it, it left something in your Linux distro's /tmp/.X11-unix folder. The trick is to simply remove this folder, and create a symbolic link to /mnt/wslg/.X11-unix, and everything work now for me.
sudo ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix
This in combination with this article https://bobcares.com/blog/dbus-launch-terminated-abnormally/ solved it for me
I have a similar issue. It began when I updated the graphics driver on my system as encouraged by https://devblogs.microsoft.com/commandline/wslg-architecture/#hardware-accelerated-opengl.
Details as requested on https://github.com/microsoft/wslg/wiki/Diagnosing-%22cannot-open-display%22-type-issues-with-WSLg#still-having-a-problem, starting a fresh launch of the container:
wjt@Simulant:/mnt/c/Users/wjt$ cat /mnt/wslg/versions.txt WSLg ( x86_64 ): 1.0.26+Branch.main.Sha.26ce2c09b86442f3c7f4f6462f770ed2afa76a25 Mariner: VERSION="1.0.20210224" FreeRDP: b05321cd4e6a862aef76163a69db4e1910245736 weston: 46756d0e77e5c01b5995fbbee6f3ab0db9b30612 pulseaudio: 2f0f0b8c3872780f15e275fc12899f4564f01bd5 mesa: wjt@Simulant:/mnt/c/Users/wjt$ echo $DISPLAY :0 wjt@Simulant:/mnt/c/Users/wjt$ ls -la /tmp/.X11-unix lrwxrwxrwx 1 root root 19 Nov 9 17:12 /tmp/.X11-unix -> /mnt/wslg/.X11-unix wjt@Simulant:/mnt/c/Users/wjt$ ls -la /tmp/.X11-unix/ total 0 drwxrwxrwx 2 root root 60 Nov 9 17:12 . drwxrwxrwt 6 root root 260 Nov 9 17:12 .. srwxrwxrwx 1 wjt users 0 Nov 9 17:12 X0
OK, great, we see the socket is present. Now, let's watch
/mnt/wslg/weston.log
as I start an X11 application:wjt@Simulant:/mnt/c/Users/wjt$ tail -n0 f /mnt/wslg/weston.log & [2] 37 wjt@Simulant:/mnt/c/Users/wjt$ glxinfo -B [17:14:24.899] Spawned Xwayland server, pid 71 [17:14:27.332] xserver crashing too fast: 134 Error: unable to open display :0 [2]+ Done tail -n0 f /mnt/wslg/weston.log wjt@Simulant:/mnt/c/Users/wjt$ ls -la /tmp/.X11-unix/ total 0 drwxrwxrwx 2 root root 40 Nov 9 17:14 . drwxrwxrwt 6 root root 260 Nov 9 17:12 ..
The socket is gone. I see the same "xserver crashing too fast" warning in @tys203831's report above. I see they also have a lower-end CPU -- mine is a
Intel(R) Pentium(R) Silver N5000 CPU @ 1.10GHz
.
I have exactly the same issue. Just my CPU is N5105. The driver and X0 can be found when WSL starts up. But X0 disappeared after running glxgears.
admin_yt@DESKTOP-UBT2LUH:~$ ll /usr/lib/wsl/drivers/ | grep iigd*
dr-xr-xr-x 1 root root 4096 Jul 10 18:36 iigd_dch.inf_amd64_1dc9fc8d5e442f6a/
dr-xr-xr-x 1 root root 4096 Jul 10 18:37 iigd_dch.inf_amd64_3ad50285c3647623/
admin_yt@DESKTOP-UBT2LUH:~$ ll /tmp/.X11-unix/
total 4
drwxrwxrwx 2 root root 60 Jul 10 19:00 ./
drwxrwxrwt 3 root root 4096 Jul 10 19:00 ../
srwxrwxrwx 1 admin_yt admin_yt 0 Jul 10 19:00 X0=
admin_yt@DESKTOP-UBT2LUH:~$ glx
glxdemo glxgears glxheads glxinfo
admin_yt@DESKTOP-UBT2LUH:~$ glxgears
Error: couldn't open display :0
admin_yt@DESKTOP-UBT2LUH:~$ ll /tmp/.X11-unix/
total 4
drwxrwxrwx 2 root root 40 Jul 10 19:10 ./
drwxrwxrwt 3 root root 4096 Jul 10 19:00 ../
admin_yt@DESKTOP-UBT2LUH:~$
@RyanClementsHax
For anyone who stumbled upon this issue and the above comments didn't help, what worked for me is realizing that I was still manually setting
$DISPLAY
in my.bashrc
file. Removing that did the trick.
And does env | grep -i display
show DISPLAY=:0
[ and WAYLAND_DISPLAY=wayland-0
] by default after you removed your overriding of it in your ~/.bashrc customizations? That's what mine shows and i'm still having this issue.
PS C:\Users\myusername> wsl --version
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.25182.1000
PS C:\Users\myusername>
I have a fresh install of win11 22h2, presumably the guaranteed to work starting point case, and for setup of wslg[ui] apps support i used the currently recommended wsl --install [ --distribution Ubuntu ]
process.
I then rebooted and opened wslg using the Ubuntu on Windows
shortcut and the windows terminal Ubuntu
entry. Doing a uname -r
outputs 5.15.57.1-microsoft-standard-WSL2
and head -n 2 /etc/os-release
produces NAME="Ubuntu" \n VERSION="20.04.4 LTS (Focal Fossa)"
From there i did a sudo apt install x11-apps && xcacl or xeyes
which produces the error output Error: Can't open display: :0
. Tried sudo apt install gimp && gimp
which produces the error output Cannot open display:
.
Based on some other search hits i also tried running xfwm4
which produces the error output (xfwm4:693): Gtk-WARNING **: 18:44:27.098: cannot open display: :0
. Based on suggestions above, mentioned in other search hits as well, i tried running ls -alF /tmp/.X11-unix && sudo rm -r /tmp/.X11-unix
which produces rm: cannot remove '/tmp/.X11-unix': Device or resource busy
so that leaves me unable to try the next step that is supposed to follow that ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix
.
My ~/.bashrc
is not making any modifications to default display environment variable settings such that env | grep -i display
shows them as being WAYLAND_DISPLAY=wayland-0
and DISPLAY=:0
. I have no ~/.wslconfig
file present as someone noted above. This is a fresh win11 22h2 install that has never had any 3rd party windows xserver or wsl Ubuntu xclient components installed .
I thought at this point in the game that a clean install wslg on a fresh repave of win11 21h2 and/or the very soon to be released win11 22h2 would support launching of gui apps with no special investigations and fixes required.
Am i overlooking some secret sauce or have i somehow installed a standard issue desktop app or made an OS configuration setting that creates a problem?
@myusrn
(if docker desktop is running, close that first)
sudo umount /tmp/.X11-unix
sudo rm -rf /tmp/.X11-unix
sudo ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix
then open windows command prompt and restart WSL
I did wsl --shutdown
then restarted wsl by re-opening my wsl client
in my case I saw the issue: Can't open display: :0
after the Security upgrade for Microsoft Windows (KB5017328)
I remove it and worked OK
Any possible solution in case I apply the windows upgrade again?
PS C:\WINDOWS\system32> wsl --version 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.22000.918
After 2 days of working fine, the /tmp/.X11-unix folder is once again no longer a symlink, instead it's once again a freshly created folder. (docker also uses it, maybe it's race conditions?)
Probably has something to do with linux cleaning tmp files on restart as the internet says
In short, don't store something you want on next boot in /tmp. Store it elsewhere. Like /var/tmp. Or your $HOME.
In my case /tmp/.X11-unix
was a folder too. I'm also using Docker Desktop.
I was able to fix it by adding guiApplications=false
in .wslconfig
, then wsl --shutdown
, removing the line and wsl --shutdown
again.
Share all the steps I follow for working after update with systemd and tempfiles.d
In my case, I am running 2 separate WSL2 distros. One of them worked fine, and the other was showing the errors mentioned here. It seems the display address for the 2nd WSL distro is actually ":1", not ":0". To know for sure, I used ls /tmp/.X11-unix
:
ubuntu-wsl2 :: ~ » ls /tmp/.X11-unix
X1
X1 refers to ":1", so I simply set the DISPLAY variable to that.
export DISPLAY=:1
And it works fine now!
I have a similar issue. It began when I updated the graphics driver on my system as encouraged by https://devblogs.microsoft.com/commandline/wslg-architecture/#hardware-accelerated-opengl.
... OK, great, we see the socket is present. Now, let's watch
/mnt/wslg/weston.log
as I start an X11 application: ... The socket is gone. I see the same "xserver crashing too fast" warning in @tys203831's report above. I see they also have a lower-end CPU -- mine is aIntel(R) Pentium(R) Silver N5000 CPU @ 1.10GHz
.
I am having this (or very similar) issue. WSLg used to work. I can't say if it stopped today or a week ago as I didn't use it for a while, and I did have an update of both Windows and drivers in meantime. I also had a bluescreen from wsl --shutdown
couple of times. But I have RTX 3060 + 5800H laptop... so neither is Intel nor low end.
Thing is that if I start WSL and look for socket immediately, it's there. Sometimes xeyes
even starts the app. But even with xeyes running I can't start eg. xcalc anymore, and xeyes would keep running until closed manually. But won't start after that either.
I don't have much in this WSL, so I will try to remove it completely and install from scratch, as all other suggestions failed.
I think I have found the issue with my setup. Well, part of it.
I've reinstalled the distro, tried several restarts and stuff, and x11-apps worked until I installed one more app :
apt-get install network-manager-gnome
This pulled 450MB of dependencies, and until I finished session, everything worked, but after WSL restarted I started getting the display error again. Removing this package did not help fixing the bug, so I'm pretty sure it's one of (many) dependencies. Which one? I couldn't say.
I've opted to just not use this app, it was just for fun/test anyway, and if it breaks WSLg then it's on my blacklist.
Now, since this same dependancy could'vebeen pulled by any of apps people used in this thread, perhaps it's doable to cross-reference all the apps and dependencies to hunt it down. But I'll leave that to someone more interested in WSLg.
Edit: To clarify, I did reinstall again, and kept playing with Ubuntu and WSLg, all fine.. then this app, WSL shutdown, WSL start and - error.
Worked fine with no issues for me on Ubuntu 22.04.1 LTS, installed the package, closed terminal, opened again and GUI apps still work. Even tried running wsl --shutdown to see if that would cause it and after linux booted back up GUI apps still work
I had the same issue and fixed it by installing Intel Driver and Support Assistant. It installed an updated graphics driver and all is now working.
https://www.intel.com/content/www/us/en/support/intel-driver-support-assistant.html
Environment
Steps to reproduce
Problem 1: Can't open display: :0
wsl --update
in windows terminal) and before that make sure "Virtual Machine Platform", "Windows Hypervisor Platform" and "Windows Subsystem for Linux" are turned on in Windows Features.sudo apt update && sudo apt upgrade
in wsl terminalwsl xeyes
. (Note: when I runxeyes
on wsl terminal, it just hangs for a long time and not show up any app)Result: Error: Can't open display: :0
Problem 2: X11-server is not running
ls /tmp/.X11-unix
Result: show no results, and thus suspect X11-server not running.
WSL logs:
Attach WSLg logs from
/mnt/wslg
You can access the wslg logs using explorer at:\\wsl$\<Distro-Name>\mnt\wslg
(e.g.:\\wsl$\Ubuntu-20.04\mnt\wslg
)pulseaudio.log
pulseaudio.logweston.log
weston.logversions.txt
versions.txtOther logs info:
Expected behavior
GUI running without need of other third-party X11-servers such as Vcxsrv.
Actual behavior
Error: Can't open display: :0. Still needs Vcxsrv to open linux gui apps.