From a3307ebdb70ac21fb4ae82757601422fba1e59c7 Mon Sep 17 00:00:00 2001 From: Gauthier Jolly Date: Thu, 6 Jul 2023 11:04:20 +0200 Subject: [PATCH 1/4] Revert "ubuntu-cpc: disable kernel and initramfs symlinks in /boot" This reverts commit b20e894a9878837ed84f9db71997f68476d632b5. --- .../hooks.d/chroot/999-cpc-fixes.chroot | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/live-build/ubuntu-cpc/hooks.d/chroot/999-cpc-fixes.chroot b/live-build/ubuntu-cpc/hooks.d/chroot/999-cpc-fixes.chroot index 50b6a496..9a25c0a0 100755 --- a/live-build/ubuntu-cpc/hooks.d/chroot/999-cpc-fixes.chroot +++ b/live-build/ubuntu-cpc/hooks.d/chroot/999-cpc-fixes.chroot @@ -124,21 +124,6 @@ fi #### END COMMON ARCH FUNCTIONS -# For everything except s390x, disable kernel and initramfs symlinks -case $arch in - # On s390x the sipl.conf is static right now with just two boot options. - s390x) - exit 0 - ;; -esac - -find "${rootd}/boot" -type l -exec rm {} \; -kernel_img_conf="${rootd}/etc/kernel-img.conf" -if grep -q '^do_symlinks = ' "$kernel_img_conf" 2> /dev/null; then - sed -i 's/^do_symlinks = .*$/do_symlinks = no/g' "$kernel_img_conf" -else - echo "do_symlinks = no" >> "$kernel_img_conf" -fi case $arch in # ARM, ppc, riscv64 and s390x images are special From 2929ff092e70578c9c4e36c6438b504ca88a7334 Mon Sep 17 00:00:00 2001 From: Gauthier Jolly Date: Thu, 6 Jul 2023 11:12:01 +0200 Subject: [PATCH 2/4] Revert "ubuntu-cpc: Make the ESP 2GiB and mount it to /boot" Revert this change for now as /boot then becomes a FAT partition which breaks DPKG requirements[1]. This change is going to be re-evaluated and maybe introduced in a different way. This is not a clean revert because of 3282efb ("ubuntu-cpc: cleanup disk-images-uefi.binary") which we want to keep. [1] https://wiki.debian.org/Teams/Dpkg/FAQ#Q:_What_are_the_filesystem_requirements_by_dpkg.3F This reverts commit 6a66666e0a5ab1ad96cb0e388f278aafbd012ffe. --- live-build/functions | 20 +++----- .../hooks.d/base/disk-image-uefi.binary | 50 +++++++------------ 2 files changed, 25 insertions(+), 45 deletions(-) diff --git a/live-build/functions b/live-build/functions index 7b912d10..8088cb28 100644 --- a/live-build/functions +++ b/live-build/functions @@ -208,9 +208,8 @@ mount_disk_image() { mount_partition "${rootfs_dev_mapper}" $mountpoint local uefi_dev="${loop_device}p15" - if [ -b ${uefi_dev} -a -e $mountpoint/boot ]; then - mount "${uefi_dev}" $mountpoint/boot - mount --bind $mountpoint/boot $mountpoint/boot/efi + if [ -b ${uefi_dev} -a -e $mountpoint/boot/efi ]; then + mount "${uefi_dev}" $mountpoint/boot/efi fi # This is needed to allow for certain operations @@ -251,16 +250,11 @@ umount_disk_image() { local uefi_dev="${loop_device}p15" if [ -e "$mountpoint/boot/efi" -a -b "$uefi_dev" ]; then - # zero fill free space in UEFI partition - cat < /dev/zero > "$mountpoint/boot/efi/bloat_file" 2> /dev/null || true - rm "$mountpoint/boot/efi/bloat_file" - - # unmount bind mount - umount "$mountpoint/boot/efi" - - # unmount ESP - mount --make-private "$mountpoint/boot" - umount --detach-loop "$mountpoint/boot" + # zero fill free space in UEFI partition + cat < /dev/zero > "$mountpoint/boot/efi/bloat_file" 2> /dev/null || true + rm "$mountpoint/boot/efi/bloat_file" + mount --make-private "$mountpoint/boot/efi" + umount --detach-loop "$mountpoint/boot/efi" fi if [ -e $mountpoint/usr/sbin/policy-rc.d ]; then 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 0b7399f2..a1eb2d09 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 @@ -12,8 +12,13 @@ esac IMAGE_STR="# CLOUD_IMG: This file was created/modified by the Cloud Image build process" FS_LABEL="cloudimg-rootfs" -# 4G (4*1024**3) -IMAGE_SIZE=4294967296 +if [ "$ARCH" = "amd64" ]; then + IMAGE_SIZE=3758096384 # bump to 3.5G (3584*1024**2); Since Kinetic amd64 need more then the default 2.2G +fi + +if [ "$ARCH" = "armhf" ]; then + IMAGE_SIZE=3758096384 # bump to 3.5G (3584*1024**2); Since Jammy armhf need more then the default 2.2G +fi if [ "$ARCH" = "riscv64" ]; then IMAGE_SIZE=4831838208 # bump to 4.5G (4608*1024**2); initrd creation fails with "No space left" with 3.5G @@ -29,14 +34,14 @@ create_partitions() { case $ARCH in arm64|armhf) sgdisk "${disk_image}" \ - --new=15:0:+2G \ + --new=15:0:204800 \ --typecode=15:ef00 \ --new=1: ;; riscv64) sgdisk "${disk_image}" \ --set-alignment=2 \ - --new=15::+2G \ + --new=15::+106M \ --typecode=15:ef00 \ --new=1:: \ --attributes=1:set:2 @@ -44,7 +49,7 @@ create_partitions() { amd64) sgdisk "${disk_image}" \ --new=14::+4M \ - --new=15::+2G \ + --new=15::+106M \ --new=1:: sgdisk "${disk_image}" \ -t 14:ef02 \ @@ -60,19 +65,11 @@ create_and_mount_uefi_partition() { mountpoint="$1" mkfs.vfat -F 32 -n UEFI "${uefi_dev}" - mkdir -p "${mountpoint}"/boot/ - mount "${uefi_dev}" "$mountpoint"/boot/ + mkdir -p "${mountpoint}"/boot/efi + mount "${uefi_dev}" "$mountpoint"/boot/efi - mkdir "$mountpoint/boot/efi" - mount --bind "$mountpoint/boot" "$mountpoint/boot/efi" -} - -configure_chroot() { - mountpoint="$1" - - cat << EOF >> "$mountpoint"/etc/fstab -LABEL=UEFI /boot vfat umask=0077 0 1 -/boot /boot/efi vfat umask=0077,bind 0 0 + cat << EOF >> "mountpoint/etc/fstab" +LABEL=UEFI /boot/efi vfat umask=0077 0 1 EOF } @@ -80,8 +77,7 @@ install_grub() { mkdir mountpoint mount_partition "${rootfs_dev_mapper}" mountpoint - mount "${uefi_dev}" mountpoint/boot/ - mount --bind mountpoint/boot mountpoint/boot/efi + create_and_mount_uefi_partition mountpoint echo "(hd0) ${loop_device}" > mountpoint/tmp/device.map mkdir -p mountpoint/etc/default/grub.d @@ -162,26 +158,16 @@ install_grub() { disk_image=binary/boot/disk-uefi.ext4 -# create the disk create_empty_disk_image "${disk_image}" create_partitions "${disk_image}" mount_image "${disk_image}" 1 -# create and mount the rootfs partition +# Copy the chroot in to the disk make_ext4_partition "${rootfs_dev_mapper}" mkdir mountpoint mount "${rootfs_dev_mapper}" mountpoint - -# create and mount the ESP -create_and_mount_uefi_partition mountpoint - -# Copy the chroot into the disk -cp -a chroot/* mountpoint - -configure_chroot mountpoint - -# cleanup the mount -umount -R mountpoint +cp -a chroot/* mountpoint/ +umount mountpoint rmdir mountpoint install_grub From f3afd862d593a5717960f332e2229023900545a0 Mon Sep 17 00:00:00 2001 From: gauthier Date: Mon, 10 Jul 2023 12:05:38 +0200 Subject: [PATCH 3/4] update d/c --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 1ac9cced..4834d9f1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +livecd-rootfs (2.898) mantic; urgency=medium + + * ubuntu-cpc: Revert mount ESP on /boot and bind mount /boot on /boot/efi + + -- Gauthier Jolly Mon, 10 Jul 2023 12:01:18 +0200 + livecd-rootfs (2.897) mantic; urgency=medium [ Heinrich Schuchardt ] From 9fbf523b47092c44d7bf3cdb929ac25dbba54f2b Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Mon, 10 Jul 2023 22:26:33 +1200 Subject: [PATCH 4/4] update version number --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 4834d9f1..f212acc8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -livecd-rootfs (2.898) mantic; urgency=medium +livecd-rootfs (2.899) mantic; urgency=medium * ubuntu-cpc: Revert mount ESP on /boot and bind mount /boot on /boot/efi