From 4c2baf9e5878efb1c34196b6a7b920405012d74e Mon Sep 17 00:00:00 2001 From: Dan Bungert Date: Wed, 4 Jun 2025 17:42:01 -0600 Subject: [PATCH] server: fix hwe kernel layer having multiple kernels LP: #2112501 --- live-build/auto/config | 8 ++------ .../hooks/02-hwe-kernel.chroot_early | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) create mode 100755 live-build/ubuntu-server/hooks/02-hwe-kernel.chroot_early diff --git a/live-build/auto/config b/live-build/auto/config index ef279cb5..38013537 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -1065,16 +1065,12 @@ case $PROJECT in exit 1 fi - add_pass ubuntu-server-minimal.ubuntu-server.installer.$flavor if [ "$first_kernel" = "y" ]; then # Put the first kernel offered into the base layer - kernel_layer=ubuntu-server-minimal first_kernel=n - else - # and subsequent ones into their own layer - kernel_layer=ubuntu-server-minimal.ubuntu-server.installer.$flavor + add_package ubuntu-server-minimal $kernel_metapkg fi - add_package $kernel_layer $kernel_metapkg + add_package ubuntu-server-minimal.ubuntu-server.installer.$flavor $kernel_metapkg LIVE_PASSES="${LIVE_PASSES:+$LIVE_PASSES }ubuntu-server-minimal.ubuntu-server.installer.$flavor" done diff --git a/live-build/ubuntu-server/hooks/02-hwe-kernel.chroot_early b/live-build/ubuntu-server/hooks/02-hwe-kernel.chroot_early new file mode 100755 index 00000000..69394637 --- /dev/null +++ b/live-build/ubuntu-server/hooks/02-hwe-kernel.chroot_early @@ -0,0 +1,18 @@ +#!/bin/bash -eux +# vi: ts=4 noexpandtab + +case $PASS in + ubuntu-server-minimal.ubuntu-server.installer.*.*) + exit 0 + ;; + ubuntu-server-minimal.ubuntu-server.installer.*) + ;; + *) + exit 0 + ;; +esac + +# remove excess kernels. auto/config arranges for the correct one to be +# installed. + +apt-get --yes remove --purge 'linux-image*'