Sign in to follow this  
Ice Flake

Solving 'sudo: unable to resolve host *'

Recommended Posts

You might face an error while using sudo:

sudo: unable to resolve host {your host}

This is caused by your hostname not resolving.


To solve this, follow the instructions below:


1. Find your hostname

You'll need to find out your hostname to configure it. To find it, enter this command:

hostname -f

Its output is your fully qualified hostname.


2. Add it to your hosts file

You'll have to open your hosts file for this step. Enter this command:

nano /etc/hosts

If you get 'nano: command not found', type this command to install it (if you're on Debian or any of its deriatives):

apt-get -y install nano


You should be in a prompt that looks like this:


(Move the cursor to the top left of the file if it isn't already there.)

Add these lines at the top of the file, replacing '{your host}' with the hostname you found in step 1:

::1		{your host}	{your host}


3. Save your hosts file

Press ^X (CTRL+X), release it, press Y and finally press enter.


4. Reboot your system

Enter the following command to reboot your system:



5.  Reconnect

After a few moments, try connecting to your server. If it doesn't connect, try again after a few more moments. You should now be able to use sudo without any problems.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this