Updates don't work on WSL2
Hi guys! After changing the version of WSL:
PS C:\WINDOWS\system32> wsl --set-version Ubuntu 2
Apt update doesn't work for me (and I waited for the execution of this command for about half an hour, why so long?...):
mystic@MYSTIC-OFFICEPC:/mnt/c/Users/Mystic$ sudo apt update
[sudo] password for mystic:
Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
Connection failed [IP: 91.189.88.142 80]
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Connection failed [IP: 91.189.88.142 80]
Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Connection failed [IP: 91.189.88.142 80]
Ign:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
Ign:6 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en
Ign:7 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages
Ign:8 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-en
Ign:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
Ign:6 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en
Ign:7 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages
Ign:8 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-en
Ign:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
Ign:6 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en
Ign:7 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages
Ign:8 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-en
Err:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
Connection failed [IP: 91.189.88.142 80]
Ign:6 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en
Ign:7 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages
Ign:8 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-en
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Connection failed [IP: 91.189.88.142
80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Connection failed [IP: 91.189.88.1
42 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Connection failed [IP: 91.189.88.1
42 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/universe/binary-amd64/Packages Connection failed [IP:
91.189.88.142 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
And release upgrade too:
mystic@MYSTIC-OFFICEPC:/mnt/c/Users/Mystic$ sudo do-release-upgrade
[sudo] password for mystic:
Checking for a new Ubuntu release
Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings
There is no development version of an LTS available.
To upgrade to the latest non-LTS develoment release
set Prompt=normal in /etc/update-manager/release-upgrades.
In this case, everything responds:
mystic@MYSTIC-OFFICEPC:/mnt/c/Users/Mystic$ ping security.ubuntu.com
PING security.ubuntu.com (91.189.88.142) 56(84) bytes of data.
64 bytes from aerodent.canonical.com (91.189.88.142): icmp_seq=1 ttl=56 time=54.2 ms
64 bytes from aerodent.canonical.com (91.189.88.142): icmp_seq=2 ttl=56 time=54.3 ms
64 bytes from aerodent.canonical.com (91.189.88.142): icmp_seq=3 ttl=56 time=54.2 ms
^C
--- security.ubuntu.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 54.289/54.329/54.399/0.049 ms
mystic@MYSTIC-OFFICEPC:/mnt/c/Users/Mystic$ ping archive.ubuntu.com
PING archive.ubuntu.com (91.189.88.142) 56(84) bytes of data.
64 bytes from aerodent.canonical.com (91.189.88.142): icmp_seq=1 ttl=56 time=54.2 ms
64 bytes from aerodent.canonical.com (91.189.88.142): icmp_seq=2 ttl=56 time=54.2 ms
64 bytes from aerodent.canonical.com (91.189.88.142): icmp_seq=3 ttl=56 time=54.3 ms
^C
--- archive.ubuntu.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 54.233/54.266/54.318/0.037 ms
After the rollback (wsl --set-version Ubuntu 1), there is no problem:
mystic@MYSTIC-OFFICEPC:/mnt/c/Users/Mystic$ sudo apt update
[sudo] password for mystic:
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [8570 kB]
Get:6 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [691 kB]
Get:7 http://security.ubuntu.com/ubuntu bionic-security/main Translation-en [221 kB]
Get:8 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [33.8 kB]
Get:9 http://security.ubuntu.com/ubuntu bionic-security/restricted Translation-en [8804 B]
Get:10 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [657 kB]
Get:11 http://security.ubuntu.com/ubuntu bionic-security/universe Translation-en [218 kB]
Get:12 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [7176 B]
Get:13 http://security.ubuntu.com/ubuntu bionic-security/multiverse Translation-en [2764 B]
Get:14 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en [4941 kB]
Get:15 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [151 kB]
Get:16 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-en [108 kB]
Get:17 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [913 kB]
Get:18 http://archive.ubuntu.com/ubuntu bionic-updates/main Translation-en [314 kB]
Get:19 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [43.5 kB]
Get:20 http://archive.ubuntu.com/ubuntu bionic-updates/restricted Translation-en [10.9 kB]
Get:21 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1065 kB]
Get:22 http://archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [330 kB]
Get:23 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [10.8 kB]
Get:24 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse Translation-en [4728 B]
Get:25 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [2512 B]
Get:26 http://archive.ubuntu.com/ubuntu bionic-backports/main Translation-en [1644 B]
Get:27 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [4020 B]
Get:28 http://archive.ubuntu.com/ubuntu bionic-backports/universe Translation-en [1900 B]
Fetched 18.6 MB in 15s (1255 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
28 packages can be upgraded. Run 'apt list --upgradable' to see them.
My system:
C:\Users\Mystic>ver
Microsoft Windows [Version 10.0.19041.172]
Internet connected via PPTP client. And as you can see, the internet works on PC and on WSL. But the updates for some reason do not work ... I freaked out and reinstalled WSL completely, but it gave me nothing.
Same issue for me also. Just installed ubuntu 18.04. not able to update
The problem is resolved after reinstalling on ubuntu 20.04. Winver 19041.208
okay
I have the same issue with Windows 19041.264
If I revert back to WSL 1 everything works, just WSL 2 doesn't connect
If I revert back to WSL 1 everything works, just WSL 2 doesn't connect
Strange, everything works for me on the same build
If I revert back to WSL 1 everything works, just WSL 2 doesn't connect
Strange, everything works for me on the same build

For me still, an issue, look at the powershell window, just error when I enabled wsl2
@rromanv Try something like ping 216.58.192.164. Does it work?
@rromanv Try something like
ping 216.58.192.164. Does it work?
This works, that mean I have issues with DNS resolving?
I followed up this, but instead of Google DNS I pointed to my company DNS (I need resolve of internal services/servers) https://github.com/microsoft/WSL/issues/4285#issuecomment-522201021
Yes, that looks like DNS problem. You can see plenty of threads with similar issues but not an universal solution.
i have the same issue when i'm connected over WiFi however i noticed that when i'm connected over ethernet it works well. i think issue is related to sharing network process between network cards over Hyper-v engine. WSL2 is not an emulation anymore but a specific hyper-v virtual machine that uses same network connexions that an hyper-v vm to connect (like virtual switch)...
I turned off my VPN and I did not have an issue updating.
Tried everything, still can't get it to work. It works in WSL 1 but not 2.
Turning off my VPN fixed the issue for me as well.
Tried everything, still can't get it to work. It works in WSL 1 but not 2.
Same.. Also tried to update my network driver, and to reinstall WSL, but nothings changes:
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Err:2 http://security.ubuntu.com/ubuntu focal-security InRelease
Connection failed [IP: 91.189.88.142 80]
Err:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Connection failed [IP: 91.189.88.142 80]
Err:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Connection failed [IP: 91.189.88.142 80]
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/focal-updates/InRelease Connection failed [IP: 91.189.88.142 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease Connection failed [IP: 91.189.88.142 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease Connection failed [IP: 91.189.88.142 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
But, if i try to connect over Ethernet, or through my phone's wifi (routing), it works I'm not an advanced user, but I did everything right, it just dont work..
I guess these three are related #5867 #5831
It magically worked after this
I had Same problem with WSL2 , ubuntu distro. Basically you are not able to reach ubuntu servers on TCP connection. & that is why Ping & DNS resolution is working. Solution - Please check your Endpoint protection/Anti-virus agent/Windows Firewall. Try to disable them & then give a try. It worked for me. Later you can make permanent security exception for your wsl ubuntu. Now i am on wireless connection, my VPN connected, Security exception made on symantec protection, & still i can update all packages. HTH
Turning off public network firewall solved it temporarily. Making the following firewall rule, in powershell, solved it completely:
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow
Turning off public network firewall solved it temporarily. Making the following firewall rule, in powershell, solved it completely:
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow
Not a PS expert here.. What exactly this code is doing?