Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Ubuntu 12.04. I am doing Internet with a USB Modem of 236kbps. My issue is that if I am accessing a web page through a browser it works, but if I am doing sudo apt-get update in a terminal, there is no response. Please help me to solve this.

One more thing; I am unable to change my DNS settings.

raja@badfox:~$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)

I want to replace these addresses with ones linked here

See the picture to have some idea about my issue .enter image description here

share|improve this question
You can also use Google Public Free DNS server, you can view the LINUX section there to configure it. – atenz Jun 28 '12 at 15:47
@tijybba , thanks for the link but see my post i cant edit & edit will overwrite . so i want to save my changes with out overwritten . – Raja Jun 28 '12 at 15:52
You can add your choice of DNS below the currently present , see my answer for editing them , so that solves OVERWRITING issues. – atenz Jun 28 '12 at 16:17
up vote 2 down vote accepted

In Ubuntu 12.04 changes were made to DNS resolving, announced here; also see the resolvconf man page.

Changes state that

resolvconf is a set of script and hooks managing DNS resolution. The most notable difference for the user is that any change manually done to /etc/resolv.conf will be lost as it gets overwritten next time something triggers resolvconf. Instead, resolvconf uses DHCP client hooks, a Network Manager plugin and /etc/network/interfaces to generate a list of nameservers and domain to put in /etc/resolv.conf.

"I use static IP configuration, where should I put my DNS configuration?"

The DNS configuration for a static interface should go as “dns-nameservers”, “dns-search” and “dns-domain” entries added to the interface in /etc/network/interfaces

To try from Older method i.e. prior to Ubuntu 12.04 edition

NOTE: Before you change your DNS settings to use Google Public DNS or OpenDNS, be sure to backup the current server addresses or settings somewhere. It is very important that you keep these numbers for backup purposes, in case you need to revert to them at any time.

Option A: Changing DNS server settings on Ubuntu can be configured through Network Manager.

In the System Settings..., go to Network, then Select the connection for which you want to configure Google Public DNS.

  • To change the settings for an Ethernet connection, select the Wired tab, then select your network interface in the list. It is usually called eth0.

  • To change the settings for a Wireless connection, select the Wireless tab, then select the appropriate wireless network.

  • Click Edit, and in the window that appears, select the IPv4 Settings or IPv6 Settings tab according to your needs.

  • If the selected method is Automatic (DHCP), open the dropdown and select Automatic (DHCP) addresses only instead. If the method is set to something else, do not change it.

  • In the DNS servers field, enter the Google Public DNS IP addresses, separated by a space:

    For IPv4: and/or

    For IPv6:

    2001:4860:4860::8888 and/or 2001:4860:4860::8844
  • Click Apply to save the change. If you are prompted for a password or confirmation, type the password or provide confirmation. Test your settings here.

Option B: Alternately through CLI

  • Edit /etc/resolv.conf:

    sudo gedit /etc/resolv.conf
  • If any nameserver lines appear, backup the IP addresses for future reference.

  • Replace the nameserver lines with, or ADD the following lines:

    For IPv4:


    You can select your Linked addresses here.

    For IPv6:

    nameserver 2001:4860:4860::8888
    nameserver 2001:4860:4860::8844
  • Save and exit. And again test it from above link.


share|improve this answer
hmm i tried already to change dns with sudo nano /etc/resolv.conf but its saving and overwrite what have typed . for that auto overwrite the reason also displayed . your answer is good but its not gonna help with my issue . – Raja Jun 28 '12 at 16:40
You mean , that no matter whatever entry you add but it sets back to default values. – atenz Jun 28 '12 at 16:56
Edited answer , since i just discovered that DNS resolving has gone some changes from Ubuntu 12.04 , which is why your settings get OVERWRITTEN.Also refer this question for info… on that. – atenz Jun 28 '12 at 17:19

First(optional), select a better mirror. Launch Synaptic Package Manager. Then click "Setting" → "Repositories". select the download source that's closest to you. [Drawback of this step: some local mirror is not updated.]

Then, install apt-fast with the following instruction:

Finally, create symbolic link by running:

sudo mv /usr/bin/apt-get /usr/bin/apt-get_BACKUP

and then run

sudo ln /usr/bin/apt-get_BACKUP /usr/bin/apt-get

If you encounter any problem, says apt-get no longer work, run this:

sudo rm /usr/bin/apt-get

then this:

sudo mv /usr/bin/apt-get_BACKUP /usr/bin/apt-get

Hope it helps.

EDIT: This issue seems irrelevant to DNS server. According to your photo, it shows a slow download speed/ unstable connection, instead of high domain name resolution delay. Anyway, if you want to use another DNS server, consider OpenDNS. Also, the maximum transfer rate of your modem is 236kbps, i.e. 29.5KB per second. Don't expect a fast Internet connection.

share|improve this answer
with a try of selecting best server from update manager's settings , its fine now . so i want to know wht i cant edit my resolv.conf file . Thank you . – Raja Jun 28 '12 at 15:41
You may edit resolv.conf if you want. However, it is not necessary because it seems that it is irrelevant to the issue.DNS server is used to convert domain name to IP address. e.g. if you type in the address bar, DNS will convert it into .If you type in address bar,instead of, you can still browser the webste.Therefore, if your ISP's DNS server is not working properly,there would be a long delay before you can enter google's website by entering in your addr bar. But it's not your case because you can access websites well. – Konfle Dolex Jun 29 '12 at 5:13
see the post properly , i cant edit it and if i did so my changes will be overwritten , i already tried all to edit before i post it here .Thanks :) – Raja Jun 29 '12 at 13:40
You can't edit /etc/resolv.conf because the file is controlled by resolvconf. You have to configure the programs that use resolvconf to update resolv.conf. More generally, don't ask multiple questions in one AskUbuntu question, otherwise you are defeating the purpose of AskUbuntu. Your main original question was about apt-get update hanging. Your resolvconf question is completely different. And it has been asked before. And answered. And the answer is already in resolvconf(8). – jdthood Oct 29 '12 at 11:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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