Deploying custom Ubuntu 24.04 image lacks certain default MaaS steps for Ubuntu

When deploying a custom Ubuntu 24.04 image, certain important steps that do happen on a vanilla 24.04 deploy, are not executed:

  • Setting the APT proxy according to MaaS settings
  • Repairing the UEFI boot order after Ubuntu 24.04 has put itself first

I managed to write a late_command in the preseed to fix the latter issue, but the lack of setting the APT proxy is a major issue. For some customers, the PXE network is non-routable (for security reasons) and thus APT commands will only work when the MaaS server is used as a proxy. Due to this, vanilla Ubuntu 24.04 installs work, but deploying a custom Ubuntu 24.04 image fails.

Deploying a custom Ubuntu 22.04 image however, works just fine. I can see that the proxy steps gets executed there:

write apt proxy info to /tmp/tmpjv99mlr_/target/etc/apt/apt.conf.d/90curtin-aptproxy

This seems to be a bug to me. I would like MaaS to execute the standard steps for Ubuntu 24.04 like the boot order and APT proxy for my custom 24.04 images as well.

Any idea how that can be achieved?

It seems these steps are run by Curtin. Could it be that MaaS is running an older curtin version that isn’t detecting Ubuntu 24.04 properly in custom images?

What MAAS version are you using?

Vanilla Ubuntu 24.04:

Running curtin builtin curthooks
Configuring target system for distro: ubuntu osfamily: debian
start: cmd-install/stage-curthooks/builtin/cmd-curthooks/writing-apt-config: configuring apt configuring apt
...
<plenty more things>
...
Running command ['mount', '--bind', '/dev', '/tmp/tmp829w639q/target/dev'] with allowed return codes [0] (capture=False)

Custom 24.04:

Running curtin builtin curthooks
Configuring target system for distro: ubuntu osfamily: debian
Running command ['mount', '--bind', '/dev', '/tmp/tmptbio1t93/target/dev'] with allowed return codes [0] (capture=False)

For some reason curtin isn’t running this code for 24.04

@r00ta We’re running MAAS version 3.6.0

Did you use packer maas to build the custom image? Did you specify the curthooks like packer-maas/ubuntu/scripts/curtin-hooks at main · canonical/packer-maas · GitHub ?

We use the CAPI image-builder, which now also supports MAAS natively. It has the curtin-hooks here: image-builder/images/capi/ansible/roles/providers/files/maas/curtin/curtin-hooks at main · kubernetes-sigs/image-builder · GitHub

I think I see your point though, that curtin-hooks file also logs

Running curtin builtin curthooks

So it must be the contents of this file that are being executed for the custom image.

When I look at the older internal image builder that creates our 22.04 images, I don’t see a curtin-hooks at all in there. So I think the solution could be to remove the curtin-hooks file from the image-builder and let MaaS use its default one?

It also looks like the install-custom-packages script knows how to set the APT proxy. This gets run before setup-bootloader (which is where my deployment fails). So that is responsible for setting the proxy here. I can see in the image-builder variant that install-custom-packages is empty.

I will copy over the install-custom-packages content to the image-builder and try again with that.

Both of those approaches work, but I’m going to opt for not including the curtin hooks files at all. That lets MAAS use its standard curtin hooks and those do all the things we need, including fixing the boot order.