• Windows 10 Build 18922

Unlike WSL1, you cannot use 127.0.0.1 or localhost to connect back to Windows; when you start WSL2, it gets its own IP address and behaves like a Hyper-V virtual machine. Microsoft seems to be working on changing this behavior and support shared loopback addresses just like WSL1 but it's not yet happened.

Anyhow, if you don't want to wait for the official release of WSL2 or support for the shared loopback addresses, you can make the following changes and use Linux GUI apps in WSL2 with X410.

  • Enable 'Allow Public Access' option in X410

    When you first install X410, it only allows connections from loopback addresses such as 127.0.0.1 for security reasons. But WSL2 is started with its own IP address and behaves like a virtual machine in a separate network. So you first need to allow connections from any device for X410.

    Please also check Windows Firewall settings and make sure X410 is allowed for 'Public' access.

  • Update DISPLAY environment variable

    WSL2 has its own IP address and doesn't yet share loopback addresses; when you're connecting to 127.0.0.1, you're actually connecting to WSL2 rather than the underlying Windows. So you need to directly use the IP address assigned for Windows.

    We recommend using the internal IP address that is automatically added to '/etc/resolv.conf' file in WSL2. This address may get changed periodically. So you should dynamically extract an address from the file when assigning it to the DISPLAY environment variable:

    export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0