wslg: Cannot launch gui apps with 2.0.12
Windows Version
11
WSL Version
2.0.12
Are you using WSL 1 or WSL 2?
- WSL 2
- WSL 1
Kernel Version
No response
Distro Version
Fedora
Other Software
No response
Repro Steps
I usually launch GUI apps from the windows start menu but after upgrading to 2.0.12, the apps wouldn’t start. wsl --list --running showed the distro running for a few seconds and then it shutdown. I am able to start WSL from the command line but when I try to launch a gui app such as konsole, I get this error:
qt.qpa.xcb: could not connect to display :0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.
Aborted (core dump)
There were no issues with 2.0.11
Expected Behavior
GUI apps start as usual
Actual Behavior
GUI apps cannot be launched
Diagnostic Logs
No response
About this issue
- Original URL
- State: open
- Created 7 months ago
- Reactions: 3
- Comments: 28
I’m using Arch Linux and have the same issue. I created a fix for this that runs those commands as a systemd service (iirc Fedora comes with systemd as well, but regardless of your distro, as long as it uses systemd, it should work). This means that the service will run those commands on boot.
This is under the assumption that running those commands does not lead to any unforeseen side effects (I haven’t seen any so far, from my understanding, those commands are fine to run…).
1. Creating the systemd service file
Start by creating a systemd service file at the following location,
/etc/systemd/system/
. You can name the service file whatever you like, however, keep in mind that the name of the file must have a suffix ofservice
. Then open the file with your preferred text editor. In my case, I ran the following:Note:
nano
creates a file if it doesn’t exist by default, if your text editor doesn’t do this, you’ll need to create the file first withtouch
.2. Write the scripts for the service
To preface this part, I personally never had anything mounted on
/tmp/.X11-unix
, so running theumount
command for that would result in an error. I would recommend running this command on your terminal just to see if you actually need it or not.In the service file, add the following contents to it:
If you do not need to run the
umount
command, you should remove it, otherwise the service will fail and exit.Now you can save and exit the file.
3. Enable the service
To enable the service, we first need to reload systemd to recognize the new service:
Then we can enable the service on boot:
Note: the name of the service would be the name of the file you created earlier, make sure this matches.
At this point, you can restart WSL and verify if the service worked by running:
If you want to manually start the service without having to restart WSL, you can run the following directly:
To verify that it did work, run
ls /tmp/.X11-unix
and you should see something likeX0
orX1
, indicating your display.Hope this helps, lmk if you need extra clarification.
Disabling systemd in /etc/wsl.conf is a permanent workaround, but not an option for me
Have had a similar problem with GUI applications after updating to WSL 2.0.12.0:
Fixed by running the following commands:
and GUI applications were working again.
Not sure if this survives a WSL virtual machine reboot.
This solution was found here: https://github.com/microsoft/wslg/issues/558#issuecomment-1260817709
I confirm also here same behaviour. Temporarily fixed with this command as root (Does not survive at reboot): rm -rf /tmp/.X11-unix && ln -s /mnt/wslg/.X11-unix /tmp/
Still there with 2.1.3.0
I did try to raise the visibility of this issue by reporting it again in the WSL repo (https://github.com/microsoft/WSL/issues/11064) but the ticket got closed because it didn’t have “steps to reproduce” even though I pointed to this ticket. 😦