Ubuntu Core 16 - auto run lxd init on first boot


I’m trying to create a custom Ubuntu Core 16 image for an embedded x86_64 board. I succeeded creating the proper model assertion and get lxd snap pre-installed into the custom build image. Now on first boot, I need to login and run “lxd init” once to get everything up and running.

Is there a way to specify some “first boot init” script during image building which will take care of the needed initialization?

The only method I found so far is “documented” here (https://github.com/subutai-attic/subos/wiki/Creating-Ubuntu-Core-16-image) but involves loop mounting the image and manipulating the content.

I was looking for some method to add this kind of init script during image build …

Any ideas/pointers?


Hi Andreas,
Take a look at https://github.com/lxc/lxd/blob/master/doc/preseed.md for automated lxd init, might be helpful for your case.

Hi David,

thanks for your quick reply - for lxd this is what I was looking for!
Just need to figure out more details of the UbuntuCore image building to get this into the firstboot execution path …