[neon/neon/livecd-rootfs/Neon/release-lts] /: Fix broken minimal cloud image boot on amd64 (LP: #1920043)

Pat Viafore null at kde.org
Mon Apr 12 11:02:00 BST 2021


Git commit 597d678e175ea001b0f8bc9c1496fe5eec69d6e8 by Pat Viafore, on behalf of David Krauser.
Committed on 22/03/2021 at 15:26.
Pushed by jriddell into branch 'Neon/release-lts'.

Fix broken minimal cloud image boot on amd64 (LP: #1920043)

I recently pulled initramfs logic out of the base build hook, and
dropped that into the `replace_kernel` function. Any cloud image that
does not leverage the generic virtual kernel was expected to call
`replace_kernel` to pull in a custom kernel. That function will
disable initramfs boot for images that use a custom kernel.

Minimal cloud images on amd64 use the linux-kvm kernel, but the build
hook does not utilize the `replace_kernel` function. Instead, the
kernel flavor is set in `auto/config`. I pulled that logic out of
`auto/config` and am now calling `replace_kernel` in the build hook.

I also moved a call to generate the package list so that it will pick
up the change to the linux-kvm kernel.

M  +6    -0    debian/changelog
M  +2    -8    live-build/auto/config
M  +15   -9    live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary
M  +6    -0    live-build/ubuntu-cpc/hooks.d/base/disk-image.binary

https://invent.kde.org/neon/neon/livecd-rootfs/commit/597d678e175ea001b0f8bc9c1496fe5eec69d6e8

diff --git a/debian/changelog b/debian/changelog
index db70bc93..357be6a0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+livecd-rootfs (2.664.19) UNRELEASED; urgency=medium
+
+  *  Fix broken minimal cloud image boot on amd64 LP: #1920043
+
+ -- Patrick Viafore <patrick.viafore at canonical.com>  Thu, 18 Mar 2021 11:50:04 -0500
+
 livecd-rootfs (2.664.18) focal; urgency=medium
 
   [ Patrick Viafore ]
diff --git a/live-build/auto/config b/live-build/auto/config
index ef60309f..888080dd 100755
--- a/live-build/auto/config
+++ b/live-build/auto/config
@@ -786,20 +786,14 @@ case $PROJECT in
 		;;
 
 	ubuntu-cpc)
+		KERNEL_FLAVOURS=virtual
+
 		if [ "${SUBPROJECT:-}" = minimized ]; then
 			add_task install cloud-image
 			add_package install sudo lxd-installer
-			# linux-kvm currently only exists for amd64, so fall back to the
-			# virtual flavour for other architectures
-			if [ "$ARCH" = "amd64" ]; then
-				KERNEL_FLAVOURS=kvm
-			else
-				KERNEL_FLAVOURS=virtual
-			fi
 		else
 			add_task install minimal standard cloud-image
 			add_package install ubuntu-minimal
-			KERNEL_FLAVOURS=virtual
 		        case $ARCH in
 				armhf|arm64|ppc64el|powerpc)
 					add_task install server
diff --git a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary
index 25035316..b16d281e 100755
--- a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary
+++ b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary
@@ -191,15 +191,6 @@ EOF
 
     chroot mountpoint apt-get autoremove --purge --assume-yes
 
-    # This call to rewrite the debian package manifest is added here to capture
-    # grub-efi packages that otherwise would not make it into the base
-    # manifest. filesystem.packages is moved into place via symlinking to
-    # livecd.ubuntu-cpc.manifest by live-build/auto/build after lb_binary runs
-    # and at that time snaps are added to the manifest (create-manifest is
-    # not called here as it calls snap-seed-parse, resulting in duplicate
-    # snap listings)
-    chroot mountpoint dpkg-query -W > binary/boot/filesystem.packages
-
     chroot mountpoint grub-install "${loop_device}" \
         --boot-directory=/boot \
         --efi-directory=/boot/efi \
@@ -213,6 +204,21 @@ EOF
         chroot mountpoint grub-install --target=i386-pc "${loop_device}"
     fi
 
+    # Use the linux-kvm kernel for minimal images where available
+    # linux-kvm currently only exists for amd64
+    if [ "${SUBPROJECT:-}" = "minimized" ] && [ "$ARCH" = "amd64" ]; then
+        replace_kernel mountpoint linux-kvm
+    fi
+
+    # This call to rewrite the debian package manifest is added here to capture
+    # grub-efi packages that otherwise would not make it into the base
+    # manifest. filesystem.packages is moved into place via symlinking to
+    # livecd.ubuntu-cpc.manifest by live-build/auto/build after lb_binary runs
+    # and at that time snaps are added to the manifest (create-manifest is
+    # not called here as it calls snap-seed-parse, resulting in duplicate
+    # snap listings)
+    chroot mountpoint dpkg-query -W > binary/boot/filesystem.packages
+
     divert_grub mountpoint
     track_initramfs_boot_fallback mountpoint
     chroot mountpoint update-grub
diff --git a/live-build/ubuntu-cpc/hooks.d/base/disk-image.binary b/live-build/ubuntu-cpc/hooks.d/base/disk-image.binary
index f00fbbd7..ed383109 100755
--- a/live-build/ubuntu-cpc/hooks.d/base/disk-image.binary
+++ b/live-build/ubuntu-cpc/hooks.d/base/disk-image.binary
@@ -127,6 +127,12 @@ if [ "${should_install_grub}" -eq 1 ]; then
     rm mountpoint/tmp/device.map
 fi
 
+# Use the linux-kvm kernel for minimal images where available
+# linux-kvm currently only exists for amd64
+if [ "${SUBPROJECT:-}" = "minimized" ] && [ "$ARCH" = "amd64" ]; then
+    replace_kernel mountpoint linux-kvm
+fi
+
 if [ "$ARCH" = "s390x" ]; then
     # Do ZIPL install bits
     chroot mountpoint apt-get -qqy install s390-tools sysconfig-hardware



More information about the Neon-commits mailing list