From e814e02bf4eaa510bc88ef8d18ac8b145ca992f5 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Thu, 27 Feb 2025 12:29:00 +1300 Subject: [PATCH] Again in ubuntu-server builds, configure LAYERFS_PATH in the kernel layer and ensure the initrd is freshly regenerated in that layer. LAYERFS_PATH was being set to the layer below the kernel layer, which meant that the live session did not get access to all the modules in the case that the kernel had not been installed in the base layer, which in turn means that installs fail. (LP: #2100148) * Again in ubuntu-server builds, configure LAYERFS_PATH in the kernel layer and ensure the initrd is freshly regenerated in that layer. LAYERFS_PATH was being set to the layer below the kernel layer, which meant that the live session did not get access to all the modules in the case that the kernel had not been installed in the base layer, which in turn means that installs fail. (LP: #2100148) * While we're at it, delete any initrd from any other layer than a kernel layer, as they just waste space on the ISO. --- debian/changelog | 8 ++++ .../hooks/02-installer-bits.chroot_early | 21 ----------- .../hooks/03-initramfs-enforcement.chroot | 37 +++++++++++++++++++ 3 files changed, 45 insertions(+), 21 deletions(-) delete mode 100755 live-build/ubuntu-server/hooks/02-installer-bits.chroot_early create mode 100755 live-build/ubuntu-server/hooks/03-initramfs-enforcement.chroot diff --git a/debian/changelog b/debian/changelog index 7ab5f93c..3b6a43fe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,14 @@ livecd-rootfs (25.04.20) UNRELEASED; urgency=medium * In ubuntu-server builds, install the first kernel in the base layer, not the "ga" kernel (which may not be installed at all, as is the case in e.g. the arm64+largemem builds). + * Again in ubuntu-server builds, configure LAYERFS_PATH in the kernel layer + and ensure the initrd is freshly regenerated in that layer. LAYERFS_PATH + was being set to the layer below the kernel layer, which meant that the + live session did not get access to all the modules in the case that the + kernel had not been installed in the base layer, which in turn means that + installs fail. (LP: #2100148) + * While we're at it, delete any initrd from any other layer than a kernel + layer, as they just waste space on the ISO. -- Michael Hudson-Doyle Thu, 27 Feb 2025 11:41:22 +1300 diff --git a/live-build/ubuntu-server/hooks/02-installer-bits.chroot_early b/live-build/ubuntu-server/hooks/02-installer-bits.chroot_early deleted file mode 100755 index c659c8e3..00000000 --- a/live-build/ubuntu-server/hooks/02-installer-bits.chroot_early +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -ex -# vi: ts=4 noexpandtab - -case $PASS in - ubuntu-server-minimal.ubuntu-server.installer.*) - exit 0 - ;; - ubuntu-server-minimal.ubuntu-server.installer) - ;; - *) - exit 0 - ;; -esac - -cat < /etc/initramfs-tools/conf.d/casperize.conf -export CASPER_GENERATE_UUID=1 -EOF - -cat < /etc/initramfs-tools/conf.d/default-layer.conf -LAYERFS_PATH=${PASS}.squashfs -EOF diff --git a/live-build/ubuntu-server/hooks/03-initramfs-enforcement.chroot b/live-build/ubuntu-server/hooks/03-initramfs-enforcement.chroot new file mode 100755 index 00000000..076aac29 --- /dev/null +++ b/live-build/ubuntu-server/hooks/03-initramfs-enforcement.chroot @@ -0,0 +1,37 @@ +#!/bin/bash -ex +# vi: ts=4 noexpandtab + +# In a kernel layer, we need a freshly updated initrd (to ensure it +# has been casperized with an appropriate config). A binary hook will +# pull this out to be a separate build artifact to eventually end up +# in /casper on the generated ISO. + +# In all lower layers, having an initrd just wastes space, as curtin +# will always call update-initramfs after the layer has been copied to +# the target system. + +# The netboot "layers" are not made into squashfses so there's no need +# to do anything in those. + +case $PASS in + ubuntu-server-minimal.ubuntu-server.installer.*.*) + exit 0 + ;; + ubuntu-server-minimal.ubuntu-server.installer.*) + ;; + *) + rm -f /boot/initrd.img* + exit 0 + ;; +esac + + +cat < /etc/initramfs-tools/conf.d/casperize.conf +export CASPER_GENERATE_UUID=1 +EOF +cat < /etc/initramfs-tools/conf.d/default-layer.conf +LAYERFS_PATH=${PASS}.squashfs +EOF +# As this hook has deleted the initrds from lower layers we need to +# pass -c -k all to update-initramfs here (-u will do nothing) +update-initramfs -c -k all