When I created my LXC container I was using Wifi to connect to the internet. After that I’ve started using Eth connection. My LXC wouldn’t run while connected to Ethernet and only works when Wifi is connected.
When I run lxd list or lxd start it just stuck doing nothing till the Wifi is connected.
OS: Ubutnu 20.04
LXC Version: 4.19
Could you please, thank you.
I was able to figure the root of the issue with some research and the help of @smcavoy on IRC.
In logs there are these errors:
Oct 16 09:35:51 system lxd.daemon[101279]: t=2021-10-16T09:35:51+0300 lvl=warn msg="Dqlite: attempt 2: server 192.168.1.104:8443: dial: Failed to connect to HTTP endpoint: dial tcp 192.168.1.104:8443: connect: no route to host"
and I run lxd with debug using sudo lxd --debug --group lxd and got this:
DBUG[10-16|09:16:05] Initializing database gateway
INFO[10-16|09:16:05] Starting database node id=1 address=192.168.1.104:8443 role=voter
DBUG[10-16|09:16:05] Connecting to a local LXD over a Unix socket
DBUG[10-16|09:16:05] Sending request to LXD method=GET url=http://unix.socket/1.0 etag=
DBUG[10-16|09:17:31] Detected stale unix socket, deleting
DBUG[10-16|09:17:31] Detected stale unix socket, deleting
INFO[10-16|09:17:31] Unable to bind https address "192.168.1.104:8443", re-trying for a minute
INFO[10-16|09:18:30] Stopping REST API handler:
INFO[10-16|09:18:30] - closing socket socket=/var/snap/lxd/common/lxd/unix.socket
INFO[10-16|09:18:30] Stopping /dev/lxd handler:
INFO[10-16|09:18:30] - closing socket socket=/var/snap/lxd/common/lxd/devlxd/sock
EROR[10-16|09:18:30] Failed to start the daemon err="Bind network address: listen tcp 192.168.1.104:8443: bind: cannot assign requested address"
INFO[10-16|09:18:30] Starting shutdown sequence signal=interrupt
INFO[10-16|09:18:30] Transferring leadership address=192.168.1.104:8443
WARN[10-16|09:18:30] Could not handover member's responsibilities err="Failed to transfer leadership: No online voter found"
DBUG[10-16|09:18:30] Cancel ongoing or future gRPC connection attempts
DBUG[10-16|09:18:30] Cancel ongoing or future gRPC connection attempts
INFO[10-16|09:18:30] Stop database gateway
INFO[10-16|09:18:30] Not unmounting temporary filesystems (instances are still running)
INFO[10-16|09:18:30] Daemon stopped
Error: Bind network address: listen tcp 192.168.1.104:8443: bind: cannot assign requested address
@smcavoy advice me to check with lxc config edit and I found the IP there. I can delete it and connect locally using lxc or change it to the current one.