I'm using WSL2 with Ubuntu 20.04, and I have a problem trying to run Qt apps, currently discussed in this question. The gist of it is that Qt calls a plugin, xcb
, that tries to connect to a display. When I launch WSL2 from Windows GUI, this display changes.
From what I understand, WSL2 changes network parameters on startup, and I would like to know precisely what happens. Is there a config file I can find?
Specifically, this is what happens:
- From Windows
cmd
, I runwsl ~ -e bash --norc --noprofile
- Ubuntu Bash opens in CMD window, I run
$ xeyes
. Xeyes opens, works well - I start Ubuntu in a new window from a shortcut on my Desktop, to have the session on which I usuallly work
$ xeyes
returnsError: Can't open display: :0
- From Windows
cmd
, I close WSL2 withwsl.exe --shutdown
- From Windows
cmd
again, I restart WSL2:wsl ~ -e bash --norc --noprofile
- Ubuntu Bash opens in CMD window, I run
$ xeyes
$ xeyes
returnsError: Can't open display: :0
My conclusion from this is that a value was changed somewhere when I started WSL2 from the GUI. For instance, the DISPLAY variable, but if I print it before and after starting WSL2, it always prints $DISPLAY: :0
.
xeyes
from the Terminal app inside the Desktop, or from the WSL terminal? – NotTheDr01ds Sep 12 '22 at 12:35wsl --install
. Ubuntu 20.04 was installed by default, I think. When I runwsl -v -l
, I only have Ubuntu and CentOS (installed but never run or used). The "shortcut" is precisely that, I usually launch my WSL2 session from a Windows shortcut, from the taskbar. I think I did a "pin to taskbar" when it it was running. (2) The first and last times (point 2 and 7 in my list), from the Terminal inside the Desktop. The second time (point 4 in my list), from the WSL terminal -- the thing that I would like to get working. – rss.clement Sep 12 '22 at 13:02wsl --install
. Did you use something like Distrod? Or do you mean something different by "Ubuntu Desktop"? – NotTheDr01ds Sep 12 '22 at 13:07