Remember the previous post in which i wrote about changing your system's hostname from terminal. While many of you would have encountered a error message "sudo : unable to resolve host yourhostname" while you install or perform any task that requires root privileges. But wait, don't jump to the conclusion that you won't be able to continue your task, you can still continue with your task. There is a simple thing you have to do to get rid of this error.
- When you edited the hostname file in /etc/hostname, the hostname file just contains the machine name.
- You have to make the same change to the hosts file in /etc/hosts.
- Both the contents of the file can be viewed directly from the terminal using the commands,
- cat /etc/hostname (or) hostname
- cat /etc/hosts
- From the above image you can see that, the hostname is aldo while the name in hosts is vms20591.
- To view the contents of the file in text editor type the following commands,
- sudo gedit /etc/hostname
- sudo gedit /etc/hosts
- Note:
- Remember that still you will get the error "sudo : unable to resolve host yourhostname", but just ignore it and type your password.
- Also don't forget to run the command using sudo without that you can't make any changes in the hosts.
- You can see the hostname varies in both files.
- In order to get rid of the error, the name in the files /etc/hostname and /etc/hosts should be the same.
- Use the command previously mentioned,
- sudo gedit /etc/hostname
- sudo gedit /etc/hosts
No comments:
Post a Comment