Open lackovic opened 4 years ago
The problem was the IP address.
On Windows I have:
> ipconfig.exe
Ethernet adapter vEthernet (WSL):
Connection-specific DNS Suffix . :
IPv4 Address. . . . . . . . . . . : 192.168.96.1
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . :
Ethernet adapter Ethernet:
Connection-specific DNS Suffix . : lan
IPv4 Address. . . . . . . . . . . : 192.168.1.238
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
where the former refers to the WSL instance, while the latter refers to the Windows host.
For some reason WSL resolves its own IP address as nameserver
:
$ cat /etc/resolv.conf
/etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 192.168.96.1
Manually entering the IP of the Windows host has fixed the issue for me:
DISPLAY=192.168.1.238:0
I wonder whether this a problem with my specific system configuration or they changed something in WSL 2 recently that made this setup not working anymore.
Can anyone confirm whether the display server specification is still working for them?
Does anyone know another way to get the host IP address other than using resolv.conf
?
Using Windows 10 Version 2004 Build 19041.330
.
Hello guys :)
had the same issue and changing the DISPLAY variable from the WSL vEthernet-Adapter to the Ethernet Adapter was working fine like you said @lackovic . In order to automate it i replaced in the ./bashrc file:
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
to (the first ipv4 Address in the command ipconfig.exe) - hacky solution i don't like it, but it did the job for me:
export DISPLAY=$(ipconfig.exe | awk '/IPv4/ {sub("\r",":0"); print $NF;exit}')
Since this is a really hacky solution and i saw everyone getting the ip address from the /etc/resolv.conf file, i investigated the issue a little bit more. The /etc/resolv.conf file should hold the ipv4 address of the vEthernet (WSL) Adapter. So the DISPLAY=192.168.96.1:0
in the post above should also be fine. I wanted to give up, but after lots of investigation i figured out that the windows firewall was causing this issue. If i deactivated the the firewall for the (open profile in system settings in windows), restarting the xserver and the wsl, i was able to open my display (in my case it was intelliJ /opt/idea/bin/idea.sh ).
With this knowledge i stopped the xserver on windows, activated the windows firewall again, activated the logging (for blocking rules) in the windows firewall. But the logfile did not ouput anything useful.
After that i checked the firewall and checked all the the xserver authorization rules. It is really important that all checkboxes for the server are checked (especially the public one was causing the trouble on my side):
Restart firewall, xserver and wsl and everything was working fine. I think i missed this to check the box when xserver was running the first time. And after that it is finally running with the (WSL vEthernet ip) in the /etc/resolv.conf :-) Hope it helps someone with the same issue.
Thanks and best regards Andy
Following wsl2-tutorial - using ArchLinux instead of Ubuntu - I get the following error when I try to run
startxfce4
:$ env | grep -i dbus
returns an empty result.So I run
$ export $(dbus-launch)
and then:With that I got rid of the unable to connect to D-Bus error, but then I got another one:
Some other info:
Any idea where the problem could be and how I can fix it?