![]() ![]() I hope you have now enough understanding of how hostname and /etc/hosts file works. In the above guide, we learned how to resolve “sudo: unable to resolve host” error in Linux. Note : If the old hostname is present in the /etc/hosts file then just replace them with the new hostname. Then, test whether the error is resolved or not with the following command:Īs you can see the error “sudo: unable to resolve host” disappeared. ![]() Save and close the file when you are finished. To fix this error, edit the /etc/hosts file and set the hostname (newpc) with a loopback address (127.0.0.1).Īdd the line “127.0.0.1 newpc” as shown below: ![]() Since the hostname is missing and your system is not able to figure out the hostname and thus it throws the error ‘sudo: unable to resolve host’. Next, see the content of the /etc/hosts file using the following command:Īs you can see, there is no such record of your hostname (newpc). im new to ubuntu so please help im pretty sure this is what i need to fix 127.0.0.1 localhost. The local DNS record is stored in the /etc/hosts file.įirst, login to root user with the following command: anything sudo apt-get results in sudo unable to resolve host. In order to fix the error, we will need to add the DNS record locally in your system. Since this a local computer and there is no such record in the DNS. In simple terms, the hostname command cannot resolve the hostname of your system. Next, run the following command to reproduce the error:Īs you can see, the message “sudo: unable to resolve host newpc” indicates that the hostname command cannot determine the IP address of host “newpc” The above output indicates that the hostname is already setup with your system. Identify the Errorīefore starting, we need to identify the actual error with a hostname.įirst, check the hostname of your system by running the following command: In this tutorial, we will show you how to resolve “sudo unable to resolve host” error. This is not a big problem and can be solve it easily. It is mapped to the network for communication. The hostname is stored locally in the file “/etc/hostname”. ![]() The hostname is the name of your device that the network identifies with. Usually, this error occurs after changing the hostname of your system. Simon cdrom floppy sudo audio dip video plugdev netdev cat /etc/sysctl.d/ipv6.Sometimes you encounter an error “sudo unable to resolve host”. # ::1 localhost ip6-localhost ip6-loopback # The following lines are desirable for IPv6 capable hosts Make sure your hostname has no punctuation or spaces. cat cat /etc/hostsġ27.0.0.1 localhost localhost.localdomain I got similar error when I had a space character in my hostname. I've also disabled ipv6 is the kernel because my ISP's ipv6 support sucks, I tried enabling ipv6 again and the issue persists. I tried searching on the internet for people with similar issues, but most simply have a mistake in /etc/hosts or /etc/hostname, which I don't think is my case. I've given my user sudo by adding it to the sudo group, and I've rebooted multiple times since doing it. I'm on my laptop, there's no ssh involved. Everytime I use it, I get the message "sudo: unable to resolve host pulsar". I just installed stretch 5 days ago, and everything is working fine except for sudo. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |