WSL: Internet connection takes too long.

Please use the following bug reporting template to help produce actionable and reproducible issues:

  • A brief description: Connection to the internet takes too much time.

When running sudo apt -get install | update, after accepting the installation of packages, it shows the following message: 0% [Conectando a archive.ubuntu.com (2001:67c:1360:8001:21)] (Spanish by the way, it just says Connecting to archive.ubuntu.com ...). It stays like that for about 1:30 min, then the installation proceeds normally. This happens with each run of one of the apt-get commands stated above. The last number of the output (21) changes after each run of the command, or even within the execution.

Using elinks, loading google.com takes about 4 min, after that pages load normally until elinks is closed. Closing and running elinks again throws the same issue.

I can´t even ping google.com as it returns ping: icmp open socket: Permission denied. Probably this is not related but I write it down anyway.

  • Expected results: For this commands to take a reasonable amount of time, as the provider’s internet speed is definitely not an issue.
  • Actual results (with terminal output if applicable): Stated above.
  • Your Windows build number: Microsoft Windows [Version 10.0.14393]
  • Steps / commands required to reproduce the error: Running apt-get install any package or apt-get update or trying browsing with elinks
  • Required packages and commands to install: elinks

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 22 (5 by maintainers)

Most upvoted comments

I had the same issue and I fix it with https://askubuntu.com/questions/574569/apt-get-stuck-at-0-connecting-to-us-archive-ubuntu-com

solved this by editing /etc/gai.conf and uncommenting the line:

#
#    For sites which prefer IPv4 connections change the last line to
#
precedence ::ffff:0:0/96 100

This lets you keep IPv6 enabled, but sets the order of precedence to prefer IPv4 over IPv6.

I solved this with by commenting out everything in /etc/apt/sources.list and adding:

deb mirror://mirrors.ubuntu.com/mirrors.txt trusty main restricted universe multiverse deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-updates main restricted universe multiverse deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-backports main restricted universe multiverse deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-security main restricted universe multiverse

which should pick the fastest mirror every time you update. It seems the repository was the problem for me.

@starnostar @Holt59 I just ran into this and tried the mirror solution. Much better. Something to note, though: I just upgraded to 16.04 (Xenial) with lxrun /uninstall and lxrun /install, so the sources need to be set for your release. For example:

deb mirror://mirrors.ubuntu.com/mirrors.txt xenial main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt xenial-updates main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt xenial-backports main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt xenial-security main restricted universe multiverse

For me the issue was with unconnected VPNs like hamachi. Disabling all virtual network card made the network extremly fast.