[Bug 1730744] Re: sudo is slow (10 seconds) when hostname is not resolvable

Scott Moser ssmoser2+ubuntu at gmail.com
Tue Nov 7 22:07:13 UTC 2017


Somewhat interestingly, I'm not sure why I can't just reproduce this by:

$ sudo bash -c 'oname=$(hostname); 
  trap "hostname $oname" EXIT; 
  hostname my-bogus-hostname; 
  hostname;
  time sudo /bin/true;' ; hostname

but it doesnt reproduce this way.

-- 
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