WSL cannot connect to network (apt-get update, etc)

Asked by Renzo Cortez

I have problems with apt-update and downloading files using i.e. git clone:

apt-get update
Ign:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Ign:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Ign:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Err:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Ign:1 http://archive.ubuntu.com/ubuntu jammy InRelease
0% [Connecting to archive.ubuntu.com]

git clone https://github.com/rrwick/Porechop.git
Cloning into 'Porechop'...
fatal: unable to access 'https://github.com/rrwick/Porechop.git/': Could not resolve host: github.com

Question information

Language:
English Edit question
Status:
Needs information
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Bernard Stafford (bernard010) said (last edit ):
#1

https://learn.microsoft.com/en-us/windows/wsl/troubleshooting#updating-wsl
Updating WSL - To update the Windows Subsystem for Linux itself, use the command:
" wsl --update " -in PowerShell or CMD.

Revision history for this message
Renzo Cortez (recorpa) said :
#2

In PowerShell:
PS C:\Users\Renzo Cortez> wsl --update
Checking for updates.
The latest version of Windows Subsystem for Linux is now installed.

In WSL:
apt-get update | apt-get upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  javascript-common libexpat1-dev libjs-jquery libjs-sphinxdoc libjs-underscore libpython3-dev libpython3.10-dev python3-dev python3-wheel python3.10-dev zlib1g-dev
Use 'apt autoremove' to remove them.
The following packages have been kept back:
  libpython2.7-minimal libpython2.7-stdlib python2.7 python2.7-minimal python3-update-manager ubuntu-advantage-tools update-manager-core
The following packages will be upgraded:
  apparmor apport apt apt-utils base-files coreutils distro-info distro-info-data dpkg dpkg-dev git git-man iptables irqbalance libapparmor1 libapt-pkg6.0
  libcryptsetup12 libdpkg-perl libip4tc2 libip6tc2 libldap-2.5-0 libldap-common libnetplan0 libnss-systemd libpam-systemd libsystemd0 libudev1 libunwind8
  libxtables12 motd-news-config netplan.io python-apt-common python3-apport python3-apt python3-distro-info python3-distupgrade python3-problem-report
  python3-software-properties software-properties-common systemd systemd-hwe-hwdb systemd-sysv systemd-timesyncd tcpdump ubuntu-minimal ubuntu-release-upgrader-core
  ubuntu-standard ubuntu-wsl udev ufw
50 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
Need to get 17.4 MB/20.6 MB of archives.
After this operation, 112 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Abort.

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

Revision history for this message
Bernard Stafford (bernard010) said :
#3
Revision history for this message
Renzo Cortez (recorpa) said :
#4

I still got the error, I tried reinstalling it but same issue: (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4002:1::101). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (185.125.190.39), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.91.83), connection timed out Could not connect to archive.ubuntu.com:80 (185.125.190.36), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.91.81), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.91.82), connection timed out
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4002:1::102). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4002:1::103). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4002:1::101). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable)
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4002:1::102). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4002:1::103). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4002:1::101). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable)
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease Cannot initiate the connection to security.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2620:2d:4002:1::102). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2620:2d:4002:1::101). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2620:2d:4002:1::103). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.91.83), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.82), connection timed out Could not connect to security.ubuntu.com:80 (185.125.190.39), connection timed out Could not connect to security.ubuntu.com:80 (185.125.190.36), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.81), connection timed out
W: Some index files failed to download. They have been ignored, or old ones used instead.

Revision history for this message
Manfred Hampl (m-hampl) said :
#5

Before you try checking for updates, you should test whether you do have a working network connection.

What output do you receive for the following commands (to be executed in a terminal window)

ping -c 3 8.8.8.8
ping -c 3 google.com

Can you help with this problem?

Provide an answer of your own, or ask Renzo Cortez for more information if necessary.

To post a message you must log in.