Lxc daemon fails to start if it cannot bind to bgp address

System: Ubuntu 20.04
LXD version: lxd 5.6-794016a 23680 latest/stable canonical

sudo cat  /var/snap/lxd/common/lxd/logs/lxd.log
...
time="2022-10-06T09:30:32+02:00" level=error msg="Failed to start the daemon" err="listen tcp4 10.0.3.3:179: bind: cannot assign requested address"

From there, there is no simple way to fix the config because all lxc/lxd command fail with

Error: Get "http://unix.socket/1.0": dial unix /var/snap/lxd/common/lxd/unix.socket: connect: connection refused

In another thread, I found some sqlite commands that did the trick, however:

list contents of config:

sudo sqlite3 /var/snap/lxd/common/lxd/database/local.db .dump

Then, delete the ones that are bgp specific.

sudo sqlite3 /var/snap/lxd/common/lxd/database/local.db "DELETE FROM config WHERE key='core.bgp_address';"
sudo sqlite3 /var/snap/lxd/common/lxd/database/local.db "DELETE FROM config WHERE key='core.bgp_routerid';"

Then restart the daemon.

Hope this helps anybody with similar issues. Don’t know if this should be considered a bug.

1 Like

I think this is expected behaviour.

maybe the previous post was not completely clear about the fact, that we removed the bgp configuration from the network but it was still in the database
i do not think this is expected behaviour

Ah, no, that wasn’t mentioned.

Please can you show me a set of reproducer steps to get into that situation?

Thanks

This solution helped me solve a similar problem with core.storage_buckets_address.
I was getting the same error and LXD wouldn’t start.
I tried to see why with
> journalctl -u snap.lxd.daemon -n 300
and noticed this in the output:
Error: Bind network address: listen tcp 10.63.227.1:8555: bind: cannot assign requested address
A few days ago I was experimenting with LXD storage buckets (s3), and I had run
lxc config set core.storage_buckets_address 10.63.227.1:8555

I fixed it as per above:

sudo sqlite3 /var/snap/lxd/common/lxd/database/local.db
sqlite> DELETE FROM config WHERE key='core.storage_buckets_address';

I am adding it here, because this was very useful to me. I was exasperated and even tried to remove the LXD snap so I could start from scratch, but (luckily) “snap remove lxd” would get stuck because of this problem, so I searched the net and found this solution.

We should prevent setting a conflicting listen address.
Please can you log an issue here https://github.com/lxc/lxd/issues

Thanks

Created an issue: https://github.com/lxc/lxd/issues/11611

By the way, it took me a while to find out how to connect to the bucket, i.e. set core.storage_buckets_address
You may want to add it to the storage bucket documentation:
https://linuxcontainers.org/lxd/docs/latest/howto/storage_buckets/

Should I add another issue for that?

Thanks!

Yeah I can see why it would be hard to find if starting from that page rather than the conceptual starting page

https://linuxcontainers.org/lxd/docs/latest/explanation/storage/#storage-buckets

@ru-fu do you think we can do something with shared includes to get that point mentioned on both pages?

Yes, this is quite unclear right now.
https://github.com/lxc/lxd/pull/11614

1 Like