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.