Why does apt-get fail to resolve the mirror? [duplicate]

I had the same error. I originally thought it was an error in /etc/apt/sources.list but after doing a ping of not only security.ubuntu.com but google.com as well, I found that my server was connecting to the network but not reaching outside the network.

I edited /etc/network/interfaces and set eth0 to DHCP rather than static. I then had my router take care of giving the server a static IP. Reboot the server and all working fine.

You can find out more about IP configurations here.


You haven't specified any more details to the surrounding circumstances that might explain what's behind your issue.

Have it said, you seem to have some package management issues, probably due to the mirror that you are using, who may be missing or needing an update for the Precise packages that you're requesting.

Try this:

  1. Open the terminal and type:

    sudo nano /etc/apt/sources.list
    

    To edit your sources file.

  2. At the very beggining, add this lines:

    deb mirror://mirrors.ubuntu.com/mirrors.txt precise main restricted universe multiverse
    deb mirror://mirrors.ubuntu.com/mirrors.txt precise-updates main restricted universe multiverse
    deb mirror://mirrors.ubuntu.com/mirrors.txt precise-backports main restricted universe multiverse
    deb mirror://mirrors.ubuntu.com/mirrors.txt precise-security main restricted universe multiverse
    

    This should tell apt-get to automatically pick a mirror for you, based on your geographical location.

  3. Save the file and update your sources:

    sudo apt-get update
    

This assumes that you are not experiencing any internet connection or DNS problems.

Hope this helps.