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
.