From beada3166242862385a9ac5707c79d994c63f425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Thu, 15 Dec 2022 10:22:06 +0100 Subject: [PATCH 01/23] Use ubuntu-image image definitions for riscv, raspi and ubuntu-base builds. --- live-build/auto/build | 28 ++++++++++---------- live-build/auto/config | 58 ++++++++++-------------------------------- 2 files changed, 28 insertions(+), 58 deletions(-) diff --git a/live-build/auto/build b/live-build/auto/build index 4a0dd317..1466615b 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -89,6 +89,10 @@ PREFIX="livecd.$PROJECT${SUBARCH:+-$SUBARCH}" if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then # Use ubuntu-image instead of live-build + # TODO: eventually, this should be handled by a single ubuntu-image + # call without having to do a conditional on ubuntu-core/classic. + # We could already do that, but then we'd still have to do the + # compressing for the core images. if [ "$PROJECT" = "ubuntu-core" ]; then env SNAPPY_STORE_NO_CDN=1 \ ubuntu-image snap $UBUNTU_IMAGE_ARGS \ @@ -100,20 +104,18 @@ if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then xz -0 -T4 "$PREFIX".img mv output/seed.manifest "$PREFIX".manifest else - # First we need to build the gadget tree - make -C "config/$PREFIX-gadget" \ - ARCH=$ARCH SERIES=$SUITE $GADGET_TARGET + env SNAPPY_STORE_NO_CDN=1 \ ubuntu-image classic $UBUNTU_IMAGE_ARGS \ - -s $SUITE -p $PROJECT -a $ARCH --subarch $SUBARCH \ - -O output config/$PREFIX-gadget/install - # XXX: currently we only have one image generated, but really - # we should be supporting more than one for models that - # define those. - mv output/*.img "$PREFIX".img - xz -0 -T4 "$PREFIX".img - # Also link the output image to a filename that cdimage expects - ln "$PREFIX".img.xz livecd.ubuntu-cpc.disk1.img.xz - mv output/filesystem.manifest "$PREFIX".manifest + -O output "$PREFIX".yaml + # Since the output of the ubuntu-image call can vary based on what + # kind of an image we build, the safest bet is to 'export' all the + # artifacts from the output directory. The image definition file + # should be what defines what is expected, so that we don't have + # to tweak livecd-rootfs everytime a different type of artifact + # is needed. + for artifact in output/*; do + mv $artifact $PREFIX.$(basename $artifact) + done fi exit 0 diff --git a/live-build/auto/config b/live-build/auto/config index 1722e98b..7401b946 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -333,8 +333,10 @@ _get_live_passes () if [ -z "${IMAGEFORMAT:-}" ]; then case $PROJECT:${SUBPROJECT:-} in ubuntu-cpc:*|ubuntu:desktop-preinstalled|ubuntu-wsl:*) - case $SUBARCH in - raspi|intel-iot) + case $ARCH+${SUBARCH:-} in + *+raspi|riscv64+?*) + # All raspi and RISC-V images that *have* a SUBARCH will now + # use ubuntu-image. IMAGEFORMAT=ubuntu-image ;; *) @@ -342,25 +344,15 @@ if [ -z "${IMAGEFORMAT:-}" ]; then ;; esac ;; + ubuntu-base:*) + IMAGEFORMAT=ubuntu-image + ;; ubuntu-server:live) IMAGEFORMAT=plain ;; esac fi -# Configure preinstalled ubuntu-cpc images with included password -# one also must request disk1-img-xz image format -if [ "$IMAGEFORMAT" = "ext4" ] && [ "$PROJECT" = "ubuntu-cpc" ]; then - case $ARCH:$SUBARCH in - armhf:raspi2|riscv64:sifive_*|riscv64:nezha|riscv64:visionfive|riscv64:licheerv|riscv64:icicle|*:generic) - IMAGE_HAS_HARDCODED_PASSWORD=1 - if [ -z "${IMAGE_TARGETS:-}" ]; then - export IMAGE_TARGETS="disk1-img-xz" - fi - ;; - esac -fi - skip_lb_stage() { STAGE="$1" mkdir -p .build @@ -496,37 +488,13 @@ case $IMAGEFORMAT in else # classic images - # Certain models have different names but are built from the same source gadget tree - case $MODEL in - pi-arm64|pi3-arm64) - MODEL=pi - ;; - intel-iot) - MODEL=pc - ;; - esac + DEFINITION="$PROJECT-$MODEL.yaml" - GADGET_TARGET="server" - if [ "$SUBPROJECT" = "desktop-preinstalled" ]; then - GADGET_TARGET="desktop" - fi - - UBUNTU_IMAGE_ARGS="$UBUNTU_IMAGE_ARGS${SUBPROJECT:+ --subproject \"$SUBPROJECT\"}" - UBUNTU_IMAGE_ARGS="$UBUNTU_IMAGE_ARGS${PROPOSED:+ --with-proposed}" - UBUNTU_IMAGE_ARGS="$UBUNTU_IMAGE_ARGS${EXTRA_PPAS:+ --extra-ppas \"$EXTRA_PPAS\"}" - - # We need to look in two places for the gadget tree: - # - Launchpad hosted gadgets will be in the snap-gadget repo - # - Github hosted gadgets are mirrored into a github-mirror repo - BRANCH="classic" - git clone git://git.launchpad.net/~canonical-foundations/snap-$MODEL/+git/snap-$MODEL -b $BRANCH config/$PREFIX-gadget || git clone git://git.launchpad.net/~canonical-foundations/snap-$MODEL/+git/github-mirror -b $BRANCH config/$PREFIX-gadget || git clone git://git.launchpad.net/~canonical-foundations/snap-$MODEL/+git/github-mirror-$ARCH -b $BRANCH config/$PREFIX-gadget - - echo "IMAGEFORMAT=$IMAGEFORMAT" >> config/common - echo "SUITE=$SUITE" >> config/common - echo "GADGET_TARGET=$GADGET_TARGET" >> config/common - echo "UBUNTU_IMAGE_ARGS=\"$UBUNTU_IMAGE_ARGS\"" >> config/common - - echo "Configured ubuntu-image for the following gadget model: $MODEL" + git clone git://git.launchpad.net/ubuntu-images -b $SERIES image-definitions + cp image-definitions/$DEFINITION "$PREFIX".yaml + echo "Configured ubuntu-image for the following image-definition:" + cat "$PREFIX".yaml + echo "----------------------------------------------------------" fi # Save the model name used for building, mostly for any model-specific hook execution From 4bcc0f2d525530bf5b8a713d65b032a020663536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Thu, 15 Dec 2022 10:25:01 +0100 Subject: [PATCH 02/23] Get rid of some unneeded dependencies. --- debian/control | 2 -- 1 file changed, 2 deletions(-) diff --git a/debian/control b/debian/control index 4aa37bb9..4f53e0e6 100644 --- a/debian/control +++ b/debian/control @@ -26,7 +26,6 @@ Depends: ${misc:Depends}, live-build (>= 3.0~a57-1ubuntu31~), lsb-release, lzma, - make, parted, procps, python3, @@ -38,7 +37,6 @@ Depends: ${misc:Depends}, snapd (>= 2.39) [!i386], squashfs-tools (>= 1:3.3-1), sudo, - u-boot-tools [armhf arm64], ubuntu-image [!i386 !riscv64], python3-vmdkstream [amd64 i386], xz-utils, From c56e7aab046919fc1fa04fe18e048dadbc77c8be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Fri, 16 Dec 2022 11:13:42 +0100 Subject: [PATCH 03/23] Minor code-duplication removal. --- live-build/auto/build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/live-build/auto/build b/live-build/auto/build index 1466615b..0b4304fa 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -89,12 +89,13 @@ PREFIX="livecd.$PROJECT${SUBARCH:+-$SUBARCH}" if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then # Use ubuntu-image instead of live-build + export SNAPPY_STORE_NO_CDN=1 + # TODO: eventually, this should be handled by a single ubuntu-image # call without having to do a conditional on ubuntu-core/classic. # We could already do that, but then we'd still have to do the # compressing for the core images. if [ "$PROJECT" = "ubuntu-core" ]; then - env SNAPPY_STORE_NO_CDN=1 \ ubuntu-image snap $UBUNTU_IMAGE_ARGS \ -O output "$PREFIX".model-assertion # XXX: currently we only have one image generated, but really @@ -104,7 +105,6 @@ if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then xz -0 -T4 "$PREFIX".img mv output/seed.manifest "$PREFIX".manifest else - env SNAPPY_STORE_NO_CDN=1 \ ubuntu-image classic $UBUNTU_IMAGE_ARGS \ -O output "$PREFIX".yaml # Since the output of the ubuntu-image call can vary based on what From 2508d5add30e635f4575a3ff896e9e9de42e9c38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Wed, 5 Apr 2023 22:14:30 +0200 Subject: [PATCH 04/23] Use ubuntu-image from a snap (candidate for now). Only build raspi images with ubuntu-image 3.0 for now. --- debian/control | 1 - live-build/auto/build | 1 + live-build/auto/config | 5 ++--- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/debian/control b/debian/control index 4f53e0e6..18cdafbc 100644 --- a/debian/control +++ b/debian/control @@ -37,7 +37,6 @@ Depends: ${misc:Depends}, snapd (>= 2.39) [!i386], squashfs-tools (>= 1:3.3-1), sudo, - ubuntu-image [!i386 !riscv64], python3-vmdkstream [amd64 i386], xz-utils, zerofree diff --git a/live-build/auto/build b/live-build/auto/build index 0b4304fa..bcf0bf21 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -90,6 +90,7 @@ if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then # Use ubuntu-image instead of live-build export SNAPPY_STORE_NO_CDN=1 + snap install --classic --channel=candidate/latest ubuntu-image # TODO: eventually, this should be handled by a single ubuntu-image # call without having to do a conditional on ubuntu-core/classic. diff --git a/live-build/auto/config b/live-build/auto/config index 7401b946..e22474e1 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -334,9 +334,8 @@ if [ -z "${IMAGEFORMAT:-}" ]; then case $PROJECT:${SUBPROJECT:-} in ubuntu-cpc:*|ubuntu:desktop-preinstalled|ubuntu-wsl:*) case $ARCH+${SUBARCH:-} in - *+raspi|riscv64+?*) - # All raspi and RISC-V images that *have* a SUBARCH will now - # use ubuntu-image. + *+raspi) + # All raspi images use ubuntu-image. IMAGEFORMAT=ubuntu-image ;; *) From 7673c4f98fb212467fe07dae18cf2a47e149715f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Wed, 5 Apr 2023 22:20:46 +0200 Subject: [PATCH 05/23] For now, don't build the base images with ubuntu-image. --- live-build/auto/config | 3 --- 1 file changed, 3 deletions(-) diff --git a/live-build/auto/config b/live-build/auto/config index 1b3dd4ad..272d940d 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -343,9 +343,6 @@ if [ -z "${IMAGEFORMAT:-}" ]; then ;; esac ;; - ubuntu-base:*) - IMAGEFORMAT=ubuntu-image - ;; ubuntu-server:live|ubuntu-mini-iso:) IMAGEFORMAT=plain ;; From 59f12263eda9443f22f1021f2bd94acb45027a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Thu, 6 Apr 2023 10:05:40 +0200 Subject: [PATCH 06/23] Some missing changes for image definition handling. --- live-build/auto/config | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/live-build/auto/config b/live-build/auto/config index 272d940d..f5920fbc 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -508,9 +508,11 @@ case $IMAGEFORMAT in else # classic images - DEFINITION="$PROJECT-$MODEL.yaml" + IMAGE_PROJECT=$PROJECT + [ "$IMAGE_PROJECT" = "ubuntu-cpc" ] && IMAGE_PROJECT="ubuntu-server" + DEFINITION="$IMAGE_PROJECT-$MODEL.yaml" - git clone git://git.launchpad.net/ubuntu-images -b $SERIES image-definitions + git clone git://git.launchpad.net/ubuntu-images -b $SUITE image-definitions cp image-definitions/$DEFINITION "$PREFIX".yaml echo "Configured ubuntu-image for the following image-definition:" cat "$PREFIX".yaml From 1fe8f8f1781117a6dda507fec35d8b8cd6dfa5d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Thu, 6 Apr 2023 12:40:51 +0200 Subject: [PATCH 07/23] Another missed change - pass IMAGEFORMAT further down. --- live-build/auto/config | 1 + 1 file changed, 1 insertion(+) diff --git a/live-build/auto/config b/live-build/auto/config index f5920fbc..62305f90 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -521,6 +521,7 @@ case $IMAGEFORMAT in # Save the model name used for building, mostly for any model-specific hook execution echo "MODEL=$MODEL" >> config/common + echo "IMAGEFORMAT=$IMAGEFORMAT" >> config/common # Fake finished configuration for lb build mkdir -p .build touch .build/config From 6a2cb2be27ec90e2de2ef67965fdb1aede6554cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Thu, 6 Apr 2023 16:05:32 +0200 Subject: [PATCH 08/23] Fix using the wrong branch name for ubuntu-image. --- live-build/auto/build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/live-build/auto/build b/live-build/auto/build index c8e8da6e..ee0f60e2 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -90,7 +90,7 @@ if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then # Use ubuntu-image instead of live-build export SNAPPY_STORE_NO_CDN=1 - snap install --classic --channel=candidate/latest ubuntu-image + snap install --classic --channel=candidate ubuntu-image # TODO: eventually, this should be handled by a single ubuntu-image # call without having to do a conditional on ubuntu-core/classic. From 0ca404dd1413c1452a0d0f9ea6b60b22ba1b3a02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Thu, 6 Apr 2023 17:22:26 +0200 Subject: [PATCH 09/23] Missing dependency for gadget priming. --- debian/control | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control b/debian/control index 48d6d8e7..c4987af0 100644 --- a/debian/control +++ b/debian/control @@ -36,6 +36,7 @@ Depends: ${misc:Depends}, snapd (>= 2.39) [!i386], squashfs-tools (>= 1:3.3-1), sudo, + u-boot-tools [arm64 armhf], python3-vmdkstream [amd64 i386], xorriso [!i386], xz-utils, From a631afcb7f6ac3c2c1041cf63d6fc89a42b0d811 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Mon, 17 Apr 2023 16:52:23 -0700 Subject: [PATCH 10/23] Unconditionally enable i386 in the chroot for Ubuntu Desktop; the new installer doesn't handle enabling this at install time, and late enablement also misses us some recommends. --- debian/changelog | 8 ++++++++ live-build/ubuntu/hooks/020-canary-live.chroot_early | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/debian/changelog b/debian/changelog index f7588a5e..ac02c8c4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +livecd-rootfs (2.832) UNRELEASED; urgency=medium + + * Unconditionally enable i386 in the chroot for Ubuntu Desktop; the new + installer doesn't handle enabling this at install time, and late + enablement also misses us some recommends. + + -- Steve Langasek Mon, 17 Apr 2023 16:51:13 -0700 + livecd-rootfs (2.831) lunar; urgency=medium * Use the correct path for the loop device. diff --git a/live-build/ubuntu/hooks/020-canary-live.chroot_early b/live-build/ubuntu/hooks/020-canary-live.chroot_early index 5bd741dd..4fb89b37 100755 --- a/live-build/ubuntu/hooks/020-canary-live.chroot_early +++ b/live-build/ubuntu/hooks/020-canary-live.chroot_early @@ -19,3 +19,10 @@ EOF cat < /etc/initramfs-tools/conf.d/default-layer.conf LAYERFS_PATH=${PASS}.squashfs EOF + +if [ "$(dpkg --print-architecture)" = amd64 ]; then + echo "I: Enabling amd64 multiarch support on amd64" + dpkg --add-architecture i386 + + apt-get -y update +fi From 6fac77b481c65638879e26479958ffe7535c1ae7 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Fri, 26 May 2023 09:41:32 -0700 Subject: [PATCH 11/23] Revert "Revert "Revert "Revert the recent kpartx->losetup changes, as we need to put some other changes on top. Let's try to re-introduce this for MM.""" This reverts commit 1931bbcb194febe241aa82f03a6730ba82a84409. --- debian/changelog | 2 ++ debian/control | 1 + .../buildd/hooks/02-disk-image-uefi.binary | 2 +- live-build/functions | 18 ++++-------- .../hooks.d/base/disk-image-ppc64el.binary | 2 +- .../hooks.d/base/disk-image-uefi.binary | 28 +++++++++---------- 6 files changed, 25 insertions(+), 28 deletions(-) diff --git a/debian/changelog b/debian/changelog index 7c530508..a9994476 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,8 @@ livecd-rootfs (2.843) UNRELEASED; urgency=medium * Unconditionally enable i386 in the chroot for Ubuntu Desktop; the new installer doesn't handle enabling this at install time, and late enablement also misses us some recommends. + * Restore losetup code, the necessary launchpad-buildd changes were being + deployed just as this revert landed. -- Steve Langasek Mon, 17 Apr 2023 16:51:13 -0700 diff --git a/debian/control b/debian/control index c8c78a76..b1ad7323 100644 --- a/debian/control +++ b/debian/control @@ -27,6 +27,7 @@ Depends: ${misc:Depends}, lsb-release, lzma, make, + mount, parted, procps, python3, diff --git a/live-build/buildd/hooks/02-disk-image-uefi.binary b/live-build/buildd/hooks/02-disk-image-uefi.binary index d358596a..44a7ff42 100755 --- a/live-build/buildd/hooks/02-disk-image-uefi.binary +++ b/live-build/buildd/hooks/02-disk-image-uefi.binary @@ -41,7 +41,7 @@ create_partitions() { } create_and_mount_uefi_partition() { - uefi_dev="/dev/mapper${loop_device///dev/}p15" + uefi_dev="${loop_device}p15" mountpoint="$1" mkfs.vfat -F 32 -n UEFI "${uefi_dev}" diff --git a/live-build/functions b/live-build/functions index c00a06b5..b21a8518 100644 --- a/live-build/functions +++ b/live-build/functions @@ -12,16 +12,13 @@ loop_raw= backing_img= clean_loops() { - local kpartx_ret - local kpartx_stdout - - if [ -n "${backing_img}" ]; then + if [ -n "${loop_device}" ]; then # If something just finished writing to the device or a # partition (e.g. the zerofree in umount_partition) udev might # still be processing the device. udevadm settle sync - kpartx -v -d "${backing_img}" + losetup -v -d "${loop_device}" unset backing_img fi @@ -65,18 +62,15 @@ mount_image() { trap clean_loops EXIT backing_img="$1" local rootpart="$2" - kpartx_mapping="$(kpartx -s -v -a ${backing_img})" + loop_device=$(losetup --show -f -P -v ${backing_img}) - # Find the loop device - loop_p1="$(echo -e ${kpartx_mapping} | head -n1 | awk '{print$3}')" - loop_device="/dev/${loop_p1%p[0-9]*}" if [ ! -b ${loop_device} ]; then echo "unable to find loop device for ${backing_img}" exit 1 fi # Find the rootfs location - rootfs_dev_mapper="/dev/mapper/${loop_p1%%[0-9]}${rootpart}" + rootfs_dev_mapper="${loop_device}p${rootpart}" if [ ! -b "${rootfs_dev_mapper}" ]; then echo "${rootfs_dev_mapper} is not a block device"; exit 1 @@ -213,7 +207,7 @@ mount_disk_image() { mount_image ${disk_image} 1 mount_partition "${rootfs_dev_mapper}" $mountpoint - local uefi_dev="/dev/mapper${loop_device///dev/}p15" + local uefi_dev="${loop_device}p15" if [ -b ${uefi_dev} -a -e $mountpoint/boot/efi ]; then mount "${uefi_dev}" $mountpoint/boot/efi fi @@ -254,7 +248,7 @@ umount_partition() { umount_disk_image() { mountpoint="$1" - local uefi_dev="/dev/mapper${loop_device///dev/}p15" + 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 diff --git a/live-build/ubuntu-cpc/hooks.d/base/disk-image-ppc64el.binary b/live-build/ubuntu-cpc/hooks.d/base/disk-image-ppc64el.binary index dc87a361..b5b7cffc 100755 --- a/live-build/ubuntu-cpc/hooks.d/base/disk-image-ppc64el.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/disk-image-ppc64el.binary @@ -49,7 +49,7 @@ GRUB_TIMEOUT=0 # Set the default commandline GRUB_CMDLINE_LINUX_DEFAULT="console=hvc0 earlyprintk" EOF - prep_partition="/dev/mapper${loop_device///dev/}p2" + prep_partition="${loop_device}p2" chroot mountpoint grub-install "${prep_partition}" \ --no-nvram \ --boot-directory=/boot \ 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 91e77516..042db427 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 @@ -197,7 +197,7 @@ create_partitions() { } create_and_mount_uefi_partition() { - uefi_dev="/dev/mapper${loop_device///dev/}p15" + uefi_dev="${loop_device}p15" mountpoint="$1" mkfs.vfat -F 32 -n UEFI "${uefi_dev}" @@ -234,7 +234,7 @@ install_grub() { # Server preinstalled image # Setup cidata sample data & nocloud fallback # Allows login on first boot with or without metadata - cidata_dev="/dev/mapper${loop_device///dev/}p14" + cidata_dev="${loop_device}p14" setup_cidata "${cidata_dev}" setup_cinocloud mountpoint fi @@ -246,7 +246,7 @@ install_grub() { # Server preinstalled image # Setup cidata sample data & nocloud fallback # Allows login on first boot with or without metadata - cidata_dev="/dev/mapper${loop_device///dev/}p14" + cidata_dev="${loop_device}p14" setup_cidata "${cidata_dev}" setup_cinocloud mountpoint fi @@ -258,7 +258,7 @@ install_grub() { # Server preinstalled image # Setup cidata sample data & nocloud fallback # Allows login on first boot with or without metadata - cidata_dev="/dev/mapper${loop_device///dev/}p13" + cidata_dev="${loop_device}p13" setup_cidata "${cidata_dev}" setup_cinocloud mountpoint fi @@ -285,10 +285,10 @@ install_grub() { efi_target=riscv64-efi # The real U-Boot chroot mountpoint apt-get install -qqy u-boot-microchip - loader="/dev/mapper${loop_device///dev/}p13" + loader="${loop_device}p13" dd if=mountpoint/usr/lib/u-boot/microchip_icicle/u-boot.payload of=$loader # Provide end-user modifyable CIDATA - cidata_dev="/dev/mapper${loop_device///dev/}p12" + cidata_dev="${loop_device}p12" setup_cidata "${cidata_dev}" # Provide stock nocloud datasource # Allow interactive login on baremetal board, @@ -330,10 +330,10 @@ install_grub() { chroot mountpoint apt-get install -qqy u-boot-nezha # Since version 2022.10 U-Boot SPL and U-Boot are installed onto the same partition. # Package nezha-boot0 is not needed anymore. - loader1="/dev/mapper${loop_device///dev/}p13" + loader1="${loop_device}p13" dd if=mountpoint/usr/lib/u-boot/${SUBARCH}/u-boot-sunxi-with-spl.bin of=$loader1 # Provide end-user modifyable CIDATA - cidata_dev="/dev/mapper${loop_device///dev/}p12" + cidata_dev="${loop_device}p12" setup_cidata "${cidata_dev}" # Provide stock nocloud datasource # Allow interactive login on baremetal SiFive board, @@ -359,7 +359,7 @@ install_grub() { efi_target=riscv64-efi # factory u-boot requires a p3 partition with /boot/uEnv.txt file - uenv_dev="/dev/mapper${loop_device///dev/}p3" + uenv_dev="${loop_device}p3" mkfs.ext4 "${uenv_dev}" uenv_mnt_dir=`mktemp -d uenvXXX` mount "${uenv_dev}" "${uenv_mnt_dir}" @@ -387,7 +387,7 @@ EOF umount "${uenv_mnt_dir}" rmdir "${uenv_mnt_dir}" # Provide end-user modifyable CIDATA - cidata_dev="/dev/mapper${loop_device///dev/}p12" + cidata_dev="${loop_device}p12" setup_cidata "${cidata_dev}" # Provide stock nocloud datasource # Allow interactive login on baremetal SiFive board, @@ -406,7 +406,7 @@ EOF chroot mountpoint bash -c 'FK_FORCE=yes apt-get install -qqy grub-efi-riscv64 flash-kernel' efi_target=riscv64-efi # Provide end-user modifyable CIDATA - cidata_dev="/dev/mapper${loop_device///dev/}p12" + cidata_dev="${loop_device}p12" setup_cidata "${cidata_dev}" # Provide stock nocloud datasource # Allow interactive login on baremetal board, @@ -431,13 +431,13 @@ EOF fi chroot mountpoint apt-get install -qqy u-boot-sifive # FSBL, which gets U-Boot SPL - loader1="/dev/mapper${loop_device///dev/}p13" + loader1="${loop_device}p13" # The real U-Boot - loader2="/dev/mapper${loop_device///dev/}p14" + loader2="${loop_device}p14" dd if=mountpoint/usr/lib/u-boot/${u_boot_arch}/u-boot-spl.bin of=$loader1 dd if=mountpoint/usr/lib/u-boot/${u_boot_arch}/u-boot.itb of=$loader2 # Provide end-user modifyable CIDATA - cidata_dev="/dev/mapper${loop_device///dev/}p12" + cidata_dev="${loop_device}p12" setup_cidata "${cidata_dev}" # Provide stock nocloud datasource # Allow interactive login on baremetal SiFive board, From 99f54dd2b6abaa56e1234301fdcca32a1d81c3cc Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Fri, 26 May 2023 13:51:21 -0700 Subject: [PATCH 12/23] releasing package livecd-rootfs version 2.843 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index a9994476..83b02ec8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -livecd-rootfs (2.843) UNRELEASED; urgency=medium +livecd-rootfs (2.843) mantic; urgency=medium * Unconditionally enable i386 in the chroot for Ubuntu Desktop; the new installer doesn't handle enabling this at install time, and late @@ -6,7 +6,7 @@ livecd-rootfs (2.843) UNRELEASED; urgency=medium * Restore losetup code, the necessary launchpad-buildd changes were being deployed just as this revert landed. - -- Steve Langasek Mon, 17 Apr 2023 16:51:13 -0700 + -- Steve Langasek Fri, 26 May 2023 13:51:18 -0700 livecd-rootfs (2.842) mantic; urgency=medium From fdf685fc5ee5bcb0b02a587eb199b32c8d9b68c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Wed, 31 May 2023 14:38:53 +0200 Subject: [PATCH 13/23] Be more verbose when using ubuntu-image, use the ubuntu-image stable snap. --- live-build/auto/build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/live-build/auto/build b/live-build/auto/build index 9008abc7..7b9106a3 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -90,7 +90,7 @@ if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then # Use ubuntu-image instead of live-build export SNAPPY_STORE_NO_CDN=1 - snap install --classic --channel=candidate ubuntu-image + snap install --classic ubuntu-image # TODO: eventually, this should be handled by a single ubuntu-image # call without having to do a conditional on ubuntu-core/classic. @@ -106,7 +106,7 @@ if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then xz -0 -T4 "$PREFIX".img mv output/seed.manifest "$PREFIX".manifest else - ubuntu-image classic $UBUNTU_IMAGE_ARGS \ + ubuntu-image classic --verbose $UBUNTU_IMAGE_ARGS \ -O output "$PREFIX".yaml # Since the output of the ubuntu-image call can vary based on what # kind of an image we build, the safest bet is to 'export' all the From 157e4b2ac2dffa0adebcffe60a8cf0447e05339c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Wed, 31 May 2023 15:08:35 +0200 Subject: [PATCH 14/23] Better support for ubuntu-image artifact handling. --- live-build/auto/build | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/live-build/auto/build b/live-build/auto/build index 7b9106a3..b71c8942 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -115,8 +115,14 @@ if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then # to tweak livecd-rootfs everytime a different type of artifact # is needed. for artifact in output/*; do - mv $artifact $PREFIX.$(basename $artifact) + # We want to be dynamic, and want to support even + # two-part extensions. + filename=$(basename $artifact) + noversion=$(echo $filename | sed 's/[0-9][0-9]\.[0-9][0-9]//') + extension=${noversion#*.} + mv $artifact "$PREFIX".$extension done + [ -f $PREFIX.img ] && xz -0 -T4 "$PREFIX".img fi exit 0 From a027e767d22000d6c7827f3018df31423dd41815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Wed, 31 May 2023 15:14:55 +0200 Subject: [PATCH 15/23] Explicitly use the snap binary for ubuntu-image. --- live-build/auto/build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/live-build/auto/build b/live-build/auto/build index b71c8942..f408f324 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -97,7 +97,7 @@ if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then # We could already do that, but then we'd still have to do the # compressing for the core images. if [ "$PROJECT" = "ubuntu-core" ]; then - ubuntu-image snap $UBUNTU_IMAGE_ARGS \ + /snap/bin/ubuntu-image snap $UBUNTU_IMAGE_ARGS \ -O output "$PREFIX".model-assertion # XXX: currently we only have one image generated, but really # we should be supporting more than one for models that @@ -106,7 +106,7 @@ if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then xz -0 -T4 "$PREFIX".img mv output/seed.manifest "$PREFIX".manifest else - ubuntu-image classic --verbose $UBUNTU_IMAGE_ARGS \ + /snap/bin/ubuntu-image classic --verbose $UBUNTU_IMAGE_ARGS \ -O output "$PREFIX".yaml # Since the output of the ubuntu-image call can vary based on what # kind of an image we build, the safest bet is to 'export' all the From cf1c5648549f6e05c9aa8ff9c6f0fbaae9c5ed9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Wed, 31 May 2023 15:16:47 +0200 Subject: [PATCH 16/23] Changelog entry. --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 83b02ec8..161e77ff 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +livecd-rootfs (2.844) UNRELEASED; urgency=medium + + * Switch to use ubuntu-image 3.0 for our raspberry pi mantic images. + + -- Łukasz 'sil2100' Zemczak Wed, 31 May 2023 15:15:09 +0200 + livecd-rootfs (2.843) mantic; urgency=medium * Unconditionally enable i386 in the chroot for Ubuntu Desktop; the new From c7382d765ea434c27a0eabf1093d7c73b3ccb5ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Wed, 31 May 2023 15:17:25 +0200 Subject: [PATCH 17/23] releasing package livecd-rootfs version 2.844 --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 161e77ff..7bfaabc1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -livecd-rootfs (2.844) UNRELEASED; urgency=medium +livecd-rootfs (2.844) mantic; urgency=medium * Switch to use ubuntu-image 3.0 for our raspberry pi mantic images. From fef989b0fedd8e5c50c62ed2a65918ecb121d6e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Wed, 31 May 2023 17:09:32 +0200 Subject: [PATCH 18/23] Add the mtools dependency. --- debian/changelog | 6 ++++++ debian/control | 1 + 2 files changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 7bfaabc1..6a14044f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +livecd-rootfs (2.845) UNRELEASED; urgency=medium + + * Add the mtools dependency for ubuntu-image. + + -- Łukasz 'sil2100' Zemczak Wed, 31 May 2023 17:08:44 +0200 + livecd-rootfs (2.844) mantic; urgency=medium * Switch to use ubuntu-image 3.0 for our raspberry pi mantic images. diff --git a/debian/control b/debian/control index b36bcc48..65f9b665 100644 --- a/debian/control +++ b/debian/control @@ -28,6 +28,7 @@ Depends: ${misc:Depends}, lzma, make, mount, + mtools, parted, procps, python3, From 2e8e87fb2a263091a24d364f57c5f95344b0d5d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Wed, 31 May 2023 17:09:52 +0200 Subject: [PATCH 19/23] releasing package livecd-rootfs version 2.845 --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 6a14044f..0636529a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -livecd-rootfs (2.845) UNRELEASED; urgency=medium +livecd-rootfs (2.845) mantic; urgency=medium * Add the mtools dependency for ubuntu-image. From 95971f6b8f858eba6669a68925f4eda7e1083637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Thu, 1 Jun 2023 11:41:56 +0200 Subject: [PATCH 20/23] Make mtools arch-dependent. --- debian/changelog | 7 +++++++ debian/control | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 0636529a..c26dce45 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +livecd-rootfs (2.846) UNRELEASED; urgency=medium + + * Make the newly added mtools dependency arch-specific as it's not + installable on i386, causing migration issues. + + -- Łukasz 'sil2100' Zemczak Thu, 01 Jun 2023 11:40:52 +0200 + livecd-rootfs (2.845) mantic; urgency=medium * Add the mtools dependency for ubuntu-image. diff --git a/debian/control b/debian/control index 65f9b665..0fb57629 100644 --- a/debian/control +++ b/debian/control @@ -28,7 +28,7 @@ Depends: ${misc:Depends}, lzma, make, mount, - mtools, + mtools [!i386], parted, procps, python3, From d6c79b3ff6eec24b2cea1cfda7e4b4a54fce3cb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Thu, 1 Jun 2023 11:42:16 +0200 Subject: [PATCH 21/23] releasing package livecd-rootfs version 2.846 --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index c26dce45..2281b7e1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -livecd-rootfs (2.846) UNRELEASED; urgency=medium +livecd-rootfs (2.846) mantic; urgency=medium * Make the newly added mtools dependency arch-specific as it's not installable on i386, causing migration issues. From 40a1fdd60a82e7b67eeb4761ea588caade241c4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Mon, 5 Jun 2023 17:03:06 +0200 Subject: [PATCH 22/23] Add boot-managed-by-snapd preinstalled for canary installs --- debian/changelog | 9 +++++++++ live-build/auto/config | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 2281b7e1..0158d313 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +livecd-rootfs (2.847) UNRELEASED; urgency=medium + + * canary images: add boot-managed-by-snapd preinstalled by default on the + enhanced-secureboot layer. This will make sure that all canary installs + will not allow installing non-snap kernels and bootloader packages (as + this could break their systems). + + -- Łukasz 'sil2100' Zemczak Mon, 05 Jun 2023 16:57:58 +0200 + livecd-rootfs (2.846) mantic; urgency=medium * Make the newly added mtools dependency arch-specific as it's not diff --git a/live-build/auto/config b/live-build/auto/config index 01646dfa..117e17af 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -725,7 +725,7 @@ case $PROJECT in add_package minimal.standard.live linux-generic casper lvm2 mdadm cryptsetup remove_package minimal.standard.live ubiquity-frontend-gtk # the enhanced-secureboot layer, contains all packages for the enhanced secureboot install - add_package minimal.standard.enhanced-secureboot cryptsetup + add_package minimal.standard.enhanced-secureboot cryptsetup boot-managed-by-snapd # now let's create the neccessary catalog files # TODO: make sure that we handle locale_support: langpack correctly cat <<-EOF > config/minimal.catalog-in.yaml From 48fd86d762c3acce97c2bd0bccc9072214a37e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Mon, 5 Jun 2023 17:03:52 +0200 Subject: [PATCH 23/23] releasing package livecd-rootfs version 2.847 --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 0158d313..afc96acf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -livecd-rootfs (2.847) UNRELEASED; urgency=medium +livecd-rootfs (2.847) mantic; urgency=medium * canary images: add boot-managed-by-snapd preinstalled by default on the enhanced-secureboot layer. This will make sure that all canary installs