WSL 2, GUI Applications using XServer

1

I've seen this question before, but none of the solutions are working for me. I know the steps that are mentioned everywhere to get GUI applications working for WSL 2 on the Windows 10 Pro Insider Preview.

  1. Install XServer on your windows 10 machine (here I used VcXsrv)
  2. Run the XServer
  3. Install something in WSL 2 that you want to display (for me it was terminator)
  4. Run DISPLAY=:0 terminator -u to get it running.

However, when I do number 4, I get:

Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused
You need to run terminator in an X environment. Make sure $DISPLAY is properly set

When I echo $DISPLAY it returns :0 as expected.

When I try to open something simple like xclock I get Error: Can't open display: :0

The X server is definitely running as I set it up and it exists in the Windows 10 system tray. I've tried many configurations for the X server, and I get the same thing every time. I've also tried just setting the $DISPLAY in the .bashrc file, with the same results.

I've also tried the solutions proposed here, by exporting DISPLAY to localhost:0.0, which the same results (also tried 0.0, :0, and a few others).

I've tried rebooting, uninstalling and reinstalling things, and I get the same results every time. I'm not sure what to try next.

trueCamelType

Posted 2019-08-29T00:24:27.180

Reputation: 429

Question was closed 2019-08-29T05:26:34.260

Answers

-1

You need to export your display so use:

export DISPLAY=:0.0

Keltari

Posted 2019-08-29T00:24:27.180

Reputation: 57 019

I've already tried exporting DISPLAY to :0.0, localhost:0.0, and :0. In the instructions I linked it said to export it, and in my solution I said I "set" it, but I should have said export. – trueCamelType – 2019-08-29T02:28:45.820