lxc / incus

Powerful system container and virtual machine manager
https://linuxcontainers.org/incus
Apache License 2.0
2.58k stars 214 forks source link

Issues while moving instances with snapshot from one storage to another #1264

Open afriqs opened 1 week ago

afriqs commented 1 week ago

Required information

Issue description

While installing lxd some years ago I used a btrfs backend for storage. I wanted to try zfs so I created one and wanted to move my instances to the latest one, but my instances did not want to start properly.

storages details

$ incus storage show lxc-storage | head -6
config:
  size: 150GiB
  source: /var/lib/incus/disks/lxc-storage.img
description: ""
name: lxc-storage
driver: btrfs
$ incus storage show incus-zfs | head -7
config:
  size: 60GiB
  source: /var/lib/incus/disks/incus-zfs.img
  zfs.pool_name: incus-zfs
description: ""
name: incus-zfs
driver: zfs

Steps to reproduce

without snapshots

Everything seems to be :+1:

$ incus launch images:debian/12 my-debian --vm
Launching my-debian
$ incus exec my-debian hostname
my-debian
$ incus stop my-debian
$ incus move my-debian --storage incus-zfs
$ incus start my-debian
$ incus exec my-debian hostname
my-debian

with snapshots

Something went bad

$ incus launch images:debian/12 my-debian --vm
Launching my-debian
$ incus exec my-debian hostname
my-debian
$ incus stop my-debian
$ incus snapshot create my-debian clean-install
$ incus snapshot list my-debian
+---------------+-----------------------+------------+----------+
|      NOM      |       TAKEN AT        | EXPIRES AT | STATEFUL |
+---------------+-----------------------+------------+----------+
| clean-install | 2024/09/29 19:08 CEST |            | NO       |
+---------------+-----------------------+------------+----------+
$ incus move my-debian --storage incus-zfs
$ incus start my-debian
$ incus exec my-debian hostname
Error: VM agent isn't currently running
$ incus console my-debian --type=vga
$ incus stop my-debian --force
$ incus move my-debian --storage lxc-storage
$ incus start my-debian
$ incus exec my-debian hostname
Error: VM agent isn't currently running
$ incus console my-debian --type=vga
$ incus stop my-debian --force

Information to attach

The cropped snapshots of th console : Console 1 Console 2

alex14641 commented 2 days ago

I followed all the steps OP specified, and got the same result; however, when I stopped then started the VM, waited 20 seconds, then ran the exec command, it worked.

My environment: Distro: Slackware current Incus version: build from latest git Kernel version: 6.10.13 ZFS version: 2.26