"Error: Image fingerprint doesn't match" when trying to export image

Hi all,

I am trying to implement a daily backup for a particular container with these steps:

lxc publish prod_container --alias prod_container_$(date +"%Y-%m-%d") --force
lxc image export prod_container_$(date +"%Y-%m-%d") /backups/directory

It is failing on export command with the following error:

“Error: Image fingerprint doesn’t match. Got 2d0ca593b364a************ expected ccf151403cefac611c045**************”

Since this container is used during office hours, I have been testing different methods with test container (similar in size) with no issues whatsoever, but this one in particular keeps failing on the export step. I have also tried to publish image from snapshot and export image using fingerprint generated after publishing image instead of the image name, but had same error. Maybe it’s worth mentioning that the destination directory is an nfs share, however I have also tested export on local directory and error persists.

It would be nice to make this procedure work as it is simple and will have a tar image available to fire up on any other LXD server at any time. I also prefer to backup tarballs on remote nfs share rather than LXD remote as I find it much more flexible.

Since I couldn’t replicate this issue on any other container I am sort of stuck. Do any of you have any idea where to look and why it gets different fingerprint from the one expected?

Thanks :slight_smile:

I will take a look at this.

Please can you confirm the LXD version?

Also, is there a reason you’re not just doing lxc export <instance> /backups/directory/instance.tar.gz to backup the instance (as opposed to creating an image and exporting that)?

Hi @tomp,

LXD version is 4. 8.

Regarding your second question, the main reason is that when I tried to import on another LXD server (3.0.3), I was not able to.

What was the error you got when you tried that?

root@LXD-server:~# lxc import /bakcup/dir/container-2020-11-26.tar.gz
Error: unknown command “import” for “lxc”

This worked fine

root@LXD-server:~# lxc image import /bakcup/dir/container-2020-11-26.tar.gz

Ah OK so LXD 3.0.3 presumably doesn’t have container import functionality.

Does the same error occur if you stop the container before publishing?

No, but I am using the --force option which I understand does the same thing?

It doesn’t stop the container, so wondering if the contents are changing while you’re exporting.

Oh no it does, sorry, missed that bit in the logs.

If you export it to a non-NFS directory does it work?

No, I have also tried to store it on a local directory, same error :confused:

Ah you already said it worked fine locally.

I’ve not been able to recreate locally:

lxc init images:ubuntu/focal c1
lxc start c1
lxc publish c1 --alias prod_container_$(date +"%Y-%m-%d") --force
lxc image export prod_container_$(date +"%Y-%m-%d") /home/user/

I’ll have a think.

1 Like

@stgraber do you have any ideas about this one, I’ve looked but cannot see why they would differ?

Would probably be good to check what the sha256sum is for the image in /var/lib/lxd/images/ (or /var/snap/lxd/common/lxd/images if using the snap).

That sha256 should line up with what the database has in lxc image list, if it doesn’t, then something got corrupted during publish. If that’s correct, then the issue is the image getting somehow mangled during the download process.

thanks @stgraber,

Fingerprint on images dir matches with the one in the database.

Dir:
/var/snap/lxd/common/lxd/images/ccf151403cefac611**********

lxc image list:
prod_container-2020-12-07 | ccf151403cef

I tried to export from snapshot and also using --force option while publishing, theoretically it shouldn’t be changing unless i’m missing something. What else could cause the image to change during publish/export?

And you’ve confirmed that sha256sum /var/snap/lxd/common/lxd/images/ccf514... does in fact return ccf514...?

Just checked that, no it doesn’t :frowning:

9e2efa2ef4f4******** /var/snap/lxd/common/lxd/images/ccf151403cef**********

It returned a different one, also different from the one “got” on the initial error.

Error: Image fingerprint doesn’t match. Got 2d0ca593b364a************ expected ccf151403cefac611c045**************

Any error in dmesg or filesystem running out of space for /var/snap/lxd/common/lxd/images/?