sudo: unable to resolve host ServerName (takes very long time to "sudo su" )

sudo, ubuntu, ubuntu-12.10

Solution

try this: `/etc/hosts`

127.0.0.1 localhost
127.0.1.1 hostname:localdomain hostname

or:

127.0.0.1 localhost

Problem

I use vmware and install ubuntu 12.10 as my guest OS. and run my pc , my network interface is a wireless card however everytime when i try to sudo , i should wait for a long time. and echo ``` sudo: unable to resolve host ServerName pocUbuntu [sudo] password for poc: ``` I search almost solutions by google , there is no solution can fix my problem. when i type hostname ``` root@ServerName pocUbuntu:/home/poc# hostname ServerName pocUbuntu ``` and there is my hosts file ``` cat /etc/hosts 127.0.0.1 localhost pocUbuntu 127.0.0.1 pocUbuntu 127.0.1.1 pocUbuntu # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ``` and i can get the ack when ping the servername pocUbuntu ``` root@ServerName pocUbuntu:/home/poc# ping pocUbuntu PING localhost (127.0.0.1) 56(84) bytes of data. 64 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.030 ms 64 bytes from localhost (127.0.0.1): icmp_req=2 ttl=64 time=0.026 ms ``` how should i do ? to fix the annoying problem.

Original source