Hmm, that’s odd. I guess something blew up in the middle of the upgrade.
Run mv /var/snap/lxd/common/lxd.db /var/snap/lxd/common/lxd.db.old and then try starting LXD again. Let us know if you’re missing containers or anything, in which case that lxd.db.old file may end up useful.
I had the same problem: I had a scheduled backup of the LXD database that would recreate an empty lxd.db file. I updated my backup script so it would point to the database subdir instead.
BTW, how do we restart lxd when installed as a snap?
# LXD_DIR=/var/snap/lxd/common/lxd lxd
WARN[07-04|00:37:44] AppArmor support has been disabled because of lack of kernel support
WARN[07-04|00:37:44] Couldn't find the CGroup network class controller, network limits will be ignored.
EROR[07-04|00:37:44] Failed to start the daemon: failed to create raft factory: both legacy and new global database directories exist
Error: failed to create raft factory: both legacy and new global database directories exist
I did mv /var/snap/lxd/common/raft /var/snap/lxd/common/raft.old and LXD did start with a bunch of warnings about backup.yaml,
# LXD_DIR=/var/snap/lxd/common/lxd lxd
WARN[07-04|00:48:53] AppArmor support has been disabled because of lack of kernel support
WARN[07-04|00:48:53] Couldn't find the CGroup network class controller, network limits will be ignored.
WARN[07-04|00:48:54] Unable to update backup.yaml at this time name=dbserver
Looking closely it did not start all the containers. For example i have a unifi container,
# ls -la /var/snap/lxd/common/lxd/containers/unifi
lrwxrwxrwx 1 root root 63 May 27 21:13 /var/snap/lxd/common/lxd/containers/unifi -> /var/snap/lxd/common/lxd/storage-pools/default/containers/unifi
lxc list doesnt show this container.
Starting LXD with the debug option (-d) also has no mention of this container!
Poking at the /var/log/lxd.log shows container=unifi err="Failed to run: ebtables -L --Lmac2 --Lx: The kernel doesn't support the ebtables 'filter' table." lvl=eror msg="Unable to remove network filters"
I built the ‘filter’ module in the kernel and rebooted the system. Unfortunately, there is no mention of the ‘unifi’ container in /var/log/lxd/lxd.log.
Ok, good that lxd import solved it. Otherwise I’d have suggested to try moving the database around to see if the “old” ones are actually newer than the ones you’ve got in the database directory.