Merge feature/re-enable-noble-hyperv-desktop-builds into ubuntu/master [a=philroche] [r=jchittum,jibel,vorlon]

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 MP ensures that hyperv desktop images can now be built and successfully launched with hyperv manager.

MP: https://code.launchpad.net/~philroche/livecd-rootfs/+git/livecd-rootfs/+merge/465288
ubuntu-core-lxd-qcow2
Phil Roche 8 months ago
commit d63b16bdf0

6
debian/changelog vendored

@ -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 <lukasz.zemczak@ubuntu.com> Wed, 24 Apr 2024 10:53:27 +0100
[ Philip Roche ]
* Re-enable ability to build HyperV desktop images (LP: #2064280)
-- Philip Roche <phil.roche@canonical.com> Tue, 30 Apr 2024 17:58:43 +0100
livecd-rootfs (24.04.69) noble; urgency=medium

@ -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: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

@ -39,8 +39,14 @@ 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
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}
@ -124,20 +130,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"

Loading…
Cancel
Save