1. Home
  2. Linux
  3. How to Fix – Sudo unable to resolve host in Ubuntu?
  1. Home
  2. Network and security
  3. How to Fix – Sudo unable to resolve host in Ubuntu?

How to Fix – Sudo unable to resolve host in Ubuntu?

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.

Updated on September 2, 2017

Was this article helpful?

Related Articles

Comments

Add A Comment