2

Recently, I tried to run the command, sudo apt-get update and got the Temporary failure in name resolution error. But, after that the command proceeded and went on to update. Should I worried about the error. Below is the complete log:

sudo apt-get update
sudo: unable to resolve host {hostname}: Temporary failure in name resolution
Hit:1 http://in.archive.ubuntu.com/ubuntu focal InRelease                                                                                                                                                 
Get:2 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]                                                                                                                                
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]                                                                                                                                 
Fetched 6,581 kB in 6s (1,180 kB/s)                                       
Reading package lists... Done
 
2
  • 2
    Does this answer your question? Error message "sudo: unable to resolve host (none)"
    – muru
    Jun 4 at 7:36
  • i guess your dns server is not properly setup. cat /etc/resolv.conf should point to a dns nameserver like your route / gateway. As alternative you can try one from google: type in as root (without sudo) echo nameserver 8.8.8.8 >> /etc/resolv.conf a second hint might be a wrong default route ip route should list a default route via your router / gateway ip. If not you can create such a route with sudo ip route add default via <routerip> Jun 4 at 8:27
4

It seems likely that your computer's hostname is not configured correctly. There are two files you should check; /etc/hostname contains just your computer's name, and /etc/hosts will have a line that maps the IP address 127.0.1.1 to your hostname. For example, those files might look like:

username@ubuntu ~ $ cat /etc/hostname
ubuntu

username@ubuntu ~ $ cat /etc/hosts
127.0.0.1       localhost
127.0.1.1       ubuntu

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

If you don't have those, try adding them -- keep in mind that a hostname should only consist of letters, numbers, and hyphens -- then reboot and see if you have that error again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.