[WSL2] Internet Connectivity Issue with WSL version 2 (Ping working, but not apt update and others)
Environment
Windows build number: Microsoft Windows [version 10.0.18363.1110]
Your Distribution version: Ubuntu 18.04 on WSL 2
Your Distribution version: Ubuntu 20.04 on WSL 1
Whether the issue is on WSL 2 and/or WSL 1: Internet connectivity issue with linux on WSL 2
Steps to reproduce
NOTE: I am new to the usage of WSL and thus with the release of WSL 2, I got excited and decided to try WSL.
I manually installed Ubuntu 18.04 (on WSL 2) and Ubuntu 20.04 ( on WSL 1) (as my corporate laptop has MS Store disabled). I followed official MS docs to perform such installations
- https://docs.microsoft.com/en-us/windows/wsl/install-win10
- https://docs.microsoft.com/en-us/windows/wsl/install-manual
Issue with Ubuntu 18.04 on WSL 2
- I am able to ping external websites such as Google.com
- I am NOT able to perform "sudo apt update"
Possible that issue is similar to issues #5971, #5867...
WSL logs: $ ping google.com -c 4 PING google.com (172.217.19.238) 56(84) bytes of data. 64 bytes from par21s11-in-f14.1e100.net (172.217.19.238): icmp_seq=1 ttl=114 time=5.62 ms 64 bytes from par21s11-in-f14.1e100.net (172.217.19.238): icmp_seq=2 ttl=114 time=5.11 ms 64 bytes from par21s11-in-f14.1e100.net (172.217.19.238): icmp_seq=3 ttl=114 time=5.13 ms 64 bytes from par21s11-in-f14.1e100.net (172.217.19.238): icmp_seq=4 ttl=114 time=5.17 ms
--- google.com ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3004ms rtt min/avg/max/mdev = 5.116/5.261/5.624/0.210 ms
$ sudo apt update Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (91.189.88.142), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.88.152), connection timed out Err:2 http://archive.ubuntu.com/ubuntu bionic-updates InRelease Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Err:3 http://archive.ubuntu.com/ubuntu bionic-backports InRelease Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Err:4 http://security.ubuntu.com/ubuntu bionic-security InRelease Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.88.152), connection timed out Could not connect to security.ubuntu.com:80 (91.189.88.142), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.39), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.38), connection timed out Reading package lists... Done Building dependency tree Reading state information... Done All packages are up to date. W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (91.189.88.142), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.88.152), connection timed out W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.88.152), connection timed out Could not connect to security.ubuntu.com:80 (91.189.88.142), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.39), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.38), connection timed out W: Some index files failed to download. They have been ignored, or old ones used instead.
Expected behavior
Ubuntu 18.04 on WSL 2
- I am able to ping external websites such as Google.com
- I am able to perform "sudo apt update" and others installs
Actual behavior
Ubuntu 18.04 on WSL 2
- I am able to ping external websites such as Google.com
- I am NOT able to perform "sudo apt update"
Steps done for testing
Step1: For testing purpose, I kept the Ubuntu 20.04 on WSL 1 Everything works fine
- I am able to perform "sudo apt update" and other installs such as gcc
- I am able to ping external websites such as Google.com
Step2: I update the same Ubuntu 20.04 to WSL 2 via wsl --set-version Ubuntu-20.04 2 Failure starts
- I am able to ping external websites such as Google.com
- I am NOT able to perform "sudo apt update"
Step3: I update the same Ubuntu 20.04 back to WSL 1 via wsl --set-version Ubuntu-20.04 1 Everything starts working again
- I am able to ping external websites such as Google.com
- I am able to perform "sudo apt update" and other installs such as gcc
Steps taken based on other error reports and updates
In Ubuntu 18.04 (on WSL 2), I followed various solutions given in different bug reports. For Instance,
- Updating the nameserver to 8.8.8.8 in /etc/resolv.conf
- Used the PowerShell script (WSL2-Net-Fix.ps1) form @danvy (https://gist.github.com/danvy/9486bf730371436131cb888ff4c2ceb6)
Unfortunately, still there is no way to connect Ubuntu 18.04 on WSL 2 to update sites (via apt update)
I have the same problem with WSL2 and Ubuntu 20.04. The combination of WSL2 and Ubuntu is pretty useless if you can't install software.
/dupe #5971, #5867
Hi! We've identified this issue as a duplicate of another one that already exists in this repository. This specific instance is being closed in favor of tracking the concern over on the referenced thread.
Thanks for your report!
Always the same issue, and each time you put the label "duplicate", but when we refer to the post in question, there is no appropriate or concrete solution. It gets boring and frustrating.
ver Microsoft Windows [version 10.0.19041.508] + wsl2 Ubuntu 20.04
WSL2 is a very frustrating product
Checkout my comment: maybe it helps: https://github.com/microsoft/WSL/issues/5061#issuecomment-756457106
Store page states that updates do not function. For updates we should use do-release-upgrade but that can't be right ....
Might sound extremely dumb, but I was able to solve this by turning off the mobile hotspot.
to add to the above:
I fixed my issue by initially TURNING ON the mobile hotspot and then turning it off
to add to the above:
I fixed my issue by initially TURNING ON the mobile hotspot and then turning it off
Are you kidding me? This worked for me... but how??
For anyone using multiple local IPv4 addresses in their windows network adapter - I finally found the fix after deleting them.
Network and Ethernet -> Advanced Network Settings -> Ethernet -> More network adapter options -> TCP/IPv4 settings -> Advanced -> Deleted other IP addresses
Use a VPN.
This is the only thing that worked for me.
Quick test by running apt update.
just delete the .wslconfig and restart the wsl