WSL: [WSL 2] Hangs forever on most network calls (like curl, git, etc.)
Version
Microsoft Windows [Version 10.0.22000.652]
WSL Version
- WSL 2
- WSL 1
Kernel Version
5.10.102.1
Distro Version
Ubuntu 20.04
Other Software
Docker Desktop 4.7.1 (77678)
Repro Steps
- Open a terminal tab after starting or restarting WSL
- Change current directory to a temporary directory
- Run
curl -fsSL -o get_helm$(date +%s).sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3until command hangs
NOTE: This isn’t curl specific. I mention it because it is one of the simplest use-cases I could think of that can reproduce the issue. now see this hanging through any command that requires network connectivity (git and helm just to name a few).
NOTE: Sometimes the curl command (or another network call) does succeed after enough cancellations and retries.
Expected Behavior
Network calls should eventually complete (either successfully or unsuccessfully) not hang forever.
Actual Behavior
Network calls hang forever.
Diagnostic Logs
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 3
- Comments: 22
Neither the ipv6 fix nor the MTU value changes fixed the issue for me, I modified the /etc/resolv.conf file for Google’s public DNS’s as follows to solve the issue:
suggestion is from: https://github.com/microsoft/WSL/issues/8119
EDIT for future reference:
Terminal commands for permanent change are as follows:
reference: https://askubuntu.com/questions/1347712/make-etc-resolv-conf-changes-permanent-in-wsl-2
IPv6 doesn’t work inside WSL, yet. However, Ubuntu images have IPv6 enabled. Quick check with
sysctlshows:Try disabling IPv6 and see how
curlbehaves. Usesysctl -w net.ipv6.conf.all.autoconf=0, etc.The new reading should be:
I can confirm the issue with two (mine and my colleague’s ) fresh installs of Windows 11 and latest WSL with all network-related consequential commands (multiple git pull for short period of time in our case). And I can also confirm that it is a recent thing, as previously all worked smoothly. I can’t add any other useful information, but
sysctl -w net.ipv6.conf.all.autoconf=0didn’t help.It still hangs on Ubuntu 22.04
This really shouldn’t be closed just because the OP decided to give up on the issue. It’s still an issue. @OneBlue can you re-open this?
Same problem here, network hangs inside wsl, after running
sysctl -w net.ipv6.conf.all.autoconf=0the network works again.Sorry for the delay. I tried the suggested workaround for IPv6 and a few others online and couldn’t get any of them to work with WSL. Even tried a fresh install of Windows 11 with no success. System administration like that isn’t my expertise so I’m sure my own limited knowledge on the topic is the main reason I could piece together a working solution. Due to time constraints it was more reasonable to just run Ubuntu natively instead of all the complication running within Windows. I understand this solution won’t work for everyone, but it is what I needed to do to continue forward with my work.
For anyone else finding this issue: I had a Windows VPN enabled (Cloudflare’s WARP) and it prevented me from downloading stuff in a WSL session. Pausing the VPN fixed it for me.
This totally fixed my issue. Thank you! It was driving me nuts.
Thanks @tiagolpadua , solved for me as well 👍
Hi! I ran into this same issue earlier today and this is what fixed it for me