I noticed that when I type sudo SomeCommand it hangs for a little. I started trying to figure out what was going on found one very strange thing: when I type tcpdump -i wlan0 and then do sudo, I get this:

IP Jebediah-PC.35662 > gateway.domain: 58284+ A? Jebediah-PC.
IP Jebediah-PC.35662 > gateway.domain: 62298+ AAAA? Jebediah-PC.
IP Jebediah-PC.45253 > gateway.domain: 22831+ PTR? 
IP gateway.domain > Jebediah-PC.35662: 58284 NXDomain 0/1/0
IP gateway.domain > Jebediah-PC.35662: 62298 NXDomain 0/1/0 
IP gateway.domain > Jebediah-PC.45253: 22831 NXDomain 0/1/0
IP Jebediah-PC.44842 > gateway.domain: 33078+ PTR?

It looks like some sort of DNS lookup. Here is a wireshark screenshot: screenshot

  • just to make it clear , "Jebediah-PC" and "galaxy-s2" are the same machine – Newbieprogrammer Jan 9 '17 at 6:30
  • In this instance, what is the someCommand? – roaima Jan 9 '17 at 10:44
  • sudo by itself should return a usage error. What did you actually enter that triggered this DNS lookup? – roaima Jan 9 '17 at 10:55
  • 1
    One can trigger this problem with a mere sudo true, roaima. I've experienced sudo's sensitivity to unavailable or slow proxy DNS service, myself. – JdeBP Jan 9 '17 at 12:04
  • If any of the existing answers solves your problem, please consider accepting it via the checkmark. Thank you! – Jeff Schaller Apr 23 '17 at 12:47

Because sudo rules can specify a hostname, sudo has to resolve the hostnames of the local interfaces (so that it can tell if you're matching a host-specific rule). As the other Jeff S. said, this is likely because /etc/hosts doesn't contain "Jebediah-PC", and so you have to wait for the DNS lookups to fail.


My reputation is too low to leave a comment so this is more of a comment than an answer.

Since you state Jebediah-PC and galaxy-s2 are the same machine, it looks like it may have to do with changes to your hostname - see the below posts.



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.