Why apt-get update fail to connecting to dl.google.com?
When I have this problem, I disable IPv6 in Ubuntu and that fix the problem, in order to do that, please follow these steps:
To disable IPv6, you have to open /etc/sysctl.conf
using any text editor and add the following lines at the end:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
If IPv6 is still enabled, then the problem is that sysctl.conf
is still not activated.
In that case, open a terminal(Ctrl+Alt+T) and type the command:
sudo sysctl -p
The output will be very similar to these 3 lines:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
After that, execute:
$ cat /proc/sys/net/ipv6/conf/all/disable_ipv6
If you see 1
in the output, then IPv6 has been successfully disabled.
1
Hope this helps.
Ssuching Yu
Updated on September 18, 2022Comments
-
Ssuching Yu over 1 year
My Ubuntu is 14.04.
I try to update my packages by:
sudo apt-get update
Then it stuck at
100% [Connecting to dl.google.com (203.208.40.46)]
for several minutes. It is quite annoying.
I try to set a timeout for the connections How to lower wait time for repository updates.
After several seconds, it failed and end the process.
Err http://dl.google.com stable InRelease Err http://dl.google.com stable Release.gpg Cannot initiate the connection to dl.google.com:80 (2401:3800:4002:802::1005). - connect (101: Network is unreachable) [IP: 2401:3800:4002:802::1005 80] Reading package lists... Done W: Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/InRelease W: Failed to fetch http://build.openvpn.net/debian/openvpn/stable/dists/trusty/InRelease W: Failed to fetch http://build.openvpn.net/debian/openvpn/stable/dists/trusty/Release.gpg Unable to connect to build.openvpn.net:http: W: Failed to fetch http://ppa.launchpad.net/neovim-ppa/stable/ubuntu/dists/trusty/main/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ppa.launchpad.net/neovim-ppa/stable/ubuntu/dists/trusty/main/binary-i386/Packages 404 Not Found W: Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/Release.gpg Cannot initiate the connection to dl.google.com:80 (2401:3800:4002:802::1005). - connect (101: Network is unreachable) [IP: 2401:3800:4002:802::1005 80] W: Some index files failed to download. They have been ignored, or old ones used instead.
My location is China. I have Shadowsocks SOCKS5 system proxy and OpenVPN connecting to the same VPS server. I have tried turning off them both separately and together, but it did not work.
I wonder why this happen and how do I tackle it?
---update---
I could download the provided by @JonasCz.
-
JonasCz over 6 yearsAre you sure your proxy / VPN is working correctly ? Both google.com and openvpn.net are failing, so my guess is that it's because of china's blocks on these. What do you get when you visit dl.google.com/linux/chrome/deb/dists/stable/Release.gpg in a web browser ?
-
-
Penghe Geng over 6 yearsThis fixed my similar issue perfectly. Mine is Ubuntu 16.04.3 LTS.
-
galoget over 6 yearsNice! Good to hear that. =D
-
galoget over 6 yearsGlad to know it worked for you @SiqingYu
-
Ssuching Yu over 6 years@galoget Hey guy, I found that disabling IPv6 slows down my apt download speed, so I enabled it again. Is there any workaround?
-
galoget over 6 years@SiqingYu, I always used the solution posted here, you can try this Using IPv4 or IPv6 for apt, hope this works.