Unable to resolve Host - Windows Bash
You can fix this by adding an entry to your /etc/hosts
for your machine's hostname.
If you want a one-liner, something like this will do it:
printf "\n127.0.0.1 $HOSTNAME\n" | sudo tee -a /etc/hosts
This will append a line to your hosts
file that will resolve the current hostname to 127.0.0.1
.
When you run the command above you'll be prompted for the root password you set when the Windows Linux subsystem was installed. Also, since this command starts a shell for the root user just before it runs you'll actually see the sudo: unable to resolve host WHATEVER
message one last time just before the change is made.
Alternatively, you run an editor (such as nano
) as root and add the entry manually:
sudo nano /etc/hosts