A «failed to fetch» error occurs when apt-get update is run. How do I fix this?
Contrary to the note above, I haven’t found the answer to my problem. I have read almost a dozen apt-get update questions, most from askubuntu.com, with «failed to fetch» errors and tried the solutions answered there. Unfortunately, none worked. I just recently installed Ubuntu 12.04 on my laptop, dual booting it alongside Windows 7. When i tried
Err http://ph.archive.ubuntu.com precise InRelease Err http://ph.archive.ubuntu.com precise-updates InRelease Err http://ph.archive.ubuntu.com precise-backports InRelease Err http://ph.archive.ubuntu.com precise Release.gpg Unable to connect to ph.archive.ubuntu.com:http: [IP: 91.189.92.177 80] Err http://ph.archive.ubuntu.com precise-updates Release.gpg Unable to connect to ph.archive.ubuntu.com:http: [IP: 91.189.92.177 80] Err http://ph.archive.ubuntu.com precise-backports Release.gpg Unable to connect to ph.archive.ubuntu.com:http: [IP: 91.189.92.177 80] Err http://extras.ubuntu.com precise InRelease Err http://extras.ubuntu.com precise Release.gpg Unable to connect to extras.ubuntu.com:http: Err http://security.ubuntu.com precise-security InRelease Err http://security.ubuntu.com precise-security Release.gpg Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80] Reading package lists. Done W: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/dists/precise/InRelease W: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/dists/precise-updates/InRelease W: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/dists/precise-backports/InRelease W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/InRelease W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/precise/InRelease W: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/dists/precise/Release.gpg Unable to connect to ph.archive.ubuntu.com:http: [IP: 91.189.92.177 80] W: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/dists/precise-updates/Release.gpg Unable to connect to ph.archive.ubuntu.com:http: [IP: 91.189.92.177 80] W: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/dists/precise-backports/Release.gpg Unable to connect to ph.archive.ubuntu.com:http: [IP: 91.189.92.177 80] W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/precise/Release.gpg Unable to connect to extras.ubuntu.com:http: W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/Release.gpg Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80] W: Some index files failed to download. They have been ignored, or old ones used instead.
Note: This happened immediately after I installed Ubuntu 12.04. I am very new to the Linux/Ubuntu world and a noob when it comes to these kind of stuff. The Sources list in the Update Manager (and Software Center) settings was short. It only contained 2 lines with «Canonical» in it, 2 lines with «Independent» in it, and 2 other lines. I think the list was short because it was a freshly installed Ubuntu. Connection to the internet seems fine and my friend whose laptop had just been installed with Ubuntu 12.04 around the same time as mine, seems to have no problem with his update. We share the same connection so I think internet connection issues couldn’t have been the reason for the error. Attempted Solutions: From here, I explored around /etc/resolvconf/resolv.conf.d and added in the /etc/resolvconf/resolv.conf.d/head the following:
nameserver 8.8.8.8 nameserver 8.8.4.4
Error still occured. From here and here, I repeatedly changed which Mirror server to use in the Update manager and Software sources settings. Again, error still occured. I also tried editing my sources list, unchecking the lines with «independent» on it(as suggested). According to here, I tried removing the derb-src lines in the sources list. Still, to no avail. Lastly, this site suggests running the following:
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null or, for a permanent solution, echo "nameserver 8.8.8.8" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null
Sadly, nothing worked for me. In all forums that I have been to, the answer related to nameserver 8.8.8.8 seems to come up most often. Take note also that I really did not understand the solutions, what they meant or how are they done. I just simply followed them. This is the output for cat /etc/apt/sources.list :
# deb cdrom:[Ubuntu 12.04 LTS _Precise Pangolin_ - Release amd64 (20120425)]/ dists/precise/main/binary-i386/ # deb cdrom:[Ubuntu 12.04 LTS _Precise Pangolin_ - Release amd64 (20120425)]/ dists/precise/restricted/binary-i386/ # deb cdrom:[Ubuntu 12.04 LTS _Precise Pangolin_ - Release amd64 (20120425)]/ precise main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://archive.ubuntu.com/ubuntu precise main restricted deb-src http://archive.ubuntu.com/ubuntu precise main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://archive.ubuntu.com/ubuntu precise-updates main restricted deb-src http://archive.ubuntu.com/ubuntu precise-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http://archive.ubuntu.com/ubuntu precise universe deb-src http://archive.ubuntu.com/ubuntu precise universe deb http://archive.ubuntu.com/ubuntu precise-updates universe deb-src http://archive.ubuntu.com/ubuntu precise-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http://archive.ubuntu.com/ubuntu precise multiverse deb-src http://archive.ubuntu.com/ubuntu precise multiverse deb http://archive.ubuntu.com/ubuntu precise-updates multiverse deb-src http://archive.ubuntu.com/ubuntu precise-updates multiverse ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. deb http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu precise-security main restricted deb-src http://archive.ubuntu.com/ubuntu precise-security main restricted deb http://archive.ubuntu.com/ubuntu precise-security universe deb-src http://archive.ubuntu.com/ubuntu precise-security universe deb http://archive.ubuntu.com/ubuntu precise-security multiverse deb-src http://archive.ubuntu.com/ubuntu precise-security multiverse ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. # deb http://archive.canonical.com/ubuntu precise partner # deb-src http://archive.canonical.com/ubuntu precise partner ## This software is not part of Ubuntu, but is offered by third-party ## developers who want to ship their latest software. deb http://extras.ubuntu.com/ubuntu precise main deb-src http://extras.ubuntu.com/ubuntu precise main
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 127.0.0.1 search nip.upd.edu.ph
It has been pointed out that the answer is here but unfortunately that didn’t work either. I tried choosing different servers but the «choose server» was never available. Searching for the best server yielded a «No suitable server» result. I think the mirror servers are fine and again, there seems to be no issue with internet connection. Using ping -c3 archive.ubuntu.com and ping -c3 8.8.8.8 both yielded 0% packet loss . The ping for 8.8.8.8 sometimes yielded 33% packet loss but mostly 0%. Typing nslookup google.com yields
Server: 127.0.0.1 Address: 127.0.0.1#53
nobody 1761 0.0 0.0 33012 1284 ? S 17:04 0:00 /usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/var /run/sendsigs.omit.d/network-manager.dnsmasq.pid --listen-address=127.0.0.1 --conf- file=/var/run/nm-dns-dnsmasq.conf --cache-size=0 --proxy-dnssec joa 2197 0.0 0.0 13576 928 pts/0 S+ 17:10 0:00 grep --color=auto dns