Ori5678
Ori5678

Reputation: 499

Configure Xming display on WSL2

I'm trying to configure an Xming display on my WSL2, and after an amount of troubleshooting attempts, I'm quite clueless.

For details:

System: WSL2 on Windows10Pro
Xming: installed. Some hopefully relevant lines from log:

Firewall:
enter image description here

What I've tried: (on WSL2 terminal)

export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
export LIBGL_ALWAYS_INDIRECT=1

As shown here

export DISPLAY=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):0.0

As shown ni subsequent link here
export DISPLAY=172.27.16.1 (/:0/:0.0) as taken from the Xming log.

Results so far: in all cases I get

No protocol specified
Error: Can't open display: 172.27.16.1:0

or alike

Any advice?

Upvotes: 2

Views: 24652

Answers (5)

j.e.
j.e.

Reputation: 79

In my my case, I had to add XLaunch.exe to the Windows Firewall exceptions. I had Xming.exe added to the firewall when I installed it but not Xlaunch.exe.

To test quickly, just turn-off windows firewall then try running any linux gui app. Of course, you gotta do the export Display command first.

Upvotes: 0

King Sumo
King Sumo

Reputation: 124

Add the IP address in the X0.hosts file (find it in the Xming installation directory). This file defines which hosts it will allow connections from. Other option is to use the -ac option, however this will disable all access control restrictions...

Upvotes: 3

U can use VcxSrv xLaunch use this settings enter image description here

Upvotes: 0

Ori5678
Ori5678

Reputation: 499

Finally, a friend found a solution that worked for me. In short:

  • use putty to open a WSL terminal and export DISPLAY variable as WORKSTATION_IP:0.0
  • in Xlaunch, check the "No Access Control" box.

I've put this as instructions in layman's terms in this short doc

Upvotes: 12

MexicanHatBoy
MexicanHatBoy

Reputation: 81

I had success using

export DISPLAY=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):0.0

with Xming allowed through the Windows firewall for both private and public networks as you did (note for other users there are a couple of entries in the firewall settings for Xming). I then launched Xming using "Xlaunch" (Start > Xming > Xlaunch), selected Multiple Windows and then checked "No Access Control" on the "Specify Parameter Settings" screen. This last step appears to be the key one I was missing. Launching Xming.exe with the -ac option should achieve the same effect.

Upvotes: 8

Related Questions