lxc / incus

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

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

Open afriqs opened 1 month ago

afriqs commented 1 month 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 1 month 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

afriqs commented 1 month ago

Hi,

I tried again with version 6.6 and it seems to work now :shrug:

I moved a windows 11 vm and it fails to start with a UEFI error but this is another story I think, so I close the issue.

afriqs commented 1 month ago

Well, I think I was too optimistic :sweat_smile: I moved a bullseye vm I work on and it fails to boot, see screenshot

Capture d’écran du 2024-10-16 17-32-57

afriqs commented 1 month ago

Another test performed this morning:

  1. backup vm with snapshots: incus export my-vm.tgz
  2. remove vm: incus delete my-vm
  3. import back vm: incus import my-vm.tgz (in defautl storage wich is still btrfs)
  4. start vm: :ok_hand:
  5. stop vm
  6. remove vm: incus delete my-vm
  7. import vm in zfs storage: incus import my-vm.tgz --storage incus-zfs
  8. start vm: :boom:

error in console after import to zfs