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.
Since the hostname is missing and your system is not able to figure out the hostname and thus it throws the error 'sudo: unable to resolve host'. To fix this error, edit the /etc/hosts file and set the hostname (newpc) with a loopback address (127.0. 0.1).
The /etc/sudoers file is designed to be able to be distributed among multiple servers. In order to accomplish this, each permission in the file has a host portion. In order for sudo to know wether this rule should be applied, it needs to lookup the host it is running on.
try this: /etc/hosts
127.0.0.1 localhost
127.0.1.1 hostname:localdomain hostname
or:
127.0.0.1 localhost
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With