2

I have enabled the feature "Windows Subsystem for Linux" in MS-Windows 10, and installed Ubuntu-20.04. One with WSL1 and one with WSL2. Also, installed the VcXsrv tool, and it's running on the MS-windows machine.

I can run GUI Applications on the instance which is enabled with WSL1, however on the instance with WSL2 enabled, I can't run any GUI Application. It says "Error: Can't open display: :0.0"

Please find few outputs from Host and Linux Instance Below:

From Windows 10:

❯ ipconfig

Windows IP Configuration
Ethernet adapter Ethernet 4:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Ethernet adapter Ethernet:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Ethernet adapter vEthernet (WSL):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::102:a949:2437:16e9%55
   IPv4 Address. . . . . . . . . . . : 172.23.224.1
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :

Wireless LAN adapter Local Area Connection* 10:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Local Area Connection* 11:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Wi-Fi:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::a5b7:d11b:52b0:23d6%9
   IPv4 Address. . . . . . . . . . . : 192.168.1.4
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : fe80::1%9
                                       192.168.1.1

Ethernet adapter Bluetooth Network Connection:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

❯ wsl -l -v
  NAME            STATE           VERSION
* Ubuntu-20.04    Running         2
  Ubuntu          Running         1

From Ubuntu (WSL1) - UI Application Working Fine (i.e xclock, xeyes)

$ ifconfig -a
eth0: flags=64<RUNNING>  mtu 1500
        inet 169.254.226.136  netmask 255.255.0.0
        inet6 fe80::b0cd:dad8:df85:e288  prefixlen 64  scopeid 0xfd<compat,link,site,host>
        ether 80:19:34:d2:45:55  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=64<RUNNING>  mtu 1400
        inet 10.83.242.31  netmask 255.255.255.255
        inet6 fe80::d8f9:f80:42f7:4681  prefixlen 64  scopeid 0xfd<compat,link,site,host>
        ether 02:50:41:00:00:01  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth2: flags=64<RUNNING>  mtu 1500
        inet 169.254.8.40  netmask 255.255.0.0
        inet6 fe80::41af:dac3:4f41:828  prefixlen 64  scopeid 0xfd<compat,link,site,host>
        ether 34:e6:d7:1f:97:fc  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.23.224.1  netmask 255.255.240.0  broadcast 172.23.239.255
        inet6 fe80::102:a949:2437:16e9  prefixlen 64  scopeid 0xfd<compat,link,site,host>
        ether 00:15:5d:f7:dc:5c  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth4: flags=64<RUNNING>  mtu 1406
        unspec [NONE SET]  netmask 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
        ether 00:05:9a:3c:7a:00  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth5: flags=64<RUNNING>  mtu 1300
        unspec [NONE SET]  netmask 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
        ether 02:05:85:7f:eb:80  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 1500
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0xfe<compat,link,site,host>
        loop  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wifi0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.4  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::a5b7:d11b:52b0:23d6  prefixlen 64  scopeid 0xfd<compat,link,site,host>
        ether 80:19:34:d2:45:51  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wifi1: flags=64<RUNNING>  mtu 1500
        inet 169.254.12.30  netmask 255.255.0.0
        inet6 fe80::551a:4119:9646:c1e  prefixlen 64  scopeid 0xfd<compat,link,site,host>
        ether 80:19:34:d2:45:52  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wifi2: flags=64<RUNNING>  mtu 1500
        inet 169.254.80.242  netmask 255.255.0.0
        inet6 fe80::7548:77de:4bf6:50f2  prefixlen 64  scopeid 0xfd<compat,link,site,host>
        ether 82:19:34:d2:45:51  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

$ echo $DISPLAY
:0.0

$ cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 192.168.1.1
nameserver fec0:0:0:ffff::1
nameserver fec0:0:0:ffff::2

From Ubuntu-20.04 (WSL2): UI Apps Not Working (i.e xclock, xeyes)

❯ ifconfig -a
bond0: flags=5122<BROADCAST,MASTER,MULTICAST>  mtu 1500
        ether ba:e3:e3:6e:20:3d  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

dummy0: flags=130<BROADCAST,NOARP>  mtu 1500
        ether be:be:bb:8a:8f:a0  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.94.115  netmask 255.255.240.0  broadcast 172.17.95.255
        inet6 fe80::215:5dff:fe8e:25e5  prefixlen 64  scopeid 0x20<link>
        ether 00:15:5d:8e:25:e5  txqueuelen 1000  (Ethernet)
        RX packets 34  bytes 4988 (4.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12  bytes 936 (936.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 2  bytes 100 (100.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2  bytes 100 (100.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

sit0: flags=128<NOARP>  mtu 1480
        sit  txqueuelen 1000  (IPv6-in-IPv4)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

❯ cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 192.168.1.1
nameserver 172.17.80.1

Error in WSL2 when trying to access GUI Apps:

❯ xeyes
Error: Can't open display: :0.0

❯ echo $LIBGL_ALWAYS_INDIRECT
1

❯ echo $DISPLAY
:0.0

Note: Also tried exporting different IPs (192.168.1.1, 192.168.1.4) to DISPLAY variable in WSL2 instance but none helped.

Additional Information:

  • From WSL1 (Ubuntu) instance I am able to ping the IP Address of the host (192.168.1.4) successfully. Also telnet to port 6000 (vcxsrv) port is getting connected.
  • However from the WSL2 (Ubuntu) instance I am not able to ping the IP Address of my host (192.168.1.4). Also telnet to port 6000 it says no route.
  • Already followed all the steps mentioned in this thread which includes adding the firewall rule for port 6000 but it doesn't seem to resolve the issue.

From WSL1:

$ telnet 192.168.1.4 6000
Trying 192.168.1.4...
Connected to 192.168.1.4.
Escape character is '^]'.

From WSL2:

❯ telnet 192.168.1.4 6000
Trying 192.168.1.4...
telnet: Unable to connect to remote host: No route to host

Query / Help:

  • Is there a difference in networking? when it comes to WSL1 and WSL2 setup? If yes, how can we fix the current issue that I am facing and how can we run GUI Application in WSL2 instance?

  • Just to note, from WSL2 instance I am not able to ping the Host. Similarly from the Host, not able to ping the WSL2 instance.

Gokulnath Kumar
  • 85
  • 1
  • 2
  • 18

1 Answers1

0

My .bashrc file contains the following lines. Maybe have a look at the export DISPLAY lines and modify them as needed to reflect your display.

# Added code for Windows Xwinrc
export DISPLAY=:0;
#export DISPLAY=localhost:0.0
#export LIBGL_ALWAYS_INDIRECT=1
#export GDK_DPI_SCALE=1
weaponG
  • 1
  • 1