I am trying to get GUIs working with WSL2, but nothing I tried works.

  1. I turned off the Firewall for home networks (just for testing).
  2. I started Vcxsrv with the following options: Multiple Windows, Display Number: -1, Start no client, Clipboard (with Primary Selection), Native OpenGL and Disable access control.
  3. In Ubuntu, I entered: export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
  4. Then I also entered: export LIBGL_ALWAYS_INDIRECT=1

After having done that, I tried to execute some programs that used to work under WSL1.

In the case of nemo, I get the following error:

Unable to init server: Could not connect: Connection refused
Could not parse arguments: Cannot open display:

When trying to run gedit, I get the following error:

Unable to init server: Could not connect: Connection refused

(gedit:6704): Gtk-WARNING **: 01:07:05.762: cannot open display:

Entering echo $DISPLAY yields the following output:

I have also uninstalled Ubuntu, manually deleted the remnants from AppData and made a clean reinstall of Ubuntu. In case that is important: I did not create a UNIX account but use root (both before and after reinstalling Ubuntu so there should be no permission issues on the Ubuntu side).

EDIT 1: I also tried to run both Vcxsrv and Ubuntu as administrator, just to rule out any permission problems on the Windows side of things.

I probably should also add, that I am a Windows Insider (fast ring) and that I have this problem ever since I first tried WSL2 about half a year ago. Forcing me to always downgrade to WSL1 since browsing files without Nemo using just the terminal is a real pain in the ... .

New contributor
Willi is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • Just to confirm, you are indeed running Windows 10 version 2004 (19041.153)? – Ramhound Mar 26 at 0:20
  • I am a Windows Insider (fast ring). So WSL2 is available for months now (at least for me). But I have failed to get the GUI working for at least half a year now (and therefore always downgraded back to WSL1). So it is not a bug in my current build. My OS Version is 2004 and my OS build is 19587.1000. Windows update is currently downloading build 19592.1001. – Willi Mar 26 at 0:28
  • I also tried pretty much every variation of export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0 I could find on the Internet. – Willi Mar 26 at 0:30

Your Answer

Willi is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.