Tech Tips on Computers, Internet, Blogging, Web Development, Social Media, Android and more

Full width home advertisement

Post Page Advertisement [Top]


ubuntu-unable-to-resolve-host

Installed Ubuntu and ran "sudo" command, and I'm getting "unable to resolve host". The message "unable to resolve host" is occurring because the hostname was changed. The initial hostname during the installation of Ubuntu was something else and after the installation, the hostname was changed.
  • Changing the hostname:
 
Open Terminal (Ctrl + Alt + T)
tiyiworo@jzkdell:~$ sudo vi /etc/hostname

The the message "unable to resolve hsotname" started appearing.

To resolve the message "unable to resolve hostname", the new hostname also need to be added in the "hosts" file at /etc/hosts.

  • Elevate to super user
tiyiworo@jzkdell:~$ sudo su
sudo: unable to resolve host jzkdell
[sudo] password for tiyiworo:
root@jzkdell:/home/tiyiworo#
  • Open /etc/hosts in vi editor with elevated permissions
root@jzkdell:/home/tiyiworo# sudo vi /etc/hosts
  • Edit out the old hostname with the new hostname
Before:
127.0.0.1       localhost
127.0.1.1       Dell-Vostro-1014

After:
127.0.0.1       localhost
127.0.1.1       jzkdell
 

edit-hostname-vi-etc-hosts

[ To quit vi editor, press : (colon) and press q! and press enter]


tiyiworo@jzkdell:~$ sudo su
root@jzkdell:/home/tiyiworo#



Now, the message "unable to resolve host is no more seen.

[Ubuntu 16.04 LTS]

No comments:

Post a Comment

Bottom Ad [Post Page]