Score:0

WSL2 update and apt-get failure, though ping works fine

kr flag

I am trying to get Ubuntu running using WSL2 on my office laptop.

Problem : When I try to run apt-get update or any install command, eg : apt-get install gcc, it always ends up with 101 : Network is unreachable.

Solutions I have tried so far :

  1. Firewall

My initial guess was that my office firewall may be blocking the connection, but on wuick ping check i see that it works fine. Also I have browsed the URL's in chrome and it works without any issues.

$ ping 91.189.91.39
PING 91.189.91.39 (91.189.91.39) 56(84) bytes of data.
64 bytes from 91.189.91.39: icmp_seq=1 ttl=51 time=256 ms
64 bytes from 91.189.91.39: icmp_seq=2 ttl=51 time=256 ms
^C
--- 91.189.91.39 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 255.540/255.757/255.975/0.217 ms
  1. resolver configuration file issue.

I have tried changing the default nameserver to 8.8.8.8 and other DNS providers as well but didn't resolve the issue. Also since ping works, DNS resolver shouldn't be a problem.


Now there are few more solution which I am able to find, like forcing apt to use IPv4, deleting hypervisor switching adapter and other such solutions but their problem doesn't seem to corelate with what I am facing and I don't want to keep shooting arrows in dark.

Any help or direction pointing will be very much appreciated. Thank you

Error log:

$ sudo apt-get update
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://security.ubuntu.com/ubuntu focal-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:1562::15). - connect (101: Network is unreachable) 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
Err:3 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:4 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:5 http://archive.canonical.com/ubuntu focal InRelease
  Cannot initiate the connection to archive.canonical.com:80 (2001:67c:1360:8c01::16). - connect (101: Network is unreachable) Cannot initiate the connection to archive.canonical.com:80 (2001:67c:1360:8c01::1b). - connect (101: Network is unreachable) Cannot initiate the connection to archive.canonical.com:80 (2001:67c:1562::1c). - connect (101: Network is unreachable) Could not connect to archive.canonical.com:80 (91.189.92.191), connection timed out Could not connect to archive.canonical.com:80 (91.189.92.150), connection timed out Could not connect to archive.canonical.com:80 (91.189.91.15), connection timed out
Reading package lists... Done
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://archive.canonical.com/ubuntu/dists/focal/InRelease  Cannot initiate the connection to archive.canonical.com:80 (2001:67c:1360:8c01::16). - connect (101: Network is unreachable) Cannot initiate the connection to archive.canonical.com:80 (2001:67c:1360:8c01::1b). - connect (101: Network is unreachable) Cannot initiate the connection to archive.canonical.com:80 (2001:67c:1562::1c). - connect (101: Network is unreachable) Could not connect to archive.canonical.com:80 (91.189.92.191), connection timed out Could not connect to archive.canonical.com:80 (91.189.92.150), connection timed out Could not connect to archive.canonical.com:80 (91.189.91.15), connection timed out
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-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:1562::15). - connect (101: Network is unreachable) 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.

Error log by forced IPv4 usage :

sudo apt-get update -o Acquire::ForceIPv4=true
Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
  Could not connect to archive.ubuntu.com:80 (91.189.88.152), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.88.142), connection timed out
Err:2 http://security.ubuntu.com/ubuntu focal-security InRelease
  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
Err:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  Unable to connect to archive.ubuntu.com:http:
Err:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  Unable to connect to archive.ubuntu.com:http:
Err:5 http://archive.canonical.com/ubuntu focal InRelease
  Could not connect to archive.canonical.com:80 (91.189.92.191), connection timed out Could not connect to archive.canonical.com:80 (91.189.92.150), connection timed out Could not connect to archive.canonical.com:80 (91.189.91.15), connection timed out
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Could not connect to archive.ubuntu.com:80 (91.189.88.152), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.88.142), connection timed out
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Unable to connect to archive.ubuntu.com:http:
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Unable to connect to archive.ubuntu.com:http:
W: Failed to fetch http://archive.canonical.com/ubuntu/dists/focal/InRelease  Could not connect to archive.canonical.com:80 (91.189.92.191), connection timed out Could not connect to archive.canonical.com:80 (91.189.92.150), connection timed out Could not connect to archive.canonical.com:80 (91.189.91.15), connection timed out
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  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.
Johan Palych avatar
us flag
https://github.com/microsoft/WSL/issues/5976 https://github.com/microsoft/WSL/issues/6753
kr flag
Thanks for your comment @JohanPalych. But I followed the issue links and some other links that it refers to but i think there is no solution for the same as of now. Please correct me if wrong.
NotTheDr01ds avatar
vn flag
Can you try it from home (or anywhere else) while not connected to the company network? Also, is there any VPN involved? Thanks!
kr flag
Yes...I have tried that connecting from my home network...It gives same issue. We do use VPN,but when I am using WSL I disconnect the VPN.
mrq avatar
hm flag
mrq
Sorry, I wanted to comment the question with these information but my reputation is too low to do it. I suggest to give a try to [wsl-vpn](https://github.com/AmmarRahman/wsl-vpn) which is a networking solution I've seen solving issues in many similar use cases (ping/ICMP working, HTTP/HTTPS/DNS/etc. not working) It leverages [moby-vpnkit](https://github.com/moby/vpnkit) and [npiperelay](https://github.com/jstarks/npiperelay) and it works by creating a "data-tunnel" between WSL2 and the Windows host, specifically a pipe. This means a Windows service is always listening. You get the best of almo
kr flag
Let me try that as soon as I am back from vacation. Thanks for your input though @mrq
kr flag
Above method actually requires to install docker, which I will not be able to due to company policies. Thanks for the solution though.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.