Run Ubuntu Core as LXD VM

Was trying to run Ubuntu Core as a LXD VM. Tried following this tutorial which doesn’t seem to work. I think the issue is that Ubuntu Core has no ISO installer. The installation process includes writing an image file directly into disk and it’s configured from disk assuming it’s the one it’ll be installed in. In particular, one of the steps of this installer includes expanding the image into the whole disk, which I believe is what crashes the VM.

So I need to copy this image over the VM root disk. In general, the installation instructions would lead you to run a desktop iso which in turn would write the image to disk and then boot from disk. Is there any simpler way of doing this by writing the image directly to the root disk?

It’s actually running from the img file. But I guess the question of how to overwrite the original boot file is still an interesting one.

The way I’ve done it in the past is:

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

You’ll then get an image in LXD that you can lxc launch core22 my-vm --vm

1 Like