While working with the new Windows Subsystem for Linux beta on Windows 10, I noticed that any time I ran a command with
sudo I would get a long pause and the following error printed to the screen.
sudo: unable to resolve host OPTIMISTPRIME
The command would still run, but the pause would last for several seconds while this resolution failure happened.
It appears that the hosts file located at
/etc/hosts was missing an entry. I added the entry and the problem went away. Here is what it looks like now:
Note the third line
If you are unfamiliar with linux it might be confusing figuring out how to edit this file so here is a step by step guide.
- Make sure you know what your hostname is by running
- Open the hosts file in VIM
sudo vim /etc/hosts.
- Navigate to an empty row with your arrow keys and hit the
ikey to enter insert mode.
- Type the localhost address followed by a space and your hostname exactly as it appears in the hostname file.
- Hit the
Esckey to switch back to normal mode.
enter, to write your changes and quit VIM.
- Close bash and reopen it just for good measure.
TEEHEE Yes my windows VM is named OptimistPrime and my OSX host is named Negatron.