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, 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 [IP: 80]
Err precise-updates Release.gpg            
  Unable to connect to [IP: 80]
Err precise-backports Release.gpg          
  Unable to connect to [IP: 80]
Err precise InRelease                          
Err precise Release.gpg                        
  Unable to connect to
Err precise-security InRelease
Err precise-security Release.gpg
  Unable to connect to [IP: 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 [IP: 80]
W: Failed to fetch  Unable to connect to [IP: 80]
W: Failed to fetch  Unable to connect to [IP: 80]
W: Failed to fetch  Unable to connect to
W: Failed to fetch  Unable to connect to [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 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)

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 and ping -c3 both yielded 0% packet loss. The ping for sometimes yielded 33% packet loss but mostly 0%.

Typing nslookup 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/ --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
  • 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 '13 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 '13 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, and post the output of ps aux | grep dns? Also, are you using a static IP? – Alaa Ali May 22 '13 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 '13 at 9:27
  • @Alaa I just verified that I use a dynamic IP. – jowabels May 22 '13 at 9:40

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

sudo gedit /etc/resolv.conf

and add the line


and save. Then do


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

  • 5
    @guntbert Umm. You are talking to the author of the resolvconf package. I think that he knows what he is talking about. ;-) – Kevin Bowen May 22 '13 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 ( icmp_seq=1 Destination Host Unreachable – jowabels May 22 '13 at 9:53
  • 1
    @maggotbrain thx for helping me pull my foot out of my mouth again :-) – guntbert May 22 '13 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! – Kevin Bowen May 22 '13 at 10:52
  • 2
    When I follow these steps, I get this error after I run the first command: Err wily/main resolvconf all 1.77ubuntu1 404 Not Found [IP: 80] E: Failed to fetch 404 Not Found [IP: 80] – MadPhysicist Sep 30 '17 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 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. – RienNeVaPlus Jun 6 '14 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 '14 at 15:06
  • Great Solution. Thanks – Suneel Kumar Nov 3 '15 at 11:44
  • Before pasting in vim, you'll need to edit insert mode by hitting the letter 'i' after you open it – s g Jan 27 '16 at 20:15
  • This is what worked for me. – Rick Mar 28 '16 at 6:04
up vote 6 down vote accepted

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 '13 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 '13 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 '13 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 '13 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 '13 at 5:27

protected by Community Feb 23 '15 at 22:59

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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