WSL: sudo apt update Cannot initiate the connection or Temporary failure resolving - WSL2
Environment
Windows build number: Microsoft Windows [Version 10.0.19041.868]
Your Distribution version: Release: 20.04
Whether the issue is on WSL 2 and/or WSL 1: Linux version 4.19.128-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Tue Jun 23 12:58:10 UTC 2020
Steps to reproduce
- Go to the Market place and install Ubuntu 20.04 LTS
- Launch it to proceed with the installation of Ubuntu 20.04 LTS
- Run the command
sudo apt updateMy Docker version is : Docker version 20.10.5, build 55c4c88
WSL logs:
Expected behavior
After the installation of Ubuntu 20.04 LTS I should be able to run sudo apt update without any issue.
Actual behavior
Actually, running sudo apt update results in :
$ sudo apt update
[sudo] password for ubuntu:
Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
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 focal-updates InRelease
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 focal-backports InRelease
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 focal-security InRelease
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::18). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::23). - 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.38), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.39), 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/focal/InRelease 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/focal-updates/InRelease 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/focal-backports/InRelease 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/focal-security/InRelease 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::18). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::23). - 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.38), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.39), connection timed out
W: Some index files failed to download. They have been ignored, or old ones used instead.
Only ping works :
$ ping archive.ubuntu.com
PING archive.ubuntu.com (91.189.88.152) 56(84) bytes of data.
64 bytes from actiontoad.canonical.com (91.189.88.152): icmp_seq=1 ttl=51 time=19.0 ms
64 bytes from actiontoad.canonical.com (91.189.88.152): icmp_seq=2 ttl=51 time=17.2 ms
64 bytes from actiontoad.canonical.com (91.189.88.152): icmp_seq=3 ttl=51 time=16.2 ms
64 bytes from actiontoad.canonical.com (91.189.88.152): icmp_seq=4 ttl=51 time=18.3 ms
64 bytes from actiontoad.canonical.com (91.189.88.152): icmp_seq=5 ttl=51 time=18.1 ms
I am using WSL 2 :
wsl -l -v
NAME STATE VERSION
* docker-desktop Running 2
Ubuntu-20.04 Running 2
docker-desktop-data Running 2
How can I solve this issue ? There are so many issues like mine : https://github.com/microsoft/WSL/issues/5971 , https://github.com/microsoft/WSL/issues/5061, https://github.com/microsoft/WSL/issues/5867 …
Is it possible to have a real fix for this issue ?
Best regards,
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 18
Finally solved this issue on my machine - it’s appeared that the issue is caused by Symantec Endpoint Protection firewall (looking into the logs in ‘Network and Host Exploit Mitigation’ I found lots of blocked incoming connections at the same time as I tried to run
sudo apt update). Disabling the firewall fixed the issue. Hope it’ll help someone.Thanks , it worked after disabling the synamtec 🤩🤘
Are you Crackers planning to fix this or what?
After uninstalling Ubuntu 20.04 LTS and disabling WSL in Windows feature I ran the following steps :
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestartdism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestartsudo apt update=> Same result… It doesn’t work…
I have to set WSL back to version 1 like this :
wsl --set-version Ubuntu-20.04 1and after the commandsudo apt updateworks…Why it doesn’t work in WSL2 ? why ipv6 are visible ?
I got this problem. In my case, I need to add proxy for apt:
sudo vi /etc/apt/apt.conf.d/proxy.confIn the editor add two lines:Acquire::http::Proxy "http://user:password@proxy.server:port/";Acquire::https::Proxy "http://user:password@proxy.server:port/";Save and exit the editor, then run update. It should workModifying the resolv.conf with
works for me. But need to reboot the Ubuntu to actualty works.
@SYSUeric66 Try to disable Fire Wall like @arhor mentioned below. I can’t disable it on my PC because it managed by my organization and I have no access to update this settings so I’m just working on my Ubuntu but if you can so give a try.