Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
sudo: unable to resolve host #1759
Comments
|
That's because cloud-init doesn't update /etc/hosts by default and since we rely on cloud-init to setup the hostname, you end up with that error. If you're already feeding cloud-init user data, you can add the "manage_etc_hosts: True" key to it. @smoser what's the reason for cloud-init not updating /etc/hosts at the same time it does /etc/hostname by default? |
|
Closing this as there is nothing that LXD can do about this. Ubuntu cloud images are using cloud-init for their initial configuration, so if it makes sense to have the hosts line generated, this should be fixed there rather than in LXD. |
stgraber
closed this
Mar 30, 2016
justinnoor
commented
May 29, 2017
|
Hi how are you, my name is Justin. I am new with LXD and I am not quite clear on the recommendation above: "If you're already feeding cloud-init user data, you can add the "manage_etc_hosts: True" key to it." I think this may relate to some really strange behavior that I get with LXD, but my issue seems to be slightly different. I posted about it here but was unsuccessful in getting any responses. |
|
For better or worse, some applications will essentially do As suggested above, cloud-init can be told to a 127.0.1.1 entry into /etc/hosts for the hostname via e Lastly, This is working as desired on my lxd locally:
Given that.... should this bug be marked fixed? |
|
@smoser well, this was a reply to a closed bug, so not much closing we can do :) But yes, I also couldn't reproduce it here with recent LXD. It "may" be a problem with older LXDs though where dnsmasq isn't managed by LXD itself. Though even then, dhclient running in the container will create the required DNS entries... The most obvious case where this wouldn't work is if directly bridged to an existing external network where the DHCP running on that network doesn't also control the DNS. |
cmars commentedMar 15, 2016
Required information
Issue description
When I use sudo in containers launched with LXD, I get an error message
sudo: unable to resolve hostSteps to reproduce
I see these messages all the time in scripts that use sudo in my containers. It happens during Juju bootstrap for example but is in no way a Juju-specific issue, as the above demonstrates.
I've happily ignored this message and everything seems to work fine as far as I can tell. The problem with this message is that it tends to mislead users into thinking something is wrong -- it's a rough edge.
Let me know if anything else will help.