fix: Enable snap preseeding with ppc64el images where /boot/vmlinux is used instead of /boot/vmlinuz. (LP: #2038957)

ppc64el still uses /boot/vmlinux so we need to determine the boot file name as non ppc64el use /boot/vmlinuz. This
is then used to determine the kernel major minor version installed so that the correct apparmor features can be used
during snap preseeding. This preseeding was failing for ppc64el for the mantic 6.5 kernel as the /boot/vmlinuz
being checked did not exist.

(cherry picked from commit 089646a32f927f32e9e8961e231391f0bcb6f66b)

# Conflicts:
#	debian/changelog
#	live-build/functions
use-lxd-installer-jammy
Philip Roche 1 year ago
parent 0687a14b91
commit 11d1063be4

7
debian/changelog vendored

@ -1,3 +1,10 @@
livecd-rootfs (2.765.30) jammy; urgency=medium
* Enable snap preseeding with ppc64el images where /boot/vmlinux is used
instead of /boot/vmlinuz. (LP: #2038957)
-- Philip Roche <phil.roche@canonical.com> Fri, 27 Oct 2023 12:51:00 +0100
livecd-rootfs (2.765.29) jammy; urgency=medium livecd-rootfs (2.765.29) jammy; urgency=medium
[ Steve Langasek ] [ Steve Langasek ]

@ -759,9 +759,19 @@ snap_preseed() {
snap_validate_seed() { snap_validate_seed() {
local CHROOT_ROOT=$1 local CHROOT_ROOT=$1
local kern_major_min=undefined
local boot_filename=undefined
# ppc64el still uses /boot/vmlinux so we need to determine the boot file name as non ppc64el use /boot/vmlinuz
# We don't need to query the arch as we can use existence of the file to determine the boot file name. Both
# will never be present at the same time.
if [ -e ${CHROOT_ROOT}/boot/vmlinuz ]; then if [ -e ${CHROOT_ROOT}/boot/vmlinuz ]; then
local kern_major_min=$(readlink --canonicalize --no-newline ${CHROOT_ROOT}/boot/vmlinuz | grep --extended-regexp --only-matching --max-count 1 '[0-9]+\.[0-9]+') boot_filename=vmlinuz
elif [ -e ${CHROOT_ROOT}/boot/vmlinux ]; then
boot_filename=vmlinux
fi
if [ ${boot_filename} != undefined ]; then # we have a known boot file so we can proceed with checking for features to mount
kern_major_min=$(readlink --canonicalize --no-newline ${CHROOT_ROOT}/boot/${boot_filename} | grep --extended-regexp --only-matching --max-count 1 '[0-9]+\.[0-9]+')
if [ -d /usr/share/livecd-rootfs/live-build/apparmor/${kern_major_min} ]; then if [ -d /usr/share/livecd-rootfs/live-build/apparmor/${kern_major_min} ]; then
# if an Ubuntu version has different kernel apparmor features between LTS and HWE kernels # if an Ubuntu version has different kernel apparmor features between LTS and HWE kernels
# a snap pre-seeding issue can occur, where the incorrect apparmor features are reported # a snap pre-seeding issue can occur, where the incorrect apparmor features are reported

Loading…
Cancel
Save