From 7ac1f7ceb2227518b8027b8955378587a56c5bc8 Mon Sep 17 00:00:00 2001 From: Simon Poirier Date: Fri, 10 Apr 2026 09:07:34 -0400 Subject: [PATCH] fix(flavors): regen initramfs on live layer for casper (LP: #2146567) Seed installation diverts initramfs install hooks. As we move base layers to dracut, casper is still needed for the live layer. This regenerates initrds after live layers install initramfs-tools, to make casper work, in case the base layer was using dracut. --- .../hooks/03-initramfs-enforcement.chroot | 1 + .../hooks/03-initramfs-enforcement.chroot | 1 + .../hooks/03-initramfs-enforcement.chroot | 1 + .../hooks/03-initramfs-enforcement.chroot | 1 + .../hooks/03-initramfs-enforcement.chroot | 1 + .../hooks/03-initramfs-enforcement.chroot | 1 + .../hooks/03-initramfs-enforcement.chroot | 1 + .../hooks/03-initramfs-enforcement.chroot | 1 + .../hooks/03-initramfs-enforcement.chroot | 34 +++++++++++++++++++ 9 files changed, 42 insertions(+) create mode 120000 live-build/edubuntu/hooks/03-initramfs-enforcement.chroot create mode 120000 live-build/kubuntu/hooks/03-initramfs-enforcement.chroot create mode 120000 live-build/lubuntu/hooks/03-initramfs-enforcement.chroot create mode 120000 live-build/ubuntu-budgie/hooks/03-initramfs-enforcement.chroot create mode 120000 live-build/ubuntu-mate/hooks/03-initramfs-enforcement.chroot create mode 120000 live-build/ubuntucinnamon/hooks/03-initramfs-enforcement.chroot create mode 120000 live-build/ubuntukylin/hooks/03-initramfs-enforcement.chroot create mode 120000 live-build/ubuntustudio/hooks/03-initramfs-enforcement.chroot create mode 100755 live-build/xubuntu/hooks/03-initramfs-enforcement.chroot diff --git a/live-build/edubuntu/hooks/03-initramfs-enforcement.chroot b/live-build/edubuntu/hooks/03-initramfs-enforcement.chroot new file mode 120000 index 00000000..1715f71e --- /dev/null +++ b/live-build/edubuntu/hooks/03-initramfs-enforcement.chroot @@ -0,0 +1 @@ +../../xubuntu/hooks/03-initramfs-enforcement.chroot \ No newline at end of file diff --git a/live-build/kubuntu/hooks/03-initramfs-enforcement.chroot b/live-build/kubuntu/hooks/03-initramfs-enforcement.chroot new file mode 120000 index 00000000..1715f71e --- /dev/null +++ b/live-build/kubuntu/hooks/03-initramfs-enforcement.chroot @@ -0,0 +1 @@ +../../xubuntu/hooks/03-initramfs-enforcement.chroot \ No newline at end of file diff --git a/live-build/lubuntu/hooks/03-initramfs-enforcement.chroot b/live-build/lubuntu/hooks/03-initramfs-enforcement.chroot new file mode 120000 index 00000000..1715f71e --- /dev/null +++ b/live-build/lubuntu/hooks/03-initramfs-enforcement.chroot @@ -0,0 +1 @@ +../../xubuntu/hooks/03-initramfs-enforcement.chroot \ No newline at end of file diff --git a/live-build/ubuntu-budgie/hooks/03-initramfs-enforcement.chroot b/live-build/ubuntu-budgie/hooks/03-initramfs-enforcement.chroot new file mode 120000 index 00000000..1715f71e --- /dev/null +++ b/live-build/ubuntu-budgie/hooks/03-initramfs-enforcement.chroot @@ -0,0 +1 @@ +../../xubuntu/hooks/03-initramfs-enforcement.chroot \ No newline at end of file diff --git a/live-build/ubuntu-mate/hooks/03-initramfs-enforcement.chroot b/live-build/ubuntu-mate/hooks/03-initramfs-enforcement.chroot new file mode 120000 index 00000000..1715f71e --- /dev/null +++ b/live-build/ubuntu-mate/hooks/03-initramfs-enforcement.chroot @@ -0,0 +1 @@ +../../xubuntu/hooks/03-initramfs-enforcement.chroot \ No newline at end of file diff --git a/live-build/ubuntucinnamon/hooks/03-initramfs-enforcement.chroot b/live-build/ubuntucinnamon/hooks/03-initramfs-enforcement.chroot new file mode 120000 index 00000000..1715f71e --- /dev/null +++ b/live-build/ubuntucinnamon/hooks/03-initramfs-enforcement.chroot @@ -0,0 +1 @@ +../../xubuntu/hooks/03-initramfs-enforcement.chroot \ No newline at end of file diff --git a/live-build/ubuntukylin/hooks/03-initramfs-enforcement.chroot b/live-build/ubuntukylin/hooks/03-initramfs-enforcement.chroot new file mode 120000 index 00000000..1715f71e --- /dev/null +++ b/live-build/ubuntukylin/hooks/03-initramfs-enforcement.chroot @@ -0,0 +1 @@ +../../xubuntu/hooks/03-initramfs-enforcement.chroot \ No newline at end of file diff --git a/live-build/ubuntustudio/hooks/03-initramfs-enforcement.chroot b/live-build/ubuntustudio/hooks/03-initramfs-enforcement.chroot new file mode 120000 index 00000000..1715f71e --- /dev/null +++ b/live-build/ubuntustudio/hooks/03-initramfs-enforcement.chroot @@ -0,0 +1 @@ +../../xubuntu/hooks/03-initramfs-enforcement.chroot \ No newline at end of file diff --git a/live-build/xubuntu/hooks/03-initramfs-enforcement.chroot b/live-build/xubuntu/hooks/03-initramfs-enforcement.chroot new file mode 100755 index 00000000..d1982763 --- /dev/null +++ b/live-build/xubuntu/hooks/03-initramfs-enforcement.chroot @@ -0,0 +1,34 @@ +#!/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 + minimal.standard.live) + ;; + *) + 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