Lxc copy --refresh fails in certain situation

This is related to this topic, Lxc copy --refresh fails, which got resolved. (Thanks Thomas.)

For the purpose of backing up containers, I have a script that runs this:

lxc copy --refresh [container] [remotehost]:[container]

It works great.
My containers are configured to create snapshots daily, so every day each container has a new snapshot called something like daily_20230423_011111. However, when I manually create a snapshot and call it something like “pre-install-new-software”, the nightly lxc copy --refresh command fails with this:

Error: Failed instance creation: Error transferring instance data: Failed creating instance on target: Failed to run: btrfs receive -e /var/snap/lxd/common/lxd/storage-pools/default/containers/migration.4035416621/pre-install-new-software: exit status 1 (ERROR: cannot find parent subvolume)

I have been able to fix it only by deleting the backup container and creating a fresh copy by running:

lxc copy [container] [remotehost]:[container] --stateless --allow-inconsistent

This is not a show stopper for me, but it would be nice to have it just work when I manually create snapshots.

Any ideas on how to fix this?

Which LXD version is this?

All LXD hosts are running 5.0.2.

I expect this has been fixed in 5.13 and if so will be in 5.0.3.

Are you able to test if its fixed in 5.13 by setting up a fresh setup (as upgrading the LTS to the monthly feature release will prevent you from downgrading).

I’m not able to test this just yet. If I have a moment to set up a new LXD host I’ll give it a test and report back.

1 Like