This is more easily recreated with lxc. Given a host with systemd-resolv:
$ lxc launch ubuntu-daily:xenial x1 $ sleep 10 # let it boot $ lxc exec x1 -- grep '^[^#]' /etc/resolv.conf nameserver 10.75.205.1 search lxd $ lxc exec x1 -- hostname bogus-host $ lxc exec x1 -- bash -c 'time sudo /bin/true' sudo: unable to resolve host bogus-host: Connection timed out real 0m20.042s user 0m0.005s sys 0m0.014s $ lxc exec x1 -- bash -c 'time host bogus-host 10.75.205.1' Using domain server: Name: 10.75.205.1 Address: 10.75.205.1#53 Aliases: Host bogus-host not found: 2(SERVFAIL) real 0m0.780s user 0m0.011s sys 0m0.015s $ lxc exec x1 -- bash -c 'time hostname --fqdn' hostname: Temporary failure in name resolution real 0m10.009s user 0m0.002s sys 0m0.000s -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1730744 Title: sudo is slow (10 seconds) when hostname is not resolvable To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1730744/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
