Error message when I run sudo: unable to resolve host (none)


Problem



ubuntu@(none):~$ sudo true
sudo: unable to resolve host (none)

Two things to check (assuming your machine is called my-machine, you can change this as appropriate):



  1. That the /etc/hostname file contains just the name of the machine.



  2. That /etc/hosts has an entry for localhost. It should have something like:




 127.0.0.1    localhost.localdomain localhost
127.0.1.1 my-machine

If either of these files aren't correct (since you can't sudo), you may have to reboot the machine into recovery mode and make the modifications, then reboot to your usual environment.


Example


Your hostname (dave00-G31M-ES2L) is not represented in /etc/hosts. Add an L to this line:

127.0.1.1   dave00-G31M-ES2


So it becomes:

127.0.1.1   dave00-G31M-ES2L


In order to accomplish this, open a console (press Ctrl+Alt+T) and type:

sudo gedit /etc/hosts


Add the letter L as mentioned, save and exit.





Comments

Popular posts from this blog

Android App Version Update using the following cordova cli commands

75 inspirational quotes that will change your life

Retrieval Image From DataBase and Display on WebPage by Using Servlets.