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 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: 80]
Err http://ph.archive.ubuntu.com precise-updates Release.gpg            
  Unable to connect to ph.archive.ubuntu.com:http: [IP: 80]
Err http://ph.archive.ubuntu.com precise-backports Release.gpg          
  Unable to connect to ph.archive.ubuntu.com:http: [IP: 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: 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: 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: 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: 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: 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.


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:


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" | sudo tee /etc/resolv.conf > /dev/null
or, for a permanent solution,
echo "nameserver" | 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 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

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

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
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 both yielded 0% packet loss. The ping for sometimes yielded 33% packet loss but mostly 0%.

Typing nslookup google.com yields


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= --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
  • 1
    Okay, let's just start from scratch. First, can you copy the exact output of the terminal when you type sudo apt-get update? Also, can you include the output of cat /etc/apt/sources.list and cat /etc/resolv.conf? And you confirm that you can browse websites on the internet normally?
    – Alaa Ali
    May 21, 2013 at 13:45
  • @Alaa In response to your inquiry, I have edited the question and posted everything you needed to know. And yes, I was able to browse websites on the internet normally.
    – jowabels
    May 21, 2013 at 14:27
  • 0% packet loss? So you can ping and browse, but you can't resolve in apt-get updates...hmm. Is there some kind of DNS setting that only works with apt-get? Anyways, can you post the first two lines from nslookup google.com, and post the output of ps aux | grep dns? Also, are you using a static IP?
    – Alaa Ali
    May 22, 2013 at 8:16
  • @Alaa I have edited the question and posted the outputs. The output for ps aux | grep dns is supposed to be a single line but I edited it to make it easier to view. Initially, I would say that I use a dynamic IP because I haven't paid anything for it, but I use university internet connections so its hard to know if the IP I use is static or dynamic.
    – jowabels
    May 22, 2013 at 9:27
  • @Alaa I just verified that I use a dynamic IP.
    – jowabels
    May 22, 2013 at 9:40

5 Answers 5


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

sudo gedit /etc/resolv.conf

and add the line


and save. Then do

ping www.google.com

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 in the Additional DNS servers field. Click Save.... Verify that /etc/resolv.conf now contains a line nameserver and that you can still ping www.google.com.

  • 6
    @guntbert Umm. You are talking to the author of the resolvconf package. I think that he knows what he is talking about. ;-) May 22, 2013 at 9:17
  • @jdthood Previously, I was able to ping (as stated in the question) but after adding the line nameserver, it didn't resolve and this line appeared From nat1.up.edu.ph ( icmp_seq=1 Destination Host Unreachable
    – jowabels
    May 22, 2013 at 9:53
  • 1
    @maggotbrain thx for helping me pull my foot out of my mouth again :-)
    – guntbert
    May 22, 2013 at 10:29
  • 1
    @guntbert It's all good, man. Been there, myself. If there are any dns/resolveconf issues, jdthood is the goto man to solve them! May 22, 2013 at 10:52
  • 3
    When I follow these steps, I get this error after I run the first command: Err http://us.archive.ubuntu.com/ubuntu/ wily/main resolvconf all 1.77ubuntu1 404 Not Found [IP: 80] E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/r/resolvconf/resolvconf_1.77ubuntu1_all.deb 404 Not Found [IP: 80] Sep 30, 2017 at 1:55

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 http://repogen.simplylinux.ch/ 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

  • 2
    I decided to answer this, even though the authors problem was solved differently. His question is the top result to a lot of problems related to a corrupted source.list file (stumbled upon it 3 times) and felt to leave my solution here, since it would have saved me a lot of time. Jun 6, 2014 at 19:59
  • I downloaded a ubuntu 12 virtual machine, and no repos where valid (italian ones). I did this and worked like a charm! thanks!
    – Feida Kila
    Oct 1, 2014 at 15:06
  • Before pasting in vim, you'll need to edit insert mode by hitting the letter 'i' after you open it
    – s g
    Jan 27, 2016 at 20:15
  • This is what worked for me.
    – Rick
    Mar 28, 2016 at 6:04
  • There isn't 14.10 in the release list :(
    – JoeTidee
    Sep 9, 2016 at 22:51

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! :)


Do this

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

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

  • Nope, sudo apt-get update still doesn't work. Do I have to remove the line nameserver 127.0.01 or it's ok to leave it there?
    – jowabels
    May 22, 2013 at 10:19
  • Did you try to do this after reverting from jdthood's answer? So just make sure that you can ping, then add the line nameserver to /etc/resolv.conf, it has to be the only line (after the comments of course).
    – Alaa Ali
    May 22, 2013 at 10:43
  • Yes, I did this after reverting and there was no issue with ping (Of course, after reverting). Basically, nameserver was the only line added to /etc/resolv.conf.
    – jowabels
    May 22, 2013 at 10:59
  • I just wondered, the original /etc/resolv.conf` file already contained nameserver before adding it. When I followed your answer, the edited file now contained to lines of nameserver Is there any reason for this?
    – jowabels
    May 23, 2013 at 2:26
  • The command in my answer added the line nameserver regardless of whatever was already in the file. The original file (after a fresh install) should most likely contain that line already, although the output that you had in your question did not have that. But, after you followed the last commands in jdthood's answer, I think the file was reset and the line nameserver was added. So when you followed my answer, another line was added. Anyways, if you have two lines, it's safe to remove one of them.
    – Alaa Ali
    May 23, 2013 at 5:27

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.
sudo dpkg --remove-architecture <architecture name>
and then-
sudo apt-get update
This solved the issue for me.
Hope it helps... :)


Not the answer you're looking for? Browse other questions tagged or ask your own question.