Getting an error unable to resolve host on Ubuntu 16.04

  • Post category:Linux / Ubuntu
  • Post last modified:January 6, 2020
unable to resolve host

While Running any command, For example, sudo apt-get update or trying to install an application, you will get an error “unable to resolve host [myhostname]: connection Timed out “

Follow the steps below to fix it:

  • Open Terminal
  • Run the command
 sudo nano /etc/hosts

Here around 127.0.1.1, you will see an Incorrect Entry.

Verify the Hostname of the VM by running the Command:

hostname
  • Change the incorrect name with the correct name which you have captured from Step3 and save the File.
  • You can save the file by First Hitting ctrl+X and then Hit Yes.

Once this is done you will be able to run sudo apt-get update without any errors.

Ashutosh Dixit

I am currently working as a Senior Technical Support Engineer with VMware Premier Services for Telco. Before this, I worked as a Technical Lead with Microsoft Enterprise Platform Support for Production and Premier Support. I am an expert in High-Availability, Deployments, and VMware Core technology along with Tanzu and Horizon.

Leave a Reply