It is likely that it was allowed in older versions of LXD to put localhost there.
Also, in /snap/core/current/etc/hosts it shows that the snap knows about localhost.
This error message is something I’ve tracked down as I can’t load any sites in various containers… everything seems to run fine but this is the only error message I’ve been able to find so far…
Also, I can run wget successfully, so outbound stuff is fine but the sites themselves can’t be reached…
When you add a device with lxc config device add ..., you give an instruction to LXD to perform this device addition whenever you restart that container.
Therefore, if previously you could run specify localhost in the proxy device, now you cannot.
If since you cannot now, you need to first remove the old proxy device and add a new one.
$ lxc config device list mycontainer
myport80
$ lxc config device remove mycontainer myport80
Device myport80 removed from mycontainer
$ lxc config device add mycontainer myport801 proxy listen=tcp:0.0.0.0:801 connect=tcp:127.0.0.1:801
Device myport801 added to mycontainer
$ lxc config device list mycontainer
myport801
$
If you get some error, please paste verbatim the commands and their responses.
What happened is that with older versions of LXD, you could specify localhost but now you can’t.
But what happens if you have some lingering old proxy devices that still mention localhost?
In that case, you are stuck because you cannot perform any other configuration on this container!
LXD will not accept any change to the configuration of the container because after any change, the configuration will still be invalid due to the localhost.
But why can’t you just remove the offending proxy device (with localhost)?
Because it looks like you have two offending proxy devices, and with lxc config device remove ... you can remove only one device at a time. But you cannot remove any of the two, because the other will still be in there.
What you need, is a workaround to sort this issue.
Can you run
debian@br-lxd:~$ lxc config edit haproxy
and edit out both the localhost references in your proxy devices?
Does that command work for you or does LXD complain even with lxc config edit haproxy?
Ok, thank you… I just edited this line connect: tcp:localhost:80 to now read connect: tcp:0.0.0.0:80… there were 3 lines in the config with localhost entries… Everything seems to be working now!
Nevermind, there is a bug in LXD 3.16 which is preventing you from fixing this…
@tomp the fact that we’re validating the devices on instantiation makes it impossible to fix such a scenario by removing or editing the device as its current state prevents LXD from loading it. We need to change that so it’s possible to fix broken configuration.
Sorry about this, although that configuration (using “localhost” for the connect option) has been invalid since 3.15, the new device framework’s validation in 3.16 is rather over zealous in preventing use of devices that have invalid config. So much so that you are unable to edit or remove it to fix the problem.