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)

Most upvoted comments

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:

  1. download the package from github https://github.com/microsoft/WSL/releases/download/0.64.0/Microsoft.WSL_0.64.0.0_x64_ARM64.msixbundle
  2. Open a powershell prompt
  3. On the prompt, navigate to folder in which you downloaded the file
  4. then type ( or copy paste ) : Add-AppxPackage -Path .\Microsoft.WSL_0.64.0.0_x64_ARM64.msixbundle -ForceUpdateFromAnyVersion -ForceApplicationShutdown

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 ps worked

from WSL2 Ubuntu kubectl get namespaces doesn’t work

from windows Powershell kubectl get namespaces worked

i’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 -ForceApplicationShutdown

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 --shutdown

Btw, 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 --shutdown

0.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

❯ cat /proc/version
Linux version 5.15.57.1-microsoft-standard-WSL2 (oe-user@oe-host) (x86_64-msft-linux-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) #1 SMP Wed Jul 27 02:20:31 UTC 2022

Are you guys by chance using a private kernel? Could you share the output of cat /proc/version?

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 cluster The 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

❯ wsl --version
WSL version: 0.65.1.0
Kernel version: 5.15.57.1
WSLg version: 1.0.41
MSRDC version: 1.2.3213
Direct3D version: 1.601.0
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22622.450