Failed to restore VM: Error updating backup file

Hi, I was trying to bakcup my VM and prepare to move it. I created the backup and try to restore.

This VM was created by custom ISO wihout lxd-agent installation.
But it shows me an error:

~# lxc import vyos.tar.zst vyos
Importing instance: 100% (388.43MB/s)
Error: Create instance from backup: Error updating backup file: open /var/snap/lxd/common/lxd/storage-pools/data/virtual-machines/vyos/backup.yaml:
no such file or directory

Backup command:
lxc export --compression zstd vyos vyos.tar.zst

LXD version: 4.19

Any help ? :frowning:

Thanks!

Can you show the tar tvf output for that file?
@tomp ideas?

~# tar tvf vyos.tar.zst
-rw-r--r-- root/root        98 2021-10-10 01:57 backup/index.yaml
d--x------ root/root         0 2021-10-10 01:28 backup/virtual-machine
-rw-r--r-- root/root       704 2021-10-08 13:08 backup/virtual-machine/agent-client.crt
-rw------- root/root       288 2021-10-08 13:08 backup/virtual-machine/agent-client.key
-rw-r--r-- root/root       733 2021-10-08 13:08 backup/virtual-machine/agent.crt
-rw------- root/root       288 2021-10-08 13:08 backup/virtual-machine/agent.key
-r-------- root/root      1577 2021-10-10 01:57 backup/virtual-machine/backup.yaml
dr-x------ lxd/root          0 2021-10-08 15:06 backup/virtual-machine/config
-r-------- lxd/root          2 2021-10-08 15:06 backup/virtual-machine/config/agent-mounts.json
-r-------- lxd/root        733 2021-10-08 15:06 backup/virtual-machine/config/agent.crt
-r-------- lxd/root        288 2021-10-08 15:06 backup/virtual-machine/config/agent.key
dr-x------ lxd/root          0 2021-10-08 13:08 backup/virtual-machine/config/cloud-init
-r-------- lxd/root         40 2021-10-08 15:06 backup/virtual-machine/config/cloud-init/meta-data
-r-------- lxd/root         14 2021-10-08 15:06 backup/virtual-machine/config/cloud-init/user-data
-r-------- lxd/root         14 2021-10-08 15:06 backup/virtual-machine/config/cloud-init/vendor-data
dr-x------ lxd/root          0 2021-10-08 15:06 backup/virtual-machine/config/files
-rwx------ lxd/root        889 2021-10-08 15:06 backup/virtual-machine/config/install.sh
-rw------- lxd/root         33 2021-10-08 15:06 backup/virtual-machine/config/instance-data
-r-x------ lxd/root   10868008 2021-10-04 22:10 backup/virtual-machine/config/lxd-agent
-r-------- lxd/root        704 2021-10-08 15:06 backup/virtual-machine/config/server.crt
dr-x------ lxd/root          0 2021-10-08 13:08 backup/virtual-machine/config/systemd
-r-x------ lxd/root        896 2021-10-08 15:06 backup/virtual-machine/config/systemd/lxd-agent-setup
-r-------- lxd/root        476 2021-10-08 15:06 backup/virtual-machine/config/systemd/lxd-agent.service
dr-x------ lxd/root          0 2021-10-08 13:08 backup/virtual-machine/config/udev
-r-------- lxd/root        140 2021-10-08 15:06 backup/virtual-machine/config/udev/99-lxd-agent.rules
-rw-r--r-- root/root    131072 2021-10-08 15:06 backup/virtual-machine/qemu.nvram
-rw------- root/root 68719476736 2021-10-10 01:57 backup/virtual-machine.img

Please can you show output of lxc storage show data

I’ve recreated the issue.

It was this commit that has introduced the issue:

Previously the filesystem components of a volume were always imported (so for VM backups that included its config volume), but now that has been made conditional on the volume’s type being filesystem which for VMs it is not (its block).

So the VM’s config volume is not imported.

This should fix it:

Thank you.
I’ve tried to backup another VM created from LXD’s official images (centos7), with:
lxc export vm2 vm2.tar.zst --compression zstd --optimized-storage

And that’s ok to import. :slight_smile:

lxc storage show data:

config:
  source: data
  volatile.initial_source: /dev/sdb
  zfs.pool_name: data
description: ""
name: data
driver: zfs
used_by:
- /1.0/images/2e6095465ca0e8c8b98d253ec099f8225a84d0b4a70dd59773451191b6880844
- /1.0/images/9dc93b76d950128ddc21752481acb3aa9cc4fb7a2e9547a5c42da8a7dd40ca6e
- /1.0/instances/proxyer
- /1.0/instances/rvh2-ep
- /1.0/instances/vyos
- /1.0/profiles/default
status: Created
locations:
- none

( I recreated the VM named vyos)

Yes optimized backups will be OK to import, its an issue with the generic backup format.