Ubuntu: sudo unable to resolve host Fix

The symptom is simple. Whenever you run a sudo command, the terminal returns an error message, “sudo: unable to resolve host”. This fix should be able to mend the problems.

For me, this occurs most frequently thanks to Parallels. Parallels automatically generate VM with a host name “parallels-vm”. I have multiple Macs running multiple virtual machines simultaneously, so I prefer to name them identifiably, and doing so almost always cause the issue.

On Terminal:
 sudo gedit /etc/hosts
Replace “parallels-vm” with a name of your choice: localhost parallels-vm
And reboot to make sure:
 sudo reboot

What concerns me, at least from the accessibility point, is that why the hostname has not been updated up to what a GUI-familar user would expect it to, and why Ubuntu community does not seem to care to fix this simple hiccup. This is what I would call ‘it just works’ principle; if you design a GUI in any moment, any critical system change has to affect the whole system instead of requiring users to do it again on the terminal.

At the very least, this fix should stop producing the error message in question.

Leave a comment