No X0 interface reported by ls /tmp/.X11-unix
I followed instructions present here: https://github.com/microsoft/wslg But I wasn't able to make this functionality to work.
With the command:
ls /tmp/.X11-unixIf the X server is running, you should see an X0 socket If you don't please open an issue and attach /mnt/wslg/weston.log to the bug.

Environment
Windows build number: Microsoft Windows NT 10.0.21376.0
Your Distribution version: Debian 10
Your WSLg version: 1.0.19
Steps to reproduce
Trying to open a WSL graphics program through either from the start menu as follows

Or through the shell results in no effect...
Now with the X server VcxSrv and the following zshrc configuration,
# set DISPLAY variable to the IP automatically assigned to WSL2
export LOCAL_HOST=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}')
export DISPLAY=$LOCAL_HOST:0.0
export LIBGL_ALWAYS_INDIRECT=1
the graphics application launches correctly when started from the shell prompt.

WSL logs:
pulseaudio.log weston.log versions.txt
Expected behavior
If I click on Konsole it should open it with not problems when DISPLAY is :0
Actual behavior
The graphics WSL application doesn't launch automatically without VcxSrv. There is no X0 interface when the command ls /tmp/.X11-unix is issued. The only interfaces shown are X10 X11 X12 X13 X14.
See https://github.com/microsoft/wslg/wiki/Diagnosing-%22cannot-open-display%22-type-issues-with-WSLg#x11-display-socket
You need to delete the folder in tmp and create the link like this:
sudo rm -r /tmp/.X11-unix
ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix
See https://github.com/microsoft/wslg/wiki/Diagnosing-%22cannot-open-display%22-type-issues-with-WSLg#x11-display-socket
You need to delete the folder in tmp and create the link like this:
sudo rm -r /tmp/.X11-unix ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix
I just did this. Now when I click on Konsole in start menu, it enters a never ending loop. Opening one Konsole on top of another.
Xfce terminal opens correctly though. Any idea about why Konsole loops like that?
That's https://github.com/microsoft/wslg/issues/64. Fix is coming.
See https://github.com/microsoft/wslg/wiki/Diagnosing-%22cannot-open-display%22-type-issues-with-WSLg#x11-display-socket
You need to delete the folder in tmp and create the link like this:
sudo rm -r /tmp/.X11-unix ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix
Doing this broke signing commits with my gpg key.
For example when I type:
echo "test" | gpg --clearsign
The output is:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
test
gpg: signing failed: Inappropriate ioctl for device
gpg: [stdin]: clear-sign failed: Inappropriate ioctl for device
It was prompting for the GPG password in a GUI before. Now I can't gpg sign any commit. Any ideas on how to revert that change?
Did you try this? https://github.com/keybase/keybase-issues/issues/2798
Did you try this? keybase/keybase-issues#2798
It doesn't work. I believe because I have many GPG keys here. That is one of the reasons why I would like to restore previous smooth GUI functionality. I am not sure if it was being done through VcxSrv before though, I believe so.
with export GPG_TTY=$(tty) It is automatically selecting the wrong key.
To make VcxSrv work again you need to launch it and do sudo rm -r /tmp/.X11-unix and
export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
To make VcxSrv work again you need to launch it and do
sudo rm -r /tmp/.X11-unixandexport DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
VcxSrv is working alright, I can see it working correctly with glxgears command. But gpg signing is dead broke. I am now backing up to install a mint Debian and see if that way this functionality is restored.
To make VcxSrv work again you need to launch it and do
sudo rm -r /tmp/.X11-unixandexport DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
A fresh and clean installation also behaves like this:
echo "test" | gpg --clearsign
and its output:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
test
gpg: signing failed: Inappropriate ioctl for device
gpg: [stdin]: clear-sign failed: Inappropriate ioctl for device
Which exact distro are you running? In Ubuntu 20.04 I just had to install pinentry-curses and it works without needing X11:
$ sudo apt install pinentry-curses
$ export GPG_TTY=$(tty)
$ echo "test" | gpg --clearsign
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
test
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEEbX1y/44FuWCm93QfolWLxdrGb1gFAmCio7EACgkQolWLxdrG
b1i2Cwv9FS9xLpZY01UObVZlFzkyajiv1nBoJC0aj0dZ0QLvZyuooAJwapQYsuXD
NL9CxXLs2HGXAEpkD0WbYVPdywRpzl+1nHilRQesB+q4HN+ka8KcDQ++YA7LV3F8
haW6TmEgNr9cQtwDcA61eWWdpvILJ32PpoYeay3lgqctlZUAXM78FuMSe95Dye+q
VwClwaZ25nt5fq6uxnTAtPVAxZFc2nOL+FSXTPHtKIqHKlyc+o20orizwXCQfglt
B/KvWkN0gtVVhZ+GCJ4bepa4WG44Ve0I2EAs7a3obiCgJAH2guly4w/xduzLSlad
gAueRYhEzR0ieJ2HXojBXl/dmxPyfWBT3gTvZvJCv00Pu5zRGtbzYk8Kz06x1+e6
dB1qfSVDIr4uQrgWyXIXPhfK40KqGsL85gWDSQ0BRsEEi3ii6siFMtc7Ja09Mg8Y
PEYxEB+lFSTCjdYHL9VFVMATOjS7X8wdHBtbTJ8EaGIAuQ4pEKNyTeLUGXfRs/EZ
iW5fKNdS
=Mz0F
-----END PGP SIGNATURE-----
Which exact distro are you running? In Ubuntu 20.04 I just had to install pinentry-curses and it works without needing X11:
$ sudo apt install pinentry-curses $ export GPG_TTY=$(tty) $ echo "test" | gpg --clearsign -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 test -----BEGIN PGP SIGNATURE----- iQGzBAEBCgAdFiEEbX1y/44FuWCm93QfolWLxdrGb1gFAmCio7EACgkQolWLxdrG b1i2Cwv9FS9xLpZY01UObVZlFzkyajiv1nBoJC0aj0dZ0QLvZyuooAJwapQYsuXD NL9CxXLs2HGXAEpkD0WbYVPdywRpzl+1nHilRQesB+q4HN+ka8KcDQ++YA7LV3F8 haW6TmEgNr9cQtwDcA61eWWdpvILJ32PpoYeay3lgqctlZUAXM78FuMSe95Dye+q VwClwaZ25nt5fq6uxnTAtPVAxZFc2nOL+FSXTPHtKIqHKlyc+o20orizwXCQfglt B/KvWkN0gtVVhZ+GCJ4bepa4WG44Ve0I2EAs7a3obiCgJAH2guly4w/xduzLSlad gAueRYhEzR0ieJ2HXojBXl/dmxPyfWBT3gTvZvJCv00Pu5zRGtbzYk8Kz06x1+e6 dB1qfSVDIr4uQrgWyXIXPhfK40KqGsL85gWDSQ0BRsEEi3ii6siFMtc7Ja09Mg8Y PEYxEB+lFSTCjdYHL9VFVMATOjS7X8wdHBtbTJ8EaGIAuQ4pEKNyTeLUGXfRs/EZ iW5fKNdS =Mz0F -----END PGP SIGNATURE-----
I am using Debian 10.
In Debian 10 pinenty-curses is already installed when you install gnupg. With exporting GPG_TTY, it just worked for me. I'm not sure of the reason it wasn't working before. Maybe because I was with more than one GPG key in the keyring.
Hi @David-Kneel, WSL's custom init will initialize /tmp/.X11-unix as a link to /mnt/wslg/.X11-unix before launching your user profile. It looks like something on your profile is deleting this link and recreating /tmp/.X11-unix as a standard directory. systemd (which isn't currently officially supported in WSL/WSLg) for example is known to do that, maybe VcxSrv as well, i'm not sure. If you could help identify what in your profile end up resetting the work WSL init did that would be great.
I reinstalled a fresh Debian from Windows Store. And a fresh xfce4 and KDE Plasma user interfaces too through taskel command. Because KDE needs systemd for some of its functionalities, to make systemd work I followed this.
Because I use zshell rather than bash, to .zprofile I added:
source /usr/sbin/start-systemd-namespace
sudo rm -rf /tmp/.X11-unix
ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix
Now I can launch the applications through KDE start menu and they seem to work perfectly even the icon in windows is alright but also the application itself seems perfectly functional. There is one small catch though in Konsole. If launched directly from the shell, it is able to render bold characters correctly. But the icon shown in Windows taskbar is wrong. Now if launched from KDE start menu, instead of bold, konsole displays brighter characters and the icon in Windows taskbar is displayed correctly.
You can see a screenshot bellow of the applications launched by KDE startMenu:

See that Konsole is rendering the folder Tachyonic in brighter characters, where they should actually be bold.
Now if Dolphin and Konsole are launched by the shell, the result is:

Here the icons displayed in the Windows taskbar are not correctly displayed. And Dolphin icons are also missing... The same happens with Kmail.
ls -a /mnt/wslg only gives me . .., no X0. It worked once a few days ago. Now it's broken.
@wegylexy It looks like the system distro is not mounted. Run wsl.exe --shutdown and launch a WSL2 distro. Post the output of these from the terminal:
lsblk
wsl.exe -l -v
@onomatopellan
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 256G 0 disk
sdb 8:16 0 256G 0 disk /
wsl.exe -l -v
NAME STATE VERSION
* Ubuntu Running 2
docker-desktop Stopped 2
Alpine Stopped 2
docker-desktop-data Stopped 2
No more wslg. By the way, Docker Desktop started automatically at login needa be killed and restarted for docker engine to actually start. Wonder if there's anything else that's not started properly.
@wegylexy Definitely the system distro is not mounted. From an elevated cmd run wsl.exe --update. What it shows?
An error occurred mounting one of your file systems. Please run 'dmesg' for more details.
init: (1) ERROR: MountPlan9WithRetry:285: mount drvfs on /mnt/d (cache=mmap,noatime,msize=262144,trans=virtio,aname=drvfs;path=D:\;uid=1000;gid=1000;symlinkroot=/mnt/
ls -la /mnt
total 20
drwxr-xr-x 8 root root 4096 May 22 03:50 .
drwxr-xr-x 19 root root 4096 May 30 04:41 ..
drwxrwxrwx 1 timtim timtim 512 May 30 04:38 c
drwxrwxrwx 2 root root 4096 Jul 11 2020 d
drwxrwxrwx 2 root root 4096 Jul 11 2020 p
drwxrwxrwx 1 timtim timtim 4096 May 29 16:53 s
drwxrwxrwt 2 root root 60 May 30 04:41 wsl
drwxr-xr-x 2 root root 4096 May 22 03:50 wslg
@wegylexy Is D: a USB pendrive or sdcard? If so remove it and try again.
BTW is there something special with D partition? Is it encrypted? Are you running a custom kernel via .wslconfig?
@onomatopellan It's HDD and it mounts fine after restart. Running default stuff, kernel 5.10.16
@wegylexy Right now it's like if you didn't have WSLg installed. So you can go to Add/Remove programs, uninstall the WSLg package and try wsl.exe --update again. If it still doesn't work install it manually from https://github.com/microsoft/wslg/releases/download/v1.0.22/wsl_graphics_support_x64.msi
@onomatopellan nice, reinstalling wslg fixes it.
So when will this be fixed? Symlinking is just a temporary fix. WSL resets /tmp/.X11-unix/ on every initialization.
This worked well for me: rm -r /tmp/.X11-unix; ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix.
However, it's inconvenient to have to enter this command every time.
As a workaround, I registered it as a service.
Create the following file: /etc/systemd/system/wsl2-x11-fix.service
[Unit]
Description=WSL2 X11 Fix
[Service]
ExecStart=/bin/sh -c 'rm -r /tmp/.X11-unix; ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix'
Type=oneshot
RemainAfterExit=true
[Install]
WantedBy=multi-user.target
Then enter:
sudo systemctl enable wsl2-x11-fix --now
I understand this is not a good method, but it works well.