Error: Can't create stateful snapshot of LXD Linux VM

Summary

I’m trying to take a stateful snapshot of an LXD virtual machine. When I use the --stateful parameter, I get an error saying:

Error: Failed initializing state save to "/var/snap/lxd/common/lxd/virtual-machines/a01/state": Migration is disabled when VirtFS export path '/var/snap/lxd/common/lxd/devices/a01/config.mount' is mounted in the guest using mount_tag 'config'

Question: How do I take a stateful snapshot of an LXD virtual machine?

Repro Steps

  1. Launch new LXD VM lxc launch --vm images:alpine/3.18 a01
  2. Set VM config lxc config set config.migration.stateful=true
  3. Set VM config devices.root.size.state: 1GiB
    a. NOTE: (copy devices config from lxc config show --extended a01)
  4. Attempt stateful snapshot: lxc snapshot a01 --stateful
  5. Observe error message

This looks like an issue with distrobuilder Alpine image thatis leaving the config mount used by the lxd-agent still mounted inside the guest after it has started.

Would you mind opening an issue at https://github.com/lxc/distrobuilder/issues ?

CC @monstermunchkin

1 Like

Created issue here: Error while taking stateful snapshot of LXD VM · Issue #729 · lxc/distrobuilder · GitHub

1 Like
2 Likes