After editing etc/hosts and hostname, 'unable to resolve host' still exist on my terminal, I still don't know what is the cause. Although my computer and my terminal runs so well. I'm only using single OS Ubuntu 12.04.1

enter image description here

enter image description here

enter image description hereenter image description hereenter image description here

  • 1
    Could you please post an example of what you type and the response you get? Also, adding more tags can broaden the viewership of your question to solicit more answers. I added dns for you just now. – Randall Cook Jan 27 '13 at 6:37
  • did you reboot? – don.joey Jan 27 '13 at 7:16
  • Yes, I did a reboot. – obetus Jan 27 '13 at 8:59

To change the active system hostname to, e.g., 'foo' it does not suffice to edit /etc/hostname. You have to reboot or run sudo hostname foo. Also make sure that there is a line in /etc/hosts for 'foo', either foo

if foo has no network connectivity or gets an address via DHCP, or

<IP-address> foo

if foo has a static IP address.

  • I followed your instruction., then reboot. I have an internet connection. But, "unable to resolve host" still there. – obetus Jan 29 '13 at 4:49
  • Please show the content of your /etc/nsswitch.conf file too. – jdthood Jan 29 '13 at 8:37
  • Contents of my /etc/nsswitch.conf file are now attached on the description above. – obetus Jan 29 '13 at 11:19
  • I suspect that the problem is that you have selected a hostname with a capital letter. It's conventional to use all-lower-case hostnames. Try making the host name "precise" with a lower-case pee. (However, I tried changing the name of my machine to a name starting with a capital letter and didn't encounter a problem with sudo. YMMV.) – jdthood Jan 29 '13 at 11:39
  • Ok, I will try. – obetus Jan 29 '13 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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