We use curtin to config, from this document Custom machine setup , you can edit your own curtin config for one distro.
just like we use 5.4.0-131-generic for 18.04; so we add a file name with curtin_userdata_ubuntu_amd64_generic_bionic
in path /etc/maas/preseeds/
and with config like
kernel:
package: "linux-image-5.4.0-131-generic"
fallback-package: "linux-image-generic-hwe-18.04"
late_commands:
...
25-install-modules: ["curtin", "in-target", "--", "bash", "-c", ":; KVER=$(ls -t /boot/vmlinuz-* | head -n 1 | sed 's/.*vmlinuz-//g'); apt-get -y install linux-modules-${KVER} linux-modules-extra-${KVER} linux-headers-${KVER}"]
...
......
You need fallback-package
config because sometimes they may delete some kernel, and you will deployed failed. And remember install extra-modules package.