Failed to do apt-get update WSL2 Ubuntu 20 Windows 10

before marking this question as a duplicate, hear me out. I have tried every workaround I could find on internet.

First of all, I am using WSL2 with Ubuntu 20 on Windows 10 Home Edition.

This is what I got when running sudo apt-get update:

Hit:1 https://cli-assets.heroku.com/apt ./ InRelease
Hit:2 https://deb.nodesource.com/node_14.x focal InRelease
Err:3 http://archive.ubuntu.com/ubuntu focal InRelease
  Connection failed [IP: 91.189.88.142 80]
Err:4 http://archive.canonical.com/ubuntu focal InRelease
  Connection failed [IP: 91.189.91.15 80]
Err:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  Connection failed [IP: 91.189.88.142 80]
Err:6 http://security.ubuntu.com/ubuntu focal-security InRelease
  Connection failed [IP: 91.189.91.38 80]
Err:7 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  Connection failed [IP: 91.189.88.142 80]
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Connection failed [IP: 91.189.88.142 80]
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://archive.canonical.com/ubuntu/dists/focal/InRelease  Connection failed [IP: 91.189.91.15 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Connection failed [IP: 91.189.91.38 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.

Things I had done based on answers I found:

  1. Editing the /etc/resolv.conf. People have been successfully fixed this problem by adding nameserver 8.8.8.8, nameserver 8.8.4.4, and nameserver 1.1.1.1. And then add [network] generateResolvConf = false to /etc/wsl.conf.
  2. Changing sources.list urls to mirror urls
  3. Disabling firewall and antivirus. In fact, people are pointing out that Avast antivirus is causing them trouble. But I currently don’t have any 3rd party antivirus installed.
  4. Using/disabling VPN

Things that are worth noting:

  1. I can ping archive.ubuntu.com, google.com, and pretty much any outside domain from WSL
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=51 time=189 ms
64 bytes from aerodent.canonical.com (91.189.88.142): icmp_seq=2 ttl=51 time=188 ms
64 bytes from aerodent.canonical.com (91.189.88.142): icmp_seq=3 ttl=51 time=195 ms
64 bytes from aerodent.canonical.com (91.189.88.142): icmp_seq=4 ttl=51 time=188 ms

--- archive.ubuntu.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 188.027/190.212/195.247/2.953 ms
  1. I can ping WSL ip address from host, but cannot do it vice versa (host ip from WSL)
  2. I have docker running on WSL and it works just fine. Funny thing is that previously I had this issue before when docker had a new update but I decided to snooze it. It was fixed when I did the docker update.
  3. I don’t know if this is the actual issue, but a couple days ago I uninstalled McAfee antivirus. I believe the issue started after I did this, but I’m not sure

Source: Windows Questions

LEAVE A COMMENT