Star Hype News.

Premium celebrity moments with standout appeal.

updates

A "failed to fetch" error occurs when apt-get update is run. How do I fix this?

By Sophia Bowman

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

sudo apt-get update

on the terminal, the following kept occuring:

Err precise InRelease
Err precise-updates InRelease
Err precise-backports InRelease
Err precise Release.gpg Unable to connect to ph.archive.ubuntu.com:http: [IP: 91.189.92.177 80]
Err precise-updates Release.gpg Unable to connect to ph.archive.ubuntu.com:http: [IP: 91.189.92.177 80]
Err precise-backports Release.gpg Unable to connect to ph.archive.ubuntu.com:http: [IP: 91.189.92.177 80]
Err precise InRelease
Err precise Release.gpg Unable to connect to extras.ubuntu.com:http:
Err precise-security InRelease
Err 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
W: Failed to fetch
W: Failed to fetch
W: Failed to fetch
W: Failed to fetch
W: Failed to fetch Unable to connect to ph.archive.ubuntu.com:http: [IP: 91.189.92.177 80]
W: Failed to fetch Unable to connect to ph.archive.ubuntu.com:http: [IP: 91.189.92.177 80]
W: Failed to fetch Unable to connect to ph.archive.ubuntu.com:http: [IP: 91.189.92.177 80]
W: Failed to fetch Unable to connect to extras.ubuntu.com:http:
W: Failed to fetch 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 for how to upgrade to
# newer versions of the distribution.
deb precise main restricted
deb-src precise main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb precise-updates main restricted
deb-src 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 precise universe
deb-src precise universe
deb precise-updates universe
deb-src 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 precise multiverse
deb-src precise multiverse
deb precise-updates multiverse
deb-src 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 precise-backports main restricted universe multiverse
deb-src precise-backports main restricted universe multiverse
deb precise-security main restricted
deb-src precise-security main restricted
deb precise-security universe
deb-src precise-security universe
deb precise-security multiverse
deb-src 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 precise partner
# deb-src precise partner
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb precise main
deb-src precise main

And the following is for cat /etc/resolv.conf:

# 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

Output of ps aux | grep dns:

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
13

5 Answers

Edit /etc/resolv.conf. In a Terminal window run

sudo gedit /etc/resolv.conf

and add the line

nameserver 8.8.8.8

and save. Then do

ping 

If this succeeds then run the following commands

sudo apt-get --download-only --reinstall install resolvconf
sudo dpkg --purge --force-depends resolvconf
sudo apt-get install resolvconf

If resolving now fails then right-click on the network indicator in the bar at the top of the desktop, click Edit Connections, select your connection, Click Edit | IPv4 Settings. Change Method from Automatic (DHCP) to Automatic (DHCP) addresses only and enter 8.8.8.8 in the Additional DNS servers field. Click Save.... Verify that /etc/resolv.conf now contains a line nameserver 8.8.8.8 and that you can still ping .

9

I was facing the same problem and figured the easiest solution is to reset the sources of /etc/apt/sources.list. To do so, follow these steps:

  1. Obtain the release of your Ubuntu version, type into the console:

    lsb_release -r
  2. Go to to generate a new sources.list

  3. Select your country & release
  4. Check the first 12 boxes:

    All Ubuntu Brances + Security & Updates

  5. Generate and copy your new list
  6. Backup the old file to sources.list.old

    mv /etc/apt/sources.list /etc/apt/sources.list.old
  7. You can now either open vi to save the new list by doing:

    vi /etc/apt/sources.list
    (Paste and save using `:wq`)

    Or by copying and pasting into your terminal the "curl" command (including a unique URI for your updated source list) as it is presented under "Sources List" on the repogen output page.

  8. G2G, retry running apt-get update

6

sudo apt-get update finally worked! I just realized that the problem was not on the system but instead how the system connects and retrieves data from the internet. I just configured my Network settings and changed the proxy detection to Manual and filled in the HTTP, HTTPS, FTP, and Socks Host blanks the proxy that I use. When I updated again, this error output happened at first:

E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/)

Well, not exactly like the same but similar to it (I copied above from here). But when I tried updating again, it finally worked(the reason I posted the error output above and not the exact output I saw) and I can now choose a different mirror server. If the Network proxy configuration was really the reason for my woes, well, I kinda felt stupid for such basic mistake.

Anyway, thanks everybody for your help! :)

0

Do this

sudo bash -c 'echo "nameserver 127.0.0.1" >> /etc/resolv.conf'

Then do sudo apt-get update to see if it works.

7

I had the same error and found out it was because I had added the armhf architecture.
Run this-
sudo dpkg --print-foreign-architectures
Its better to remove any new architectures as not all repositories have index files for them and cause this error.
Run-
sudo dpkg --remove-architecture <architecture name>
and then-
sudo apt-get update
This solved the issue for me.
Hope it helps... :)

0

Related Archive

More in updates