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:
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.39PING 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 ms64 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 1002msrtt min/avg/max/mdev = 255.540/255.757/255.975/0.217 ms
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 updateErr: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 outErr: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 outErr: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 outReading package lists... DoneW: 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 outW: 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 outW: 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 outW: 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=trueErr: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 outErr: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 outErr: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 outReading package lists... DoneW: 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 outW: 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 outW: 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 outW: Some index files failed to download. They have been ignored, or old ones used instead.