If you getting an error “Sudo unable to resolve host” while executing sudo command in Ubuntu, then here’s how you can fix the issue.
Below is the snapshot of the error:
ubuntu@test$ sudo su - sudo: unable to resolve host (test)
Solution:
Check if /etc/hostname contains the correct hostname of your machine.
$ vi /etc/hostname
Check if /etc/hosts file contains the below line with hostname appended at the end.
$ vim /etc/hosts
127.0.0.0 localhost.localdomain localhost hostname_of_machine
If the above two files contain the correct hostname of your machine, then sudo will resolve properly.
I have that problem. Will try your solution. Tnx!
Let us know if it works for you.
thank you
Perfect
Thx mate