Unable to attach disk to the VM instance

Hi, I have imported legacy OS (Ubuntu 10.04) Qcow2 image into LXD 6.3 and I am having trouble to boot the image. The import was done by the command:

lxd-migrate --name <vm name> --type vm --source vm-<id>-disk-1.qcow2 --non-interactive --conversion=format --config security.csm=true --config security.secureboot=false

The imported instance won’t find the disk. I can see default image in storage list:

lxc storage volume list default
+-----------------+------+-------------+--------------+---------+
|      TYPE       | NAME | DESCRIPTION | CONTENT-TYPE | USED BY |
+-----------------+------+-------------+--------------+---------+
| virtual-machine | <vm name> |             | block        | 1       |
+-----------------+------+-------------+--------------+---------+
lxc storage list
+---------+--------+--------------------------------------------+-------------+---------+---------+
|  NAME   | DRIVER |                   SOURCE                   | DESCRIPTION | USED BY |  STATE  |
+---------+--------+--------------------------------------------+-------------+---------+---------+
| default | zfs    | /var/snap/lxd/common/lxd/disks/default.img |             | 2       | CREATED |
+---------+--------+--------------------------------------------+-------------+---------+---------+

But when I tried to attach the disk to the instance, I got error:

lxc config device add <vm name> block-volume disk pool=default source=<vm name>
or
lxc storage volume attach default <vm name = volume> <vm name = instance>

Error: Failed add validation for device "<vm-name>": Failed loading "custom/<vm-name>" from project "default": Storage volume not found

What I am doing wrong?

The VM config:

lxc config show <vm-name>
architecture: x86_64
config:
  security.csm: "true"
  security.secureboot: "false"
  volatile.cloud-init.instance-id: 5e2ebeb0-57f9-4985-9d1d-1227d5deed48
  volatile.eth0.hwaddr: 00:16:3e:90:0c:fa
  volatile.last_state.power: STOPPED
  volatile.last_state.ready: "false"
  volatile.uuid: 52de7861-777c-476d-be05-aaa968ea6b24
  volatile.uuid.generation: 52de7861-777c-476d-be05-aaa968ea6b24
  volatile.vsock_id: "488877321"
devices: {}
ephemeral: false
profiles:
- default
stateful: false
description: ""

Hi,

You have a virtual machine disk, but when attaching disk with name <vm-name> it defaults to custom/<vm-name> instead of virtual-machine/<vm-name>.

However, is this the VM root disk you are trying to attach?
Could you provide lxc config show <vm-name> --expanded, which should print devices from profiles as well.

Hi, expanded version of the config:

lxc config show <vm-name> --expanded

architecture: x86_64
config:
  security.csm: "true"
  security.secureboot: "false"
  volatile.cloud-init.instance-id: 5e2ebeb0-57f9-4985-9d1d-1227d5deed48
  volatile.eth0.hwaddr: 00:16:3e:90:0c:fa
  volatile.last_state.power: STOPPED
  volatile.last_state.ready: "false"
  volatile.uuid: 52de7861-777c-476d-be05-aaa968ea6b24
  volatile.uuid.generation: 52de7861-777c-476d-be05-aaa968ea6b24
  volatile.vsock_id: "488877321"
devices:
  eth0:
    name: eth0
    network: lxdbr0
    type: nic
  root:
    path: /
    pool: default
    type: disk
ephemeral: false
profiles:
- default
stateful: false
description: ""

The root disk is already attached to the instance.

Could you share the the error reported by lxd-migrate?
Or, in case lxd-migrate succeeds, please provide the error when instance is started.

lxd-migrate was successful.

I ended up in a initramfs with no apparent disk mounted. Error:

Gave up waiting for root device.

Common problems:

* Boot args (cat /proc/cmdline)
* Check rootdelay= (did the system wait long enough?)
* Check root= (did the system wait for the right device?)
* Missing modules (cat /proc/modules; ls /dev)

ALERT! /dev/mapper/vm-root does not exist. Dropping to a shell!

BusyBox u1.13.3 (Ubuntu 1:1.13.3-1ubuntu11) built-in shell (ash)

Enter 'help' for a list of built-in commands.

Do you have any advice?

Try using --conversion=format with the virt-v2v tool installed on your host.

See https://documentation.ubuntu.com/lxd/en/latest/howto/import_machines_to_instances/

However it maybe that virt-v2v does not support injecting virtio drivers into such an old guest and running this on LXD may not be viable.

I think this is duplicate of Unable to boot VM, so let’s continue our discussion there. Thanks

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.