Public bug reported: I just installed Ubuntu-22.04 last week and have noticed lots of command line apps seem to hang for 10-30sec before working. Eventually that got annoying enough that I looked into it.
Anyway, apps like "telnet" (yep, I'm that old) and oddly enough sudo showed this issue strongly. In the end I ran them with strace and could see the pause occurred when /run/systemd/resolve/io.systemd.Resolve was called. So systemd-resolve was involved. Then I cranked up "tcpdump -n -i any port 53" and re-ran the commands. What I found was systemd-resolver was throwing DNS lookups for my hostname at all the DNS servers I had configured (default on wifi plus corporate always-on VPN link). Now the thing is our corporate VPN has SIXTEEN domains in the search domain field... So as systemd-resolver was doing one "A" plus one "AAAA" lookups for each "hostname.search-domain" - well there's the hang. In fact 30sec is quite a good response time ;-) To fix it I simply added my raw (ie non-dot) hostname to /etc/hosts - completely blocked this self-hostname lookup that must be going on. Now there are no DNS lookups at all for my hostname in this situation. All is good. But it does make me wonder if perhaps Ubuntu shouldn't always put the hostname into /etc/hosts? Even pointing at 127.0.0.99 (for example) might be enough (I haven't actually tested that - I'm pointing it at my static VPN IP) Anyway, this is a corner case for sure - but it might shave some delays off a bunch of folks. This also might seem cosmetic, but I would guess any application that calls gethostbyname or equivalent on itself is triggering this. PS: I had Ubuntu-20.04 before this and didn't have the problem. But looking at a backup I can see I also had my hostname in the /etc/hosts file - so this might have affected 20.04 too but I "accidentally" fixed it early on without realizing it ** Affects: systemd (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to systemd in Ubuntu. https://bugs.launchpad.net/bugs/1966037 Title: some applications hang for up to 30sec due to /run/systemd/resolve/io.systemd.Resolve Status in systemd package in Ubuntu: New Bug description: I just installed Ubuntu-22.04 last week and have noticed lots of command line apps seem to hang for 10-30sec before working. Eventually that got annoying enough that I looked into it. Anyway, apps like "telnet" (yep, I'm that old) and oddly enough sudo showed this issue strongly. In the end I ran them with strace and could see the pause occurred when /run/systemd/resolve/io.systemd.Resolve was called. So systemd-resolve was involved. Then I cranked up "tcpdump -n -i any port 53" and re-ran the commands. What I found was systemd-resolver was throwing DNS lookups for my hostname at all the DNS servers I had configured (default on wifi plus corporate always-on VPN link). Now the thing is our corporate VPN has SIXTEEN domains in the search domain field... So as systemd-resolver was doing one "A" plus one "AAAA" lookups for each "hostname.search- domain" - well there's the hang. In fact 30sec is quite a good response time ;-) To fix it I simply added my raw (ie non-dot) hostname to /etc/hosts - completely blocked this self-hostname lookup that must be going on. Now there are no DNS lookups at all for my hostname in this situation. All is good. But it does make me wonder if perhaps Ubuntu shouldn't always put the hostname into /etc/hosts? Even pointing at 127.0.0.99 (for example) might be enough (I haven't actually tested that - I'm pointing it at my static VPN IP) Anyway, this is a corner case for sure - but it might shave some delays off a bunch of folks. This also might seem cosmetic, but I would guess any application that calls gethostbyname or equivalent on itself is triggering this. PS: I had Ubuntu-20.04 before this and didn't have the problem. But looking at a backup I can see I also had my hostname in the /etc/hosts file - so this might have affected 20.04 too but I "accidentally" fixed it early on without realizing it To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1966037/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp