WSL: localhost:PORT from windows host no longer gets handled by process running in WSL2
Version
Microsoft Windows [Version 10.0.25169.1000]
WSL Version
- WSL 2
- WSL 1
Kernel Version
5.15.57.1
Distro Version
Ubuntu 20.04
Other Software
No response
Repro Steps
- update WSL to the newest insider store version
- spin up any kind of server inside WSL (tried with node applications running on Port 3000, 4400, 8080 and a mysql instance running on docker on port 3306)
- try to access the exposed service from f.e. Edge by running http://localhost:3000
Expected Behavior
Whatever is running on localhost:3000 in WSL is getting delivered to the Browser requesting it.
Actual Behavior
Edge get’s an ERR_CONNECTION_REFUSED error.
Accessing through the IP address of eth0 with the port works. So f.e. http://localhost:3000 or http://127.0.0.1:3000 fail, but http://172.25.170.221:3000 works.
This worked until this morning when I updated to the latest version (0.65.1) in the store.
Diagnostic Logs
No response
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 49 (10 by maintainers)
https://github.com/microsoft/WSL/releases/tag/0.65.3
I haven’t tested it myself yet with the new version but I can only say also thanks especially for the extremely fast response time and fixes. Very much appreciated.
Still the same issue with minikube using 0.65.2.
Forcing downgrade to 0.64.0 fixed the issue.
Sidenote, to downgrade:
I went through podman/docker desktop/rancher desktop/k3d/kind with 0.65.3 and as far as I can tell, it’s fixed now.
Thank you @benhillis and team for the fast fix, really appreciated
While debugging this locally we have pushed https://github.com/microsoft/WSL/releases/tag/0.65.2 which will revert to the previous behavior.
I’m using Insider back to 22622.450, the connection from windows to localhost:80 hosted in kubernetes WSL2 “Docker Desktop” worked.
from WSL2 Ubuntu
docker psworkedfrom WSL2 Ubuntu
kubectl get namespacesdoesn’t workfrom windows Powershell
kubectl get namespacesworkedi’m trying to export my wsl Ubuntu distro, to uninstall wsl from windows, and try reinstall wsl without the Preview, in last scenario start work again in windows powershell until solution or work around was found 😥
same behavior again, downgraded from 1.1.2 to 1.0.3 and worked:
Add-AppxPackage -Path .\Microsoft.WSL_1.0.3.0_x64_ARM64.msixbundle -ForceUpdateFromAnyVersion -ForceApplicationShutdownBtw, i had the same complete freezes after “WSL --shutdown” on 0.65…
Another thing I noticed is that my computer freezes now regularly when I do
wsl --shutdown. This never happened before in previous versions. It’s a complete freeze and I can’t do anything. Have to unplug the A/C connector.EDIT: I also downgraded to 0.64 and everything works again. Kubernetes in WSL is reachable again. No sudden connection lost with react apps and no freeze during
WSL --shutdown0.65.2 not work for me
One more thing react application doesn’t work on localhost:3000, but “nc -l 3000” - worked correctly on localhost:3000
I use the default Ubuntu 20.04 image
I will provide logs later, when I am home
Maybe this has something do with that: I cannot reach my Kubernetes cluster build with KinD anymore. I also tested the Kubernetes cluster from Docker Desktop
Suddenly, I got (for Docker Desktop)
The connection to the server kubernetes.docker.internal:6443 was refused - did you specify the right host or port?or for the KinD clusterThe connection to the server 127.0.0.1:30000 was refused - did you specify the right host or port?It worked perfectly for months. The only thing changed was a Windows Update with update of WSL to 0.65.1