How to migrate LXD containers from servers with 2.0.11 to others with 5.13?

Hi Thomas, thanks for looking into this.

Right, I did not do an lxd init.

I saw the Error: Both legacy and new local database files exists error too. But I see only the new database :

Old one seems gone :

20230606_232048 root@nas2:~/ ls -la /var/lib/lxd/
ls: cannot access '/var/lib/lxd/': No such file or directory

New tree :

20230606_232306 root@nas2:~/ ls -la  /var/snap/lxd/common/lxd/
total 236
drwxr-xr-x 16 root root  4096 Jun  3 00:41 .
drwxr-xr-x  7 root root  4096 Jun  3 00:41 ..
drwx------  2 root root  4096 Jun  3 00:41 cache
drwx--x--x 16 root root  4096 Jun  3 00:41 containers
drwx------  3 root root  4096 Sep  3  2018 database
drwx------  3 root root  4096 Jun  3 00:41 database.pre-migration
drwx--x--x 13 root root  4096 May 31 16:22 devices
drwxr-xr-x  2 root root  4096 Sep  3  2018 devlxd
drwx------  2 root root  4096 Sep  3  2018 disks
drwx------  2 root root  4096 Sep  3  2018 images
drwxr-xr-x  2 root root  4096 Jun  3 00:41 logs
-rw-r--r--  1 root root 78848 Jun  3 00:41 lxd.db
-rw-rw-r--  1 root root 78848 Jun  3 00:41 lxd.db.pre-migration
drwx--x--x  2 root root  4096 Sep  3  2018 networks
drwx------  4 root root  4096 Sep  5  2018 security
-rw-r--r--  1 root root  1899 Sep  3  2018 server.crt
-rw-------  1 root root  3243 Sep  3  2018 server.key
drwx--x--x  2 root root  4096 Sep  3  2018 shmounts
drwx------ 13 root root  4096 May 31 16:22 snapshots
drwx--x--x  3 root root  4096 Sep  4  2018 storage-pools
srw-rw----  1 root lxd      0 Sep 22  2021 unix.socket

Is it perhaps complaining about some of these ?

20230606_232724 root@nas2:~/ find /var/snap/lxd/common/ -iname "*db"
/var/snap/lxd/common/lxd/lxd.db
/var/snap/lxd/common/lxd/database.pre-migration/global/logs.db
/var/snap/lxd/common/lxd/database.pre-migration/local.db
/var/snap/lxd/common/lxd/database/global/logs.db
/var/snap/lxd/common/lxd/database/local.db

About https://github.com/lxc/lxd/issues/4542 :
There are no snap changes

20230606_232757 root@nas2:~/ snap changes
no changes found

But there is that db file

20230606_232900 root@nas2:~/ l /var/snap/lxd/common/lxd/lxd.db
-rw-r--r-- 1 root root 78848 Jun  3 00:41 /var/snap/lxd/common/lxd/lxd.db

About LXD v3, Failed to start the daemon: Both legacy and new local database files exists - #6 by stgraber
There is no raft in that location :

20230606_233157 root@nas2:~/ l /var/snap/lxd/common/raft
ls: cannot access '/var/snap/lxd/common/raft': No such file or directory

and the /var/snap/lxd/common/lxd.db does not exist either, it is located in a different location at /var/snap/lxd/common/lxd/lxd.db .

Can I safely move that /var/snap/lxd/common/lxd/lxd.db aside and use systemctl restart snap.lxd.daemon to see if the still running /snap/bin/lxd.migrate could then proceed ?