0

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 run wsl ~ -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 returns Error: Can't open display: :0
  • From Windows cmd, I close WSL2 with wsl.exe --shutdown
  • From Windows cmd again, I restart WSL2: wsl ~ -e bash --norc --noprofile
  • Ubuntu Bash opens in CMD window, I run $ xeyes
  • $ xeyes returns Error: 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.

  • Hi, have you tried GWSL or/and WSLG? – pa4080 Sep 12 '22 at 11:11
  • 1
    "I start Ubuntu Desktop from the shortcut" - So that's something that didn't come up in the other question. (1) What do you mean by this? What "shortcut"? How did you install Ubuntu Desktop under WSL? As I mention in this answer Ubuntu Desktop / Gnome requires Systemd, which isn't well supported under WSL2. (2) If the desktop is running, are you launching xeyes from the Terminal app inside the Desktop, or from the WSL terminal? – NotTheDr01ds Sep 12 '22 at 12:35
  • @NotTheDr01ds, good point. (1) I think WSL2 was installed using CMD, as in, wsl --install. Ubuntu 20.04 was installed by default, I think. When I run wsl -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:02
  • @rss.clement But do you really mean "Ubuntu Desktop", as in the GUI desktop with Gnome? That's not installed with WSL with a wsl --install. Did you use something like Distrod? Or do you mean something different by "Ubuntu Desktop"? – NotTheDr01ds Sep 12 '22 at 13:07
  • 1
    Nonono, no GUI on my Ubuntu, no Gnome, nothing. Just the default WSL install. I didn't use Distrod. Saying Ubuntu Deskstop was a big mistake, I meant starting WSL from Windows (opens Ubuntu bash in a new window), as opposed to starting WSL from the Terminal. Tried to clarify that in an edit – rss.clement Sep 12 '22 at 13:13

0 Answers0