Notification texts go here Contact Us Buy Now!

Ubuntu: unable to resolve host when running sudo or other commands


 is occurring because the hostname was changed Ubuntu: unable to resolve host when running sudo or other commands

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
 

 is occurring because the hostname was changed Ubuntu: unable to resolve host when running sudo or other commands

[ 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]

إرسال تعليق

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.