Comments (2)
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
from wsl-tutorial.
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
.
from wsl-tutorial.
Related Issues (9)
- /etc/dbus-1/session.conf file does not exist HOT 2
- xrdp Can't open display.
- How to change the resolution?
- how to add sogoupinyin input method?
- `apt-get install` unable to locate font packages HOT 4
- Under the new Ubuntu 18.04, /etc/dbus-1/session.conf no longer exists HOT 4
- /etc/dbus-1/sesson.conf doesn't exist HOT 2
- GitHub Releases
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wsl-tutorial.