Move lxd to other server

i take a export from my lxd:
lxc publish CONTAINER_NAME --alias my-lxd
lxc image export my-lxd .
then move tarball to my new server and
lxc image import bxxxx.tar.gz --alias my-lxd
then i try to create a new-lxd-name with command
lxc init my-lxd new-lxd-name

the last one error : failed to change ACLs on /var/lib/lxd/storage-pools/default/new-lxd-name/rootfs/var/log/journal
HELP

Sounds similar to this reported bug: https://github.com/lxc/lxd/issues/6771

Can you report add your case there and advise what filesystem your storage pool is using. Thanks

i get following error:
Error: UNIQUE constraint failed: storage_volumes.storage_pool_id, storage_volumes.node_id, storage_volumes.name, storage_volumes.type

i try to move a lxd from snap version.

i using zfs
from snap installed version 3.19 with zfs file system mac net run the following command
lxc publish dontainer_name --alias my_lxd
and tar bar
"lxc images export my_lxd . "
copy tar ball to other server lxc default installation with zfs file system and bridge net
import image
lxc image import tarball.gz --alias my-lxd
ok until here the create lxd with
then lxc init my-lxd to new-container
error:
UNIQUE constraint failed: storage_volumes.storage_pool_id, storage_volumes.node_id, storage_volumes.name, storage_volumes.type

i don’t understand what happen here. But problem is solved.
i export and create it on lxd with btrfs file system then take a
lxc publish CONTAINER_NAME --alias my-lxd
lxc image export my-lxd .
and move tarball to new server with zfs as file system for lxd. then
lxc image import bxxxx.tar.gz --alias my-lxd
then i try to create a new-lxd-name with command
lxc init my-lxd new-lxd-name
just running.

So is what different that it was exported first on a ZFS filesystem and now on a BTRFS filesystem? Perhaps there is an issue exporting from ZFS, can you confirm that was the only difference?

i have a lxd on zfs and want to move to other server with zfs in lxd default. get error. then
i export it from lxd with zfs and import it to lxd on other server with btrfs as file system.
then i export it fram btrfs and export it to final server with zfs as default in lxd file system.

So I just tried this on 2 fresh ubuntu 18.04 VMs running LXD 3.19 snap with ZFS storage pools:

Steps I took (note I am using ``` (3 backticks) at start and end of command block to format the commands for readability):

VM 1:

lxc init ubuntu:18.04 c1 -s default
lxc start c1
lxc stop c1
lxc publish c1 --alias my-lxd
lxc image export my-lxd my-lxd
scp my-lxd.tar.gz vm2:

VM 2:

lxc image import my-lxd.tar.gz --alias my-lxd
lxc init my-lxd c2 -s default
lxc start c2

I didn’t encounter the ACL issue.

I suspect the unique constraint issue is caused by the ACL issue causing the lxc init to fail and not clean up fully the DB records created, so I will check our code paths for that.

Could you show me the output of:

lxd sql global 'select * from storage_volumes'

For those new to LXD like myself that find this post after googling the error message can I suggest that you double-check which version of LXD is in play :slightly_smiling_face:.

In my case I had built a number of build agents in the cloud using the cloud provider’s Ubuntu image and my provision script installed snap and LXD 4.x over the top as they weren’t already installed. I didn’t notice that LXD 3.0.3 was already installed as part of the OS image via apt and therefore I wasn’t invoking the version of LXD that I thought I was [1] :slightly_smiling_face:. After running lxd.migrate -yes to upgrade to the snap version everything worked and the container started okay. (Presumably whatever was broken was fixed via the version change.)


[1] I had built the container from scratch on the cloud server up until this point as our image server was on-premise and I didn’t discover the tarball approach until sometime later.