Configure Xming display on WSL2

Ori5678 picture Ori5678 · Aug 4, 2020 · Viewed 9.9k times · Source

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:

  • Xming :0 -multiwindow -clipboard
  • XdmcpRegisterConnection: newAddress 172.27.16.1
  • Could not init font path element C:\Program Files (x86)\Xming/fonts/100dpi/, removing from list! (there are a few of these)
  • winInitMultiWindowWM - DISPLAY=127.0.0.1:0.0
  • winInitMultiWindowWM - XOpenDisplay () returned and successfully opened the display.
  • winMultiWindowXMsgProc - XOpenDisplay () returned and successfully opened the display.
  • winClipboardProc - XOpenDisplay () returned and successfully opened the display.

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?

Answer

Ori5678 picture Ori5678 · Aug 29, 2020

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