fwiw, its sudo that is causing the roundtrip. you can certainly come up with reasons to pay a round trip. the infrastructure then can make changes and each system magically picks them up. its the reason we don't ship /etc/hosts files around anymore.
all that said, this issue can definitely be handled better than it is. A couple options: a.) cloud-init could use manage_etc_hosts=localhost on platforms it knows will not provide dns lookup (this though coudl change, and probably should change on lxd, and then cloud-init has to be updated to accomodate... it gets tricky to service that logic if it ever changes as customers will use different versions of lxd). b.) libnss-myhostname might be able to help. that is mentioned by xnox in a related bug bug 1730744. More conversation took place in IRC at https://irclogs.ubuntu.com/2018/01/04/%23ubuntu-server.html#t14:57 ** Also affects: cloud-init Importance: Undecided Status: New ** Changed in: cloud-init Status: New => Confirmed ** Changed in: cloud-init (Ubuntu) Status: New => Confirmed ** Also affects: cloud-images Importance: Undecided Status: New -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to cloud-init. https://bugs.launchpad.net/bugs/1741277 Title: Not all platforms running cloud-init end up with the system hostname resolveable by default Status in cloud-images: New Status in cloud-init: Confirmed Status in cloud-init package in Ubuntu: Confirmed Bug description: Except for existing setups, almost everyone will want manage_etc_hosts: localhost by default. Without this, various things end up broken because a system can't look up its own hostname. Are there any use cases where a default of manage_etc_hosts: localhost will cause problems? To avoid stepping on people's toes, I'm not suggesting making the change retrospectively. But if new Ubuntu releases start doing it (eg. with Bionic) and old releases maintain existing behaviour, then we'd get there over time. Is there any existing mechanism or process for changing cloud-init defaults like this? To manage notifications about this bug go to: https://bugs.launchpad.net/cloud-images/+bug/1741277/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp