Unable to boot Ubuntu with custom kernel version

I’m having an issue deploying a machine with a custom image. The image is based on Ubuntu 22 and I’ve gone through the README in packer-maas to build the image with a particular kernel version. (I am specifically following the instructions to create a shell script to install the kernel and also writing the name of the kernel in /curtin/CUSTOM_KERNEL).

If I deploy the machine with OS set to Ubuntu and Release set to my image name, I get an error saying Error: Action failed for 1 machine. Alternatively if I set the OS to Custom, the OS fails to boot. There is an error message on the console saying Loading http://<maas.ip>:5248/images/custom/amd64/ga-22.04/ubuntu-custom/no-such-image/boot-kernel…failed: No such file or directory.

Hi @orangepickle82 ,

Could you please share the commands you used to upload the custom image and to deploy it?

Hi,

$ sudo maas admin boot-resources create name='custom/my-image' title='My Image' architecture='amd64/generic' filetype='tgz' content@=custom-cloudimg.tar.gz

And the command to deploy?

I don’t use the CLI to deploy, I Use the UI.

If custom images are not working for me, can I use cloud-init to do this? The docs on cloud-init with MAAS is not very detailed.

Nope. Could you extract the rackd logs when you try to deploy such image?

When you deploy the machine an ephemeral Ubuntu image should be loaded and then after a while it will fetch the image to deploy, but in your case it seems it already fails to load the ephemeral image for some reasons

The rackd logs didn’t really tell me very much.

I tried to boot the server with a custom kernel version again, and somehow without any changes it is able to. But the kernel version is not correct, it is using the latest version of the kernel and is not the one I want.

I’ve been reading the code for packer-maas, specifically ubuntu-cloudimg.pkr.hcl and install-custom-kernel.sh, and I found that perhaps my arguments to packer were wrong. So instead of

sudo packer build -var customize_script=my-changes.sh -only='cloudimg.*' .

I tried

sudo packer build -var kernel=linux-image-5.15.0-78-generic -only='cloudimg.*' .

But the result is the same: when I login to the server it is running kernel 5.15.0-107-generic.

hard to say. Could you fill a bug on packer-maas with all the steps to reproduce?

Will do.
Thanks for the support.