The symptom given in the question may correlate strongly with this more specific problem:
$ hostname --fqdn
hostname: Temporary failure in name resolution
There are different ways that this could be resolved, one of which is to add your hostname as localhost in /etc/hosts (as shown in several other answers). This may be the right thing to do in general, but it isn't the only possible resolution.
A "fully qualified domain name" may be supplied by an external DNS server or similar (if such is available on your network). In this case, sudo will not complain, despite the missing entry in /etc/hosts.
Note: sudo attempts to dereference the hostname, even though it isn't necessarily required, due to optional capabilities in the sudoers file. See sudo command trying to search for hostname.
As long as the delay isn't too long, this error message is typically harmless.
/etc/hostnameand/etc/hosts. – arrange Aug 31 '11 at 20:24hostsfile but put in a different name instead, especially since on many networks, computers are similarly named. This question (and answer) would show up when someone searches with that problem, and the answer would prompt them to check for such discrepancies, even though the exact misspelling would be different. – Eliah Kagan Aug 18 '12 at 11:09hostnamesame withhosts. e.g. the hostname is ubuntu-pc and hosts is ubuntu-pc must be same. – Muhammad Sholihin Apr 1 '13 at 8:17sudo /etc/init.d/network-manager restart. However, I'm wondering why in the first placesudowastes time waiting for network-related stuff. Shouldn'tsudowork without problems when network is not available? – bli Jul 31 '17 at 8:45