[Bug 1730744] Re: sudo is slow (10 seconds) when hostname is not resolvable
Scott Moser
ssmoser2+ubuntu at gmail.com
Tue Nov 7 20:41:14 UTC 2017
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
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1730744
Title:
sudo is slow (10 seconds) when hostname is not resolvable
Status in systemd package in Ubuntu:
New
Bug description:
I'm seeing very slow 'sudo' times in a qemu guest when the host uses systemd-resolved.
If I change /etc/resolv.conf on the host to point directly to a dns server (8.8.8.8) then the problem goes away.
To recreate, you can download a cloud image and boot it under qemu with a command line like:
cloud-localds seed.img user-data meta-data
qemu-system-x86_64 -enable-kvm \
-device virtio-net-pci,netdev=net00 \
-netdev type=user,id=net00 \
-drive file=root.img,id=disk00,if=none,index=0 \
-device virtio-blk,drive=disk00,serial=root.img \
-drive file=seed.img,id=disk01,if=none,index=1 \
-device virtio-blk,drive=disk01,serial=seed.img \
-m 768
Make sure that your hostname does not resolve (change it to 'bogus-host1').
Log into the guest and then just try sudo, you'll see something like:
# time sudo ls
sudo: unable to resolve host rooturl-trusty
real 0m10.029s
user 0m0.006s
sys 0m0.011s
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1730744/+subscriptions
More information about the foundations-bugs
mailing list