sudo: unable to resolve host example.com

There was a nagging issue I had with a dev server where any user that used sudo it would produce the error:

sudo: unable to resolve host example.com

The probelm: the hostname had an incorrect line ending in the file /etc/hostname.

The solution: reset the fileformat for the file back to unix. I did this with vim.

sudo vi /etc/hostname
:set ff=unix
:wq

Leave a Reply

Your email address will not be published. Required fields are marked *