From fa351ac77bcce486a9a04834f2ce80366480a0bd Mon Sep 17 00:00:00 2001 From: Phil Roche Date: Fri, 26 Apr 2024 14:42:10 +0100 Subject: [PATCH 1/7] fix(HyperV desktop): Re-enable ability to build HyperV desktop images (LP: #2064280) We have not built Hyperv desktop images since Jammy and with the re-introduction of HyperV for Noble we have encountered build issues caused by refactoring and removals of code assumed to be redundant but the HyperV desktop images were actually using these code paths. In bbedffe6 we split the building of cloud images and non cloud to using an ddisk-image-uefi.binary and disk-image-uefi-non-cloud.binary respectively. In e38264ca there was a change which meant that any attempt to build hyperv images would result in incorrect disk size and incorrect disk label. This has been fixed by ensuring that the ubuntu:desktop-preinstalled $PROJECT:$SUBPROJECT matches and sets the correct disk size and correct disk label. A change in 76d79466 changed the logic of how the image size for amd64 images were being set. This overrode the sizes set for the desktop images incorrectly. This commit ensures that any desktop image being created uses the correct image size. (cherry picked from commit 48aed401949637ac314e59de996ccab19d5eefcd) --- .../base/disk-image-uefi-non-cloud.binary | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary index 8ea2128f..2c8de186 100755 --- a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary @@ -9,21 +9,6 @@ case $ARCH in ;; esac -case ${PROJECT:-}:${SUBPROJECT:-} in - ubuntu:) - echo "We don't create EFI images for Ubuntu Desktop." - exit 0 - ;; - ubuntu) - IMAGE_STR="# DESKTOP_IMG: This file was created/modified by the Desktop Image build process" - FS_LABEL="desktop-rootfs" - IMAGE_SIZE=12884901888 # 12G - ;; - *) - IMAGE_STR="# CLOUD_IMG: This file was created/modified by the Cloud Image build process" - FS_LABEL="cloudimg-rootfs" - ;; -esac if [ "$ARCH" = "amd64" ]; then IMAGE_SIZE=3758096384 # bump to 3.5G (3584*1024**2); Since Kinetic amd64 need more then the default 2.2G @@ -44,6 +29,22 @@ if [ "$ARCH" = "riscv64" ]; then IMAGE_SIZE=4831838208 # bump to 4.5G (4608*1024**2); initrd creation fails with "No space left" with 3.5G fi +case ${PROJECT:-}:${SUBPROJECT:-} in + ubuntu:) + echo "We don't create EFI images for Ubuntu Desktop." + exit 0 + ;; + ubuntu|ubuntu:desktop-preinstalled) + IMAGE_STR="# DESKTOP_IMG: This file was created/modified by the Desktop Image build process" + FS_LABEL="desktop-rootfs" + IMAGE_SIZE=12884901888 # 12G + ;; + *) + IMAGE_STR="# CLOUD_IMG: This file was created/modified by the Cloud Image build process" + FS_LABEL="cloudimg-rootfs" + ;; +esac + . config/binary . config/functions From b12e271417b1b0146d4573a00ce1856d4b25056d Mon Sep 17 00:00:00 2001 From: Phil Roche Date: Fri, 26 Apr 2024 14:44:26 +0100 Subject: [PATCH 2/7] fix(HyperV desktop): Ensure removed hyperv dependencies are present in HyperV builds (LP: #2064280) A change in 8fb21808 also removed many of the dependencies that the hyperv images require. This removal has been restored in this commit by adding them expliciltly in the hyperv hook. (cherry picked from commit c459e5e5af0371c0228bd4e5ddec57b8954d39df) --- .../ubuntu/hooks/040-hyperv-desktop-images.binary | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary b/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary index 1e7bc461..df111588 100644 --- a/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary +++ b/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary @@ -40,7 +40,7 @@ trap cleanup_hyperv EXIT # Perform customisations chroot "${scratch_d}" apt-get update -y -chroot "${scratch_d}" apt-get -y install xrdp linux-azure linux-tools-azure linux-cloud-tools-azure +chroot "${scratch_d}" apt-get -y install xrdp linux-azure linux-tools-azure linux-cloud-tools-azure polkitd-pkla oem-config-gtk ubiquity-frontend-gtk ubiquity-slideshow-ubuntu language-pack-en-base oem-config-slideshow-ubuntu cat > ${scratch_d}/etc/modules-load.d/hyperv.conf << EOF ${IMAGE_STR} @@ -124,20 +124,19 @@ touch "${scratch_d}/var/lib/oem-config/run" chroot "${scratch_d}" apt-get clean +raw_img=binary/boot/disk-hyperv-uefi.ext4 +vhd_img=livecd.ubuntu-desktop-hyperv.vhdx + +create_manifest "${scratch_d}" "$vhd_img.zip.manifest" # End customisations cleanup_hyperv trap - EXIT -raw_img=binary/boot/disk-hyperv-uefi.ext4 -vhd_img=livecd.ubuntu-desktop-hyperv.vhdx - qemu-img convert -O vhdx "$raw_img" "$vhd_img" rm "$raw_img" apt-get install -y zip -create_manifest chroot "$vhd_img.zip.manifest" - zip "$vhd_img.zip" "$vhd_img" rm "$vhd_img" From 40c7eac14d2e99c8edab1b1f207b6b1ceb616b3e Mon Sep 17 00:00:00 2001 From: Philip Roche Date: Tue, 30 Apr 2024 17:57:21 +0100 Subject: [PATCH 3/7] feat(Hyperv Desktop): Disable cloud-init for Hyperv Desktop images (LP: #2064280) For Ubuntu 24.04 and later cloud-init is included in desktop images. This is not applicable for Hyperv images so we can disable cloud-init. This leaves the cloud-init package installed but disabled so users can still use it if they want. This is a documented way to disable cloud-init. See https://cloudinit.readthedocs.io/en/latest/howto/disable_cloud_init.html (cherry picked from commit ff47664d8c646ebae72c40145ee1fd8098185de6) --- live-build/ubuntu/hooks/040-hyperv-desktop-images.binary | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary b/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary index df111588..21794803 100644 --- a/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary +++ b/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary @@ -39,6 +39,12 @@ trap cleanup_hyperv EXIT # Perform customisations +# For Ubuntu 24.04 and later cloud-init is included in desktop images. This is not applicable for Hyperv images so +# we can disable cloud-init. This leaves the cloud-init package installed but disabled so users can still +# use it if they want. +touch "${scratch_d}/etc/cloud/cloud-init.disabled" + + chroot "${scratch_d}" apt-get update -y chroot "${scratch_d}" apt-get -y install xrdp linux-azure linux-tools-azure linux-cloud-tools-azure polkitd-pkla oem-config-gtk ubiquity-frontend-gtk ubiquity-slideshow-ubuntu language-pack-en-base oem-config-slideshow-ubuntu From 34edbb9a1c8cbc57f2399a36c4459a03babb81de Mon Sep 17 00:00:00 2001 From: Philip Roche Date: Thu, 2 May 2024 10:20:16 +0100 Subject: [PATCH 4/7] fix(Hyperv Desktop): ubiquity-frontend-gtk is a dependency of the oem-config-gtk package so does not need to be added explicitly (cherry picked from commit dc2d1318d2d2183f6d80673a1daf5dc8794cd3ed) --- live-build/ubuntu/hooks/040-hyperv-desktop-images.binary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary b/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary index 21794803..74a67f0a 100644 --- a/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary +++ b/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary @@ -46,7 +46,7 @@ touch "${scratch_d}/etc/cloud/cloud-init.disabled" chroot "${scratch_d}" apt-get update -y -chroot "${scratch_d}" apt-get -y install xrdp linux-azure linux-tools-azure linux-cloud-tools-azure polkitd-pkla oem-config-gtk ubiquity-frontend-gtk ubiquity-slideshow-ubuntu language-pack-en-base oem-config-slideshow-ubuntu +chroot "${scratch_d}" apt-get -y install xrdp linux-azure linux-tools-azure linux-cloud-tools-azure polkitd-pkla oem-config-gtk ubiquity-slideshow-ubuntu language-pack-en-base oem-config-slideshow-ubuntu cat > ${scratch_d}/etc/modules-load.d/hyperv.conf << EOF ${IMAGE_STR} From 8cc079fe5086396006329d7832c040a99d1db402 Mon Sep 17 00:00:00 2001 From: Philip Roche Date: Thu, 2 May 2024 10:21:30 +0100 Subject: [PATCH 5/7] fix(Hyperv Desktop): as we are using oem-config we do not need ubiquity-slideshow-ubuntu As we are only using oem-config, oem-config-slideshow-ubuntu will suffice (cherry picked from commit 8fe26586cc1b65621e74121b03c912dcee0e6cf8) --- live-build/ubuntu/hooks/040-hyperv-desktop-images.binary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary b/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary index 74a67f0a..b10536b9 100644 --- a/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary +++ b/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary @@ -46,7 +46,7 @@ touch "${scratch_d}/etc/cloud/cloud-init.disabled" chroot "${scratch_d}" apt-get update -y -chroot "${scratch_d}" apt-get -y install xrdp linux-azure linux-tools-azure linux-cloud-tools-azure polkitd-pkla oem-config-gtk ubiquity-slideshow-ubuntu language-pack-en-base oem-config-slideshow-ubuntu +chroot "${scratch_d}" apt-get -y install xrdp linux-azure linux-tools-azure linux-cloud-tools-azure polkitd-pkla oem-config-gtk language-pack-en-base oem-config-slideshow-ubuntu cat > ${scratch_d}/etc/modules-load.d/hyperv.conf << EOF ${IMAGE_STR} From 5f59eec085a50bf88e4de5c0c0d5f19c730340a0 Mon Sep 17 00:00:00 2001 From: Philip Roche Date: Thu, 2 May 2024 10:23:35 +0100 Subject: [PATCH 6/7] fix(Hyperv Desktop): remove redundant case statement match `ubuntu` `ubuntu` will never match `${PROJECT:-}:${SUBPROJECT:-}` cases statement and can be safely removed. (cherry picked from commit 0945c40fb2bb067d86d496b7b40bdae89123124c) --- .../ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary index 2c8de186..44d2e4cf 100755 --- a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary @@ -34,7 +34,7 @@ case ${PROJECT:-}:${SUBPROJECT:-} in echo "We don't create EFI images for Ubuntu Desktop." exit 0 ;; - ubuntu|ubuntu:desktop-preinstalled) + ubuntu:desktop-preinstalled) IMAGE_STR="# DESKTOP_IMG: This file was created/modified by the Desktop Image build process" FS_LABEL="desktop-rootfs" IMAGE_SIZE=12884901888 # 12G From 49a14274d1ccde5bf667b2f435f4e58a439560c3 Mon Sep 17 00:00:00 2001 From: Philip Roche Date: Fri, 24 May 2024 15:34:40 +0100 Subject: [PATCH 7/7] d/ch update for 24.04.70 to re-enable ability to build HyperV desktop images (LP: #2064280) --- debian/changelog | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 069c9b0e..2b40014d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,13 @@ livecd-rootfs (24.04.70) UNRELEASED; urgency=medium + [ Łukasz 'sil2100' Zemczak ] * Add experimental support for building ubuntu-core-desktop installer images (LP: #2063203) - -- Łukasz 'sil2100' Zemczak Wed, 24 Apr 2024 10:53:27 +0100 + [ Philip Roche ] + * Re-enable ability to build HyperV desktop images (LP: #2064280) + + -- Philip Roche Fri, 24 May 2024 15:32:58 +0100 livecd-rootfs (24.04.69) noble; urgency=medium