3

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 quick ping check I see that it works fine. Also I have browsed the URLs 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
    
  2. 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.
Mayank
  • 143
  • 1
    https://github.com/microsoft/WSL/issues/5976 https://github.com/microsoft/WSL/issues/6753 – Johan Palych Oct 20 '21 at 10:35
  • 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. – Mayank Oct 20 '21 at 16:32
  • Can you try it from home (or anywhere else) while not connected to the company network? Also, is there any VPN involved? Thanks! – NotTheDr01ds Oct 20 '21 at 19:14
  • 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. – Mayank Oct 21 '21 at 02:56
  • 1
    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 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 and 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 – mrq Dec 30 '21 at 13:58
  • Let me try that as soon as I am back from vacation. Thanks for your input though @mrq – Mayank Jan 04 '22 at 12:29
  • Above method actually requires to install docker, which I will not be able to due to company policies. Thanks for the solution though. – Mayank Feb 08 '22 at 16:17

0 Answers0