Unable to correctly use lxd-migrate tool

As in subject:
I seem unable to correctly convert a working VM (qemu) to a LXD VM.

Reason for conversion is I would like to have it managed (basically networking, but clustering could be nice).

Said VM is a Firewall distribution (OpenWRT, if it matters) and I couldn’t find a way to directly prepare a VM because I need a whole disk representation.

VM is normally started as qemu-system-x86_64 -drive format=raw,file=openwrt-x86-64-generic-ext4-combined-efi.img and it starts without any problems.

I tried migration doing:

mcon@cinderella:~/projects/LXD$ sudo lxd-migrate 
Please provide LXD server URL: lxd
Certificate fingerprint: 79e895c9d3a7163fca98bcd303ab7f57a329fa90dc980db9e682d590918b0d22
ok (y/n)? y

1) Use a certificate token
2) Use an existing TLS authentication certificate
3) Generate a temporary TLS authentication certificate
Please pick an authentication mechanism above: 1
Please provide the certificate token: eyJjb...many more chars...wWiJ9

Remote LXD server:
  Hostname: lxd
  Version: 5.0.2

Would you like to create a container (1) or virtual-machine (2)?: 2
Name of the new instance: openwrt
Please provide the path to a disk, partition, or image file: /home/mcon/projects/LXD/openwrt-x86-64-generic-ext4-combined-efi.img
Does the VM support UEFI Secure Boot? [default=no]: 

Instance to be created:
  Name: openwrt
  Project: default
  Type: virtual-machine
  Source: /home/mcon/projects/LXD/openwrt-x86-64-generic-ext4-combined-efi.img

Additional overrides can be applied at this stage:
1) Begin the migration with the above configuration
2) Override profile list
3) Set additional configuration options
4) Change instance storage pool or volume size
5) Change instance network

Please pick one of the options above [default=1]: 
Instance openwrt successfully created                
mcon@cinderella:~/projects/LXD$ lxc config show lxd:openwrt --expanded
architecture: x86_64
config:
  volatile.apply_template: copy
  volatile.cloud-init.instance-id: bb0738eb-bb6d-404a-8186-6883f1cedb6f
  volatile.eth0.hwaddr: 00:16:3e:b9:a7:c6
  volatile.uuid: 18d8a3d0-ebda-487c-a84c-1a590c8c6383
devices:
  eth0:
    name: eth0
    network: lxdbr0
    type: nic
  root:
    path: /
    pool: default
    type: disk
ephemeral: false
profiles:
- default
stateful: false
description: ""
mcon@cinderella:~/projects/LXD$ lxc config device add lxd:openwrt eth1 nic nictype=macvlan parent=enp1s0
Device eth1 added to openwrt
mcon@cinderella:~/projects/LXD$ lxc config device add lxd:openwrt eth2 nic nictype=macvlan parent=enxa0cec887415e
Device eth2 added to openwrt
mcon@cinderella:~/projects/LXD$ lxc config show lxd:openwrt --expanded
architecture: x86_64
config:
  volatile.apply_template: copy
  volatile.cloud-init.instance-id: 4728a9c0-46b9-4e69-96f0-86924e7f3e3c
  volatile.eth0.hwaddr: 00:16:3e:b9:a7:c6
  volatile.eth1.hwaddr: 00:16:3e:6a:9e:d2
  volatile.eth2.hwaddr: 00:16:3e:b1:41:23
  volatile.uuid: 18d8a3d0-ebda-487c-a84c-1a590c8c6383
devices:
  eth0:
    name: eth0
    network: lxdbr0
    type: nic
  eth1:
    nictype: macvlan
    parent: enp1s0
    type: nic
  eth2:
    nictype: macvlan
    parent: enxa0cec887415e
    type: nic
  root:
    path: /
    pool: default
    type: disk
ephemeral: false
profiles:
- default
stateful: false
description: ""

Trying to start VM with:

mcon@cinderella:~/projects/LXD$ lxc start lxd:openwrt
mcon@cinderella:~/projects/LXD$ lxc console lxd:openwrt --type=vga

Results in an EFI bios trying hard to find something to boot and failing.

Apparently lxd-migrate interpreted “path to a disk, partition, or image file” as a “partition”, while it is a “disk”, but I have no clue on how to correct this.

I have a full log of what I did to get to this point, including installation of server, LXD, qemu, utils etc.; I have no problem posting it if deemed useful.

Many thanks in Advance

Please can you point me to the source of your image so I can try and reproduce?

Thanks tomp,
I downloaded from https://downloads.openwrt.org/snapshots/targets/x86/64/openwrt-x86-64-generic-ext4-combined-efi.img.gz

Problem is actually solved (as I wrote in IRC chat): I answered “return” to question:

Does the VM support UEFI Secure Boot? [default=no]: 

expecting to get a non-secure boot, but that didn’t happen.
I had to manually add: lxc config set lxd:openwrt security.secureboot=false

After that it booted correctly.

Did I misunderstand “default” meaning?

Now I have problems setting up networking, but that’s another can of worms.
Many thanks.

1 Like

Ah great! Please can you open a github issue, as that default value/result seems wrong/confusing, so we should certainly take a look at that.

Done.
It is “https://github.com/lxc/lxd/issues/11829
Please feel free to ask for further info, if needed.

1 Like