-
Notifications
You must be signed in to change notification settings - Fork 823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to accessing Windows applications from WSL #4793
Comments
Seems likely that this is related to this issue: #4139 |
I was able to use graphic applications in WSL using XMING and Export DISPLAY=:0.0 However, once I upgraded to WSL2 and switching to Export DISPLAY = 172.28.801:0 (my host#) it failed to connect Things tried: downloading VcXsrv Here is a typical error message QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-lw' qt.qpa.screen: QXcbConnection: In #4106 you advise to run "vcxsrv -ac" from the bash command line and at least one user accepted that as a solution. I downloaded vcxsrv.exe from sourceforge as an .exe outside of bash, and I see no way to execute it from bash Many thanks |
@fredericseiler @therealkenc (base) yy@ZZ: example 1 (base) yy@ZZ: example 2 (base) yy@ZZ: Any additional suggestions? any workarounds where I fallback on the methods which worked successfully in WSL1? |
It's one of a kind IP address you got there. |
The iP address has been dummified :) |
Didn't see that part, my bad. You don't need to obfuscate the IP, as only devices in your own private network can reach it. Or maybe are your trying to use your WAN IP ? What is the result of a |
@fredericseiler @therealkenc |
I'm glad if that helped you ;) Alternatively, you can mess around with the Windows Firewall and disable the WSL interface protection (while letting the Firewall turned on for the other interfaces) every time you start your computer (for example, via a powershell script in a scheduled task). This way, you can use the host Hyper-V IP (the one from # hide errors
$ErrorActionPreference = 'silentlycontinue'
# start VcXsrv with a custom profile
Start-Process -FilePath "$Env:ProgramFiles\VcXsrv\xlaunch.exe" -ArgumentList "-run `"$Env:USERPROFILE\config.xlaunch`""
# disable the WSL interface in the Windows Firewall
Set-NetFirewallProfile -DisabledInterfaceAliases "vEthernet (WSL)"
# start some services (nginx, cron, dbus...)
# don't forget to allow sudo without password for commands that need it
wsl /home/frederic/.local/bin/services.sh Other options:
|
I come up with an script after checking discussions, which makes things easier without adding Firewall rules and not exposing public IP. [Updated Feb.21] To make it works:
That's all to make WSL2 works automatically. The idea is to get the private LAN IP of WSL interface on Windows, and use Environment variable to pass to WSL. WSL then update this LAN IP to DISPLAY for X-Server connection. |
This issue should not be closed, the solution provided by @fredericseiler only works when the service on host machine is listening on 0.0.0.0. But in my case, there is a proxy service listening on localhost, and the service is initiated by another software which is not configurable. To access any internal resources from my company, I have to visit through this proxy. Before, in wsl1, the proxy is usable by setting --proxy=http://127.0.0.1:12639. However, since wsl2 does not have built-in support for this and the solution mentioned above cannot deal with this either, I really hope the microsoft team can put some serious effort on this and give us a clean solution. Just try to be consistent with the wsl1. |
This worked for me: |
I have two different devices with win 10 pro, one where wsl2 can connect to a 127.0.0.1 app (thinkpad t480), but the other laptop (an older Celeron Acer) is unable to do so with the same configuration. Both are win 10 pro, "slow" insider build (# 19041). Getting "connection refused" errors on wsl2 Debian using curl to test, after having set up nodejs on the windows side and running node on the test app app.js. This app is listening on http://127.0.0.1:3000. cmd.exe on the windows side connects successfully using curl to 127.0.0.1:3000, so can confirm it's up. Firewall settings allow node.exe allowed on private and public networks. Racking my head and can't figure it out, esp since the other laptop has the same config and just works! The fact I don't have to explicitly specify IP address of the windows host on the thinkpad suggests you don't have to in all cases? |
same problem - none of the above work on WSL2 neither with Xming nor with VcxSrvr. Tried all of them EXPORT DISPLAY=localhost:0.0 (or 127.0.0.1) or DISPLAY=Some.WSL.IP.Address:0 -> NOPE nothing can be done to make WSL2 (in my case Ubuntu 18.04) run some xeyes or xclock X-Windows, not to mention any Firefox or similar app. The only solution for me was to set up a fully fledged X-Windows env on Ubuntu and log into it via Remote Desktop; NOT really what was intended with WSL2 in the first place, was it? |
For what it's worth, I put some documentation together on how to get the firewall playing nicely with X11 here: https://github.com/cascadium/wsl-windows-toolbar-launcher#firewall-rules My main problem was I didn't realize that that security prompt actually adds a Block rule when you uncheck that box as opposed to simply deciding not to add an Allow rule. So I needed to both disable that rule, and add my own to allow the path through. The IP i use in my
|
(2nd update) They launch, in a transparent manner. a windowed KDE, using VcXsrv and the accompanying Xlaunch. It works very well and has no problems with reboots or shutting it down and back again A 2nd working version has been uploaded at: |
@fredericseiler I'm trying your powershell solution, and it works well (tips: we need |
This works for me. But I had to execute |
Hi, I am on Ubuntu 20.04.2 LTS on WSL2. something is wrong, but where should I look first ? thanks |
Use the following command instead:
|
thanks lackovic, one question: should I keep the following line in the bashrc ?
at the moment my bashrc looks like as below, and includes several lines I have tested with no success:
I am still hoping it will be possible to fix this issue.. |
Yes.
Try following these instructions. |
No. This guidance (tragically) made it into several widely distributed guides for X11 on WSL, and is incorrect. |
After I removed it I got the following errors every time I ran a Windows application through XLauch (VcXsrv): libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast Setting |
In my case, I am using MobaXterm and it built-in X11 server, so I need to enable all process like this in firewall in order to access WSL GUI Goto : |
Hi all, I've been following the suggestions and many fixes in this thread, to no avail After following the many comments here, I managed to get gimp to start (the app I've been using to debug this) What could be the cause of this? I already added a firewall rule to accept TCP traffic in port 6000, and made sure VcXsrv is allowed to communicate through the firewall. |
In my case I had to checked the "Disable access control" box while lauching the display to avoid the following error "Authorization required, but no authorization protocol specified |
Please fill out the below information:
Your Windows build number: Microsoft Windows [Version 10.0.19041.1]
What you're doing and what's happening:
follow this document start a node app on Windows (Powershell 7.0.0-rc.1);
request the app from WSL;
Unable access Windows applications from WSL.
The text was updated successfully, but these errors were encountered: