Lxd homeassistant vm

Hi All,

Is it possible to install the homeassistant os as a vm in lxd? so that it will use an existing qcow image?

If their image works under UEFI, then yeah, that should be possible.

how could this be done?

It mostly depends on how they built their image.
LXD uses UEFI as its firmware for VMs (as all modern computers do), but a lot of VMs still use a traditional BIOS and so a lot of images are sadly only supporting that.

You can still try importing their image and see what happens.
The way you’d do that is by creating a small tarball containing a single file, called metadata.yaml. You can look at https://linuxcontainers.org/lxd/docs/latest/reference/image_format/#metadata for what to put in that file. But it’s basically just the architecture and maybe a full useful properties that you want to set.

Then once you have that tarball, you can load an image in LXD by doing:

lxc image import metadata.tar image.qcow2 --alias hass

That will load your metadata tarball, in this case named metadata.tar alongside the image itself, here named image.qcow2 and will set up an alias of hass for you.

You can then try creating an instance from it with:

lxc launch hass my-hass-vm --vm -c security.secureboot=false -c limits.cpu=2 -c limits.memory=4GiB
lxc console my-hass-vm --type vga

The first will create and start the VM, the second will attach to the VGA console so you can see it boot.

If the image is UEFI compatible, then it may just work. If not, you’ll get an error from the firmware, either saying it couldn’t find anything to boot or it may drop you into an EFI recovery shell.

Thank you.

It works.