Friday 1 July 2016

sudo: unable to resolve host

This error generally occurs when, you launched an instance in Virtual Private Network on Amazon Web Services. Whenever you use sudo with any command, you will get something like this:


sudo: unable to resolve host <host_ip>

<host_ip> will be in the format ip-xx-xx-xx-xx

To solve this error, you just need to edit your /etc/hosts file. For it, open the file in your favorite editor. Here I am using vim.


sudo vim /etc/hosts

Now, add the following stuff in the opened file:


127.0.0.1 localhost.localdomain localhost
127.0.1.1 <host_ip>

Save the file. And restart the instance (if necessary). You are done!

0 comments:

Post a Comment

 

Copyright @ 2013 Appychip.

Designed by Appychip & YouTube Channel