Apt to snap migration interrupted

I have a LXD server with LXD installed twice, with apt and snap.

I don’t remember how it came up, everything was working fine until this morning when my server reboot :confused:

None of my container started up and I can’t see them (lxc ls) but they are still here (I hope) in /var/snap/lxd/common/lxd/containers/

I know that I must run lxd.migrateto finish the migration process but it doesn’t works :
error: Unable to connect to the destination LXD: Get "http://unix.socket/1.0": dial unix /var/snap/lxd/common/lxd/unix.socket: connect: connection refused

When I look into /var/snap/lxd/common/lxd/logs/lxd.log I can see this error :
t=2021-10-05T09:22:09+0200 lvl=eror msg="Failed to start the daemon: Failed to open cluster database: failed to ensure schema: failed to apply update 43: Failed adding unique index to storage_pools_config and networks_config tables: UNIQUE constraint failed: index 'networks_unique_network_id_node_id_key'"

I Loged into sqlite (sudo sqlite3 /var/snap/lxd/common/lxd/database/global/db.bin) and effectivly I have two entries for ipv4.address

select * from networks_config;


If I delete one (id = 1) , it came back over and over :confused:

What can I do ?
How can I finish my migration process ?

Thanks a lot

I found how to remove duplicate entries with this answer Failed to load network “lxdbr0”: Duplicate config row found for key “dns.mode” for network ID 1 - #5 by tomp

LXD snap start so I can finish lxd.migrate process (which only uninstall apt LXD) and all my container are back :relieved:

1 Like