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
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
if foo has no network connectivity or gets an address via DHCP, or
if foo has a static IP address.