Some Bits: Nelson's log

Ubuntu: slow login / sudo after changing hostname

Amazing Stack Exchange answer that solved a mystery for me: sudo and ssh logins were taking a few seconds. Turns out if you change your hostname on an Ubuntu box with hostnamectl it doesn’t add an entry to 127.0.0.1 for the new hostname. So you have to add it manually.

The delay isn’t so bad you can’t live with it. Maybe 2 seconds? But it’s annoying! I felt like it was DNS related but was assuming it had to do with the DNS server my datacenter was setting. But there’s no reason sudo should involve network DNS at all.

While I’m here, trying to change the DNS servers on Ubuntu is still a total clusterfuck. Not sure if the problem is netplan or systemd-resolve. resolvectl status is helpful but the output is confusing. I’m not sure if I’m getting the “global” setting or the “link” setting. I wish there were some easy way to test it. nlsookup just tells me I’m using systemd’s goofy 127.0.0.53 as the resolver.

# resolvectl status
Global
           Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
    resolv.conf mode: stub
  Current DNS Server: 8.8.8.8
         DNS Servers: 8.8.8.8 8.8.4.4
Fallback DNS Servers: 1.1.1.1 1.0.0.1

Link 2 (enp2s0)
    Current Scopes: DNS
         Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 192.187.107.16
       DNS Servers: 192.187.107.16
        DNS Domain: nocix.net

Link 3 (tailscale0)
Current Scopes: none
     Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported