LXD vm of armhf/arm64 environment

Recently, we have a requirement to build snaps (ex. kernel snap, initrd snap) or initramfs on armhf/arm46 environment. We are thinking about using LxD vm to do that.
We do see some images available on this site: https://us.images.linuxcontainers.org/

How can we initiate the image as a VM?
ex,

lxc launch -p oem-arm images:ubuntu/bionic/armhf/cloud armhf-bionic-test --vm

This shows:

Error: Failed instance creation: The requested image couldn’t be found

Unfortunately, there is no VM for Ubuntu Bionic Cloud on armhf. There is one for arm64 though:

lxc launch images:ubuntu/bionic/cloud/arm64 arm64-bionic-test --vm
1 Like

Is there any packages need to be install first?
When doing
lxc launch -p oem-arm64-bionic images:ubuntu/bionic/cloud/arm64 arm64-bionic-test --vm
I got

Creating arm64-bionic-test
Error: Failed instance creation: Failed creating instance record: Requested architecture isn’t supported by this host

My host: Ubuntu Server 20.04.2 LTS

The host architecture needs to be the same as the VM’s. For example, you won’t be able to run arm64 VMs on x86_64.

Does that mean we need a ARM64 native host to run an arm64 vm? That really challenges my imagination about container. If I can easily have arm64 host, why bother running a container on it.
My original thought is by using LxD vm, I can run any architecture as a container or VM. Is it not correct?

Yes.

No, that’s not correct. LXD does virtualization (containers and VMs). What you seem to be looking for is emulation.

Please correct me, if I am wrong. I thought LxD is based on QEMU, which is in my opinion an emulator to emulate all architectures?

QEMU is an emulator and virtualizer. LXD however makes use of the host’s CPU (-cpu host option in QEMU) and will thus only do virtualization.

I got it, and thank you so much for the detail.
It would be a great help if this feature can be added into future road map. We have more IoT projects on ARM base, and to build snaps on native machine is always painful, especially from infrastructure point of view.

I found this wiki which is still updated
https://wiki.ubuntu.com/ARM64/QEMU