From 94c2d606ca6c8078ad36701b66a469b8cfb3c9d8 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Thu, 12 Dec 2019 12:55:25 +1300 Subject: [PATCH 01/38] Preserve apt preferences created by any package we install (i.e. ubuntu-advantage-tools) against live-build's attempt to delete them. (LP: #1855354) --- debian/changelog | 8 ++++++++ live-build/auto/build | 6 ++++++ live-build/auto/config | 11 +++++++++++ 3 files changed, 25 insertions(+) diff --git a/debian/changelog b/debian/changelog index 63baa1aa..e68f9f16 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +livecd-rootfs (2.634) UNRELEASED; urgency=medium + + * Preserve apt preferences created by any package we install (i.e. + ubuntu-advantage-tools) against live-build's attempt to delete them. + (LP: #1855354) + + -- Michael Hudson-Doyle Thu, 12 Dec 2019 12:55:17 +1300 + livecd-rootfs (2.633) focal; urgency=medium * Snapd for uc20 model assertions does not support global channel overrides. diff --git a/live-build/auto/build b/live-build/auto/build index 43a706be..c12ba331 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -314,6 +314,12 @@ EOF undivert_grub chroot fi + if [ -d chroot/etc/apt/preferences.d.save ]; then + # https://twitter.com/infinite_scream + mv chroot/etc/apt/preferences.d.save/* chroot/etc/apt/preferences.d/ + rmdir chroot/etc/apt/preferences.d.save + fi + # Let all configuration non multi-layered project here. # If those are moving to a multi-layer layout, this needs to be # done in chroot hooks. diff --git a/live-build/auto/config b/live-build/auto/config index 6ed05a42..58c0367b 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -1096,6 +1096,17 @@ rm -f /etc/fstab EOF fi +if [ $PROJECT = ubuntu-base ]; then + cat > config/hooks/100-preserve-ua-tools-prefs.chroot < config/hooks/100-ubuntukylin.chroot < Date: Thu, 12 Dec 2019 12:57:05 +1300 Subject: [PATCH 02/38] fix in case of no preferences --- live-build/auto/config | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/live-build/auto/config b/live-build/auto/config index 58c0367b..a4e90059 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -1103,7 +1103,9 @@ if [ $PROJECT = ubuntu-base ]; then # live-build "helpfully" removes /etc/apt/preferences.d/* so we put a # copy somewhere it won't touch it. -cp -a /etc/apt/preferences.d /etc/apt/preferences.d.save +if [ -n "$(ls -A /etc/apt/preferences.d)" ]; then + cp -a /etc/apt/preferences.d /etc/apt/preferences.d.save +fi EOF fi From fb31b64a7c46f613453c7cbce41ac5fb7d5f8c4f Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Thu, 12 Dec 2019 12:58:37 +1300 Subject: [PATCH 03/38] preserve apt preferences for all projects --- live-build/auto/config | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/live-build/auto/config b/live-build/auto/config index a4e90059..cb995a21 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -1096,8 +1096,7 @@ rm -f /etc/fstab EOF fi -if [ $PROJECT = ubuntu-base ]; then - cat > config/hooks/100-preserve-ua-tools-prefs.chroot < config/hooks/100-preserve-apt-prefs.chroot < config/hooks/100-ubuntukylin.chroot < Date: Fri, 13 Dec 2019 09:01:30 +1300 Subject: [PATCH 04/38] ubuntu-cpc hooks are Different --- live-build/auto/config | 4 +++- .../hooks.d/chroot/100-preserve-apt-prefs.chroot | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100755 live-build/ubuntu-cpc/hooks.d/chroot/100-preserve-apt-prefs.chroot diff --git a/live-build/auto/config b/live-build/auto/config index cb995a21..0b50f0ff 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -1096,7 +1096,8 @@ rm -f /etc/fstab EOF fi -cat > config/hooks/100-preserve-apt-prefs.chroot < config/hooks/100-preserve-apt-prefs.chroot <<\EOF #! /bin/sh -ex # live-build "helpfully" removes /etc/apt/preferences.d/* so we put a @@ -1106,6 +1107,7 @@ if [ -n "$(ls -A /etc/apt/preferences.d)" ]; then cp -a /etc/apt/preferences.d /etc/apt/preferences.d.save fi EOF +fi if [ $PROJECT = ubuntukylin ]; then cat > config/hooks/100-ubuntukylin.chroot < Date: Sat, 14 Dec 2019 20:59:21 +1300 Subject: [PATCH 05/38] bump version number --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index e68f9f16..98dd08a3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -livecd-rootfs (2.634) UNRELEASED; urgency=medium +livecd-rootfs (2.635) UNRELEASED; urgency=medium * Preserve apt preferences created by any package we install (i.e. ubuntu-advantage-tools) against live-build's attempt to delete them. From c35971f515e8f7ba357fe11eb443f2afb282e2b8 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Sat, 14 Dec 2019 21:01:23 +1300 Subject: [PATCH 06/38] releasing package livecd-rootfs version 2.635 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index c34e6ef8..3308477b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,10 @@ -livecd-rootfs (2.635) UNRELEASED; urgency=medium +livecd-rootfs (2.635) focal; urgency=medium * Preserve apt preferences created by any package we install (i.e. ubuntu-advantage-tools) against live-build's attempt to delete them. (LP: #1855354) - -- Michael Hudson-Doyle Thu, 12 Dec 2019 12:55:17 +1300 + -- Michael Hudson-Doyle Sat, 14 Dec 2019 21:00:45 +1300 livecd-rootfs (2.634) focal; urgency=medium From 95103e3d365631a5f750da5635353c8b9d1effb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Fri, 24 Jan 2020 18:34:40 +0100 Subject: [PATCH 07/38] Ensure seed part. is mounted; wait for getty --- debian/changelog | 9 +++++++++ .../chroot/999-ubuntu-image-customization.chroot | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/debian/changelog b/debian/changelog index 3308477b..f423fdae 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +livecd-rootfs (2.636) UNRELEASED; urgency=medium + + * Ensure seed partition is mounted on no-cloud images which use system-boot + as their seed (LP: #1860046) + * Have getty wait for cloud-init to complete to ensure that the default + user exists before presenting a login prompt + + -- Dave Jones Fri, 24 Jan 2020 15:17:56 +0000 + livecd-rootfs (2.635) focal; urgency=medium * Preserve apt preferences created by any package we install (i.e. diff --git a/live-build/ubuntu-cpc/hooks.d/chroot/999-ubuntu-image-customization.chroot b/live-build/ubuntu-cpc/hooks.d/chroot/999-ubuntu-image-customization.chroot index 491bd863..51786e87 100755 --- a/live-build/ubuntu-cpc/hooks.d/chroot/999-ubuntu-image-customization.chroot +++ b/live-build/ubuntu-cpc/hooks.d/chroot/999-ubuntu-image-customization.chroot @@ -19,5 +19,19 @@ datasource_list: [ NoCloud, None ] datasource: NoCloud: fs_label: system-boot +EOF + mkdir -p /etc/systemd/system/cloud-init-local.service.d + cat << EOF > /etc/systemd/system/cloud-init-local.service.d/mount-seed.conf +# Ensure our customized seed location is mounted prior to execution + +[Unit] +RequiresMountsFor=/boot/firmware +EOF + mkdir -p /etc/systemd/system/cloud-config.service.d + cat << EOF > /etc/systemd/system/cloud-config.service.d/getty-wait.conf +# Wait for cloud-init to finish (creating users, etc.) before running getty + +[Unit] +Before=getty.target EOF fi From 2870738f00a40da0ddd542df3954506b04aa3921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Fri, 24 Jan 2020 18:47:22 +0100 Subject: [PATCH 08/38] Merge the manually-pushed 2.636 from Laney. --- debian/changelog | 16 +++++++++++++++- live-build/auto/build | 2 +- live-build/auto/config | 29 +---------------------------- 3 files changed, 17 insertions(+), 30 deletions(-) diff --git a/debian/changelog b/debian/changelog index f423fdae..2ce81a10 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -livecd-rootfs (2.636) UNRELEASED; urgency=medium +livecd-rootfs (2.637) UNRELEASED; urgency=medium * Ensure seed partition is mounted on no-cloud images which use system-boot as their seed (LP: #1860046) @@ -7,6 +7,20 @@ livecd-rootfs (2.636) UNRELEASED; urgency=medium -- Dave Jones Fri, 24 Jan 2020 15:17:56 +0000 +livecd-rootfs (2.636) focal; urgency=medium + + * Stop trying to install linux-oem. It's dropped, but us trying to install + it is causing Ubuntu images to fail to build. It is due to be replaced by + linux-oem-20.04 (currently built from linux-...-5.4). But that is stuck in + focal-proposed at the minute, so there is nothing to transition to until + it migrates. + * Drop linux-signed-generic for flavours too - follow up from 2.630 which + handled this for Ubuntu. (LP: #1859146) + * Ditto for ubuntu-core:system-image - move from linux-signed-image-generic + to linux-image-generic. + + -- Iain Lane Fri, 10 Jan 2020 12:11:02 +0000 + livecd-rootfs (2.635) focal; urgency=medium * Preserve apt preferences created by any package we install (i.e. diff --git a/live-build/auto/build b/live-build/auto/build index c12ba331..26e73b96 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -606,7 +606,7 @@ case $PROJECT:${SUBPROJECT:-} in linux_package="linux-image-$devarch" case $ARCH in amd64) - linux_package="linux-signed-image-generic" + linux_package="linux-image-generic" ;; arm64) if [ "$devarch" = "dragonboard" ]; then diff --git a/live-build/auto/config b/live-build/auto/config index 0b50f0ff..123466f2 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -552,7 +552,7 @@ case $PROJECT in LIVE_TASK='ubuntu-live' add_task install minimal standard ubuntu-desktop add_task live ubuntu-desktop-minimal-default-languages ubuntu-desktop-default-languages - KERNEL_FLAVOURS='generic oem' + KERNEL_FLAVOURS='generic' ;; esac ;; @@ -561,9 +561,6 @@ case $PROJECT in add_task install minimal standard add_task install kubuntu-desktop LIVE_TASK='kubuntu-live' - case $ARCH in - amd64) add_package live linux-signed-generic ;; - esac COMPONENTS='main restricted universe' add_chroot_hook remove-gnome-icon-cache ;; @@ -590,9 +587,6 @@ case $PROJECT in edubuntu|edubuntu-dvd) add_task install minimal standard ubuntu-desktop edubuntu-desktop-gnome LIVE_TASK='edubuntu-live' - case $ARCH in - amd64) add_package live linux-signed-generic ;; - esac COMPONENTS='main restricted universe' ;; @@ -600,9 +594,6 @@ case $PROJECT in add_task install minimal standard xubuntu-desktop add_package install xterm LIVE_TASK='xubuntu-live' - case $ARCH in - amd64) add_package live linux-signed-generic ;; - esac COMPONENTS='main restricted universe multiverse' case $ARCH in amd64|i386) KERNEL_FLAVOURS=generic ;; @@ -617,18 +608,12 @@ case $PROJECT in mythbuntu) add_task install minimal standard mythbuntu-desktop LIVE_TASK='mythbuntu-live' - case $ARCH in - amd64) add_package live linux-signed-generic ;; - esac COMPONENTS='main restricted universe multiverse' ;; lubuntu) add_task install minimal standard lubuntu-desktop LIVE_TASK='lubuntu-live' - case $ARCH in - amd64) add_package live linux-signed-generic ;; - esac COMPONENTS='main restricted universe multiverse' case $ARCH in amd64|i386) KERNEL_FLAVOURS=generic ;; @@ -638,27 +623,18 @@ case $PROJECT in ubuntu-gnome) add_task install minimal standard ubuntu-gnome-desktop LIVE_TASK='ubuntu-gnome-live' - case $ARCH in - amd64) add_package live linux-signed-generic ;; - esac COMPONENTS='main restricted universe' ;; ubuntu-budgie) add_task install minimal standard ubuntu-budgie-desktop LIVE_TASK='ubuntu-budgie-live' - case $ARCH in - amd64) add_package live linux-signed-generic ;; - esac COMPONENTS='main restricted universe' ;; ubuntu-mate) add_task install minimal standard ubuntu-mate-core ubuntu-mate-desktop LIVE_TASK='ubuntu-mate-live' - case $ARCH in - amd64) add_package live linux-signed-generic ;; - esac COMPONENTS='main restricted universe multiverse' ;; @@ -674,9 +650,6 @@ case $PROJECT in add_task install minimal standard ubuntukylin-desktop add_package install ubuntukylin-default-settings LIVE_TASK='ubuntukylin-live' - case $ARCH in - amd64) add_package live linux-signed-generic ;; - esac COMPONENTS='main restricted universe' ;; From e6fd34b54d9a6ee2a52a6c2e91c7a0d579f05da4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Fri, 24 Jan 2020 18:47:55 +0100 Subject: [PATCH 09/38] releasing package livecd-rootfs version 2.637 --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 2ce81a10..d61ded13 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -livecd-rootfs (2.637) UNRELEASED; urgency=medium +livecd-rootfs (2.637) focal; urgency=medium * Ensure seed partition is mounted on no-cloud images which use system-boot as their seed (LP: #1860046) From f6ca600af20cb946923687c3ca5e4db9acbb7ed1 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Tue, 28 Jan 2020 15:05:36 +0000 Subject: [PATCH 10/38] Install oem-20.04 kernel flavour on Ubuntu Desktop builds. --- debian/changelog | 6 ++++++ live-build/auto/config | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index d61ded13..acfb0f32 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +livecd-rootfs (2.638) UNRELEASED; urgency=medium + + * Install oem-20.04 kernel flavour on Ubuntu Desktop builds. + + -- Dimitri John Ledkov Tue, 28 Jan 2020 15:05:09 +0000 + livecd-rootfs (2.637) focal; urgency=medium * Ensure seed partition is mounted on no-cloud images which use system-boot diff --git a/live-build/auto/config b/live-build/auto/config index 123466f2..3f1dcdb6 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -552,7 +552,7 @@ case $PROJECT in LIVE_TASK='ubuntu-live' add_task install minimal standard ubuntu-desktop add_task live ubuntu-desktop-minimal-default-languages ubuntu-desktop-default-languages - KERNEL_FLAVOURS='generic' + KERNEL_FLAVOURS='generic oem-20.04' ;; esac ;; From 2757f7aee319a09cb31b4807d34172023674851a Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Tue, 28 Jan 2020 15:06:24 +0000 Subject: [PATCH 11/38] releasing package livecd-rootfs version 2.638 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index acfb0f32..38db7f03 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -livecd-rootfs (2.638) UNRELEASED; urgency=medium +livecd-rootfs (2.638) focal; urgency=medium * Install oem-20.04 kernel flavour on Ubuntu Desktop builds. - -- Dimitri John Ledkov Tue, 28 Jan 2020 15:05:09 +0000 + -- Dimitri John Ledkov Tue, 28 Jan 2020 15:06:02 +0000 livecd-rootfs (2.637) focal; urgency=medium From e062389eb9b282770b78d19afbb410be71152570 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 29 Jan 2020 14:16:00 +0000 Subject: [PATCH 12/38] * On s390x subiquity: - enable cloud-init - make cloud-init handle the default/baked in networking configuration - install and enable openssh-server for the installation only - provide cloud.cfg that generates random installer user password - disable subiquity on sclp_line0 line based console --- debian/changelog | 11 ++ .../hooks/032-installer-squashfs.binary | 9 +- .../overlay/etc/cloud/cloud.cfg | 116 ++++++++++++++++++ .../overlay/etc/cloud/ds-identify.cfg | 2 + .../overlay/usr/bin/subiquity-shell | 3 + .../subiquity-serial.conf | 2 + 6 files changed, 139 insertions(+), 4 deletions(-) create mode 100644 live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg create mode 100644 live-build/ubuntu-server/includes.binary/overlay/etc/cloud/ds-identify.cfg create mode 100755 live-build/ubuntu-server/includes.binary/overlay/usr/bin/subiquity-shell create mode 100644 live-build/ubuntu-server/includes.binary/overlay/usr/lib/systemd/system/serial-getty@sclp_line0.service.d/subiquity-serial.conf diff --git a/debian/changelog b/debian/changelog index 38db7f03..3727cc37 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +livecd-rootfs (2.639) UNRELEASED; urgency=medium + + * On s390x subiquity: + - enable cloud-init + - make cloud-init handle the default/baked in networking configuration + - install and enable openssh-server for the installation only + - provide cloud.cfg that generates random installer user password + - disable subiquity on sclp_line0 line based console + + -- Dimitri John Ledkov Wed, 29 Jan 2020 14:10:31 +0000 + livecd-rootfs (2.638) focal; urgency=medium * Install oem-20.04 kernel flavour on Ubuntu Desktop builds. diff --git a/live-build/ubuntu-server/hooks/032-installer-squashfs.binary b/live-build/ubuntu-server/hooks/032-installer-squashfs.binary index 7a5debe6..59da66d9 100755 --- a/live-build/ubuntu-server/hooks/032-installer-squashfs.binary +++ b/live-build/ubuntu-server/hooks/032-installer-squashfs.binary @@ -65,7 +65,11 @@ chroot $INSTALLER_ROOT apt-get -y install lupin-casper # Install linux-firmware for kernel to upload into hardware. chroot $INSTALLER_ROOT apt-get -y install linux-firmware if [ `dpkg --print-architecture` = s390x ]; then - chroot $INSTALLER_ROOT apt-get -y install s390-tools-zkey + chroot $INSTALLER_ROOT apt-get -y install s390-tools-zkey openssh-server + rm $INSTALLER_ROOT/etc/netplan/00-installer-config.yaml +else + # Don't let cloud-init run in the live session. + touch $INSTALLER_ROOT/etc/cloud/cloud-init.disabled fi chroot $INSTALLER_ROOT apt-get clean @@ -73,9 +77,6 @@ chroot $INSTALLER_ROOT apt-get clean # "helpful" casper script that mounts any swap partitions it finds. rm -f $INSTALLER_ROOT/usr/share/initramfs-tools/scripts/casper-bottom/*swap -# Don't let cloud-init run in the live session. -touch $INSTALLER_ROOT/etc/cloud/cloud-init.disabled - # Preseed subiquity into installer layer snap_prepare $INSTALLER_ROOT snap_preseed $INSTALLER_ROOT subiquity/classic diff --git a/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg b/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg new file mode 100644 index 00000000..f737c9e0 --- /dev/null +++ b/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg @@ -0,0 +1,116 @@ +# The top level settings are used as module +# and system configuration. + +# A set of users which may be applied and/or used by various modules +# when a 'default' entry is found it will reference the 'default_user' +# from the distro configuration specified below +users: + - default + +# If this is set, 'root' will not be able to ssh in and they +# will get a message to login instead as the default $user +disable_root: true + +# This will cause the set+update hostname module to not operate (if true) +preserve_hostname: true + +ssh_pwauth: yes +chpasswd: + expire: false + list: + - installer:RANDOM + +# This is the initial network config. +# It can be overwritten by cloud-init or subiquity. +network: + version: 2 + ethernets: + all-en: + match: + name: "en*" + dhcp4: true + all-eth: + match: + name: "eth*" + dhcp4: true + +# Example datasource config +# datasource: +# Ec2: +# metadata_urls: [ 'blah.com' ] +# timeout: 5 # (defaults to 50 seconds) +# max_wait: 10 # (defaults to 120 seconds) + +# The modules that run in the 'init' stage +cloud_init_modules: + - bootcmd + - write-files + - ca-certs + - rsyslog + - users-groups + - ssh + +# The modules that run in the 'config' stage +cloud_config_modules: +# Emit the cloud config ready event +# this can be used by upstart jobs for 'start on cloud-config'. + - ssh-import-id + - set-passwords + - timezone + - disable-ec2-metadata + - runcmd + +# The modules that run in the 'final' stage +cloud_final_modules: + - scripts-per-once + - ssh-authkey-fingerprints + - keys-to-console + - phone-home + - final-message + +# System and/or distro specific settings +# (not accessible to handlers/transforms) +system_info: + # This will affect which distro class gets used + distro: ubuntu + # Default user name + that default users groups (if added/used) + default_user: + name: installer + lock_passwd: false + gecos: Ubuntu + groups: [adm, audio, cdrom, dialout, dip, floppy, lxd, netdev, plugdev, sudo, video] + sudo: ["ALL=(ALL) NOPASSWD:ALL"] + shell: /usr/bin/subiquity-shell + # Automatically discover the best ntp_client + ntp_client: auto + # Other config here will be given to the distro class and/or path classes + paths: + cloud_dir: /var/lib/cloud/ + templates_dir: /etc/cloud/templates/ + upstart_dir: /etc/init/ + package_mirrors: + - arches: [i386, amd64] + failsafe: + primary: http://archive.ubuntu.com/ubuntu + security: http://security.ubuntu.com/ubuntu + search: + primary: + - http://%(ec2_region)s.ec2.archive.ubuntu.com/ubuntu/ + - http://%(availability_zone)s.clouds.archive.ubuntu.com/ubuntu/ + - http://%(region)s.clouds.archive.ubuntu.com/ubuntu/ + security: [] + - arches: [arm64, armel, armhf] + failsafe: + primary: http://ports.ubuntu.com/ubuntu-ports + security: http://ports.ubuntu.com/ubuntu-ports + search: + primary: + - http://%(ec2_region)s.ec2.ports.ubuntu.com/ubuntu-ports/ + - http://%(availability_zone)s.clouds.ports.ubuntu.com/ubuntu-ports/ + - http://%(region)s.clouds.ports.ubuntu.com/ubuntu-ports/ + security: [] + - arches: [default] + failsafe: + primary: http://ports.ubuntu.com/ubuntu-ports + security: http://ports.ubuntu.com/ubuntu-ports + ssh_svcname: ssh diff --git a/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/ds-identify.cfg b/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/ds-identify.cfg new file mode 100644 index 00000000..fd83107e --- /dev/null +++ b/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/ds-identify.cfg @@ -0,0 +1,2 @@ +policy: search,found=first,maybe=none,notfound=enabled +datasource: None diff --git a/live-build/ubuntu-server/includes.binary/overlay/usr/bin/subiquity-shell b/live-build/ubuntu-server/includes.binary/overlay/usr/bin/subiquity-shell new file mode 100755 index 00000000..d739d86f --- /dev/null +++ b/live-build/ubuntu-server/includes.binary/overlay/usr/bin/subiquity-shell @@ -0,0 +1,3 @@ +#!/bin/sh +exec sudo snap run subiquity + diff --git a/live-build/ubuntu-server/includes.binary/overlay/usr/lib/systemd/system/serial-getty@sclp_line0.service.d/subiquity-serial.conf b/live-build/ubuntu-server/includes.binary/overlay/usr/lib/systemd/system/serial-getty@sclp_line0.service.d/subiquity-serial.conf new file mode 100644 index 00000000..76864e20 --- /dev/null +++ b/live-build/ubuntu-server/includes.binary/overlay/usr/lib/systemd/system/serial-getty@sclp_line0.service.d/subiquity-serial.conf @@ -0,0 +1,2 @@ +[Service] +ExecStartPre= From 7520a60019066f76a093d2ea1e392ac6deee133f Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 29 Jan 2020 14:16:12 +0000 Subject: [PATCH 13/38] releasing package livecd-rootfs version 2.639 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 3727cc37..ef70f576 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -livecd-rootfs (2.639) UNRELEASED; urgency=medium +livecd-rootfs (2.639) focal; urgency=medium * On s390x subiquity: - enable cloud-init @@ -7,7 +7,7 @@ livecd-rootfs (2.639) UNRELEASED; urgency=medium - provide cloud.cfg that generates random installer user password - disable subiquity on sclp_line0 line based console - -- Dimitri John Ledkov Wed, 29 Jan 2020 14:10:31 +0000 + -- Dimitri John Ledkov Wed, 29 Jan 2020 14:16:09 +0000 livecd-rootfs (2.638) focal; urgency=medium From db0c7d68f2539205e298e1c5bb8322740c8f9e45 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Thu, 30 Jan 2020 11:13:51 +0000 Subject: [PATCH 14/38] Although the request flavour to install is oem-20.04, it really is called just oem on disk. Override the flavour name from oem-20.04 to oem when renaming built artefacts. This also means that ubuntu-cdimage needs to simply download 'oem' vmlinuz+initrd pairs, not 'oem-20.04'. --- debian/changelog | 9 +++++++++ live-build/auto/build | 12 ++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index ef70f576..6089d244 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +livecd-rootfs (2.640) UNRELEASED; urgency=medium + + * Although the request flavour to install is oem-20.04, it really is + called just oem on disk. Override the flavour name from oem-20.04 to + oem when renaming built artefacts. This also means that ubuntu-cdimage + needs to simply download 'oem' vmlinuz+initrd pairs, not 'oem-20.04'. + + -- Dimitri John Ledkov Thu, 30 Jan 2020 11:10:37 +0000 + livecd-rootfs (2.639) focal; urgency=medium * On s390x subiquity: diff --git a/live-build/auto/build b/live-build/auto/build index 26e73b96..2e4d9415 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -819,10 +819,14 @@ for FLAVOUR in $LB_LINUX_FLAVOURS; do if [ -z "$LB_LINUX_FLAVOURS" ] || [ "$LB_LINUX_FLAVOURS" = "none" ]; then continue fi - if [ "$FLAVOUR" = "virtual" ]; then - # The virtual kernel is named generic in /boot - FLAVOUR="generic" - fi + case $FLAVOUR in + virtual) + FLAVOUR="generic" + ;; + oem-*) + FLAVOUR="oem" + ;; + esac KVERS="$( (cd "binary/$INITFS"; ls vmlinu?-* 2>/dev/null || true) | (fgrep -v .efi || true) | sed -n "s/^vmlinu.-\\([^-]*-[^-]*-$FLAVOUR\\)$/\\1/p" )" if [ -z "$KVERS" ]; then if [ -e "binary/$INITFS/vmlinuz" ]; then From fbf9c5b854298b452fb645701e71fe99d65bc2e6 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Thu, 30 Jan 2020 13:35:47 +0000 Subject: [PATCH 15/38] releasing package livecd-rootfs version 2.640 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 6089d244..b5e07c40 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,11 @@ -livecd-rootfs (2.640) UNRELEASED; urgency=medium +livecd-rootfs (2.640) focal; urgency=medium * Although the request flavour to install is oem-20.04, it really is called just oem on disk. Override the flavour name from oem-20.04 to oem when renaming built artefacts. This also means that ubuntu-cdimage needs to simply download 'oem' vmlinuz+initrd pairs, not 'oem-20.04'. - -- Dimitri John Ledkov Thu, 30 Jan 2020 11:10:37 +0000 + -- Dimitri John Ledkov Thu, 30 Jan 2020 11:52:32 +0000 livecd-rootfs (2.639) focal; urgency=medium From 3b1047fbc2b3410c201dba15759765e9c3a2c443 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Fri, 7 Feb 2020 22:11:54 +0000 Subject: [PATCH 16/38] Configure a better nocloud datasource for subiquity cloud-init. --- debian/changelog | 6 ++++++ .../ubuntu-server/hooks/032-installer-squashfs.binary | 8 ++++++++ .../includes.binary/overlay/etc/cloud/cloud.cfg | 5 +++++ .../overlay/var/lib/cloud/seed/nocloud/meta-data | 0 .../overlay/var/lib/cloud/seed/nocloud/user-data | 0 5 files changed, 19 insertions(+) create mode 100644 live-build/ubuntu-server/includes.binary/overlay/var/lib/cloud/seed/nocloud/meta-data create mode 100644 live-build/ubuntu-server/includes.binary/overlay/var/lib/cloud/seed/nocloud/user-data diff --git a/debian/changelog b/debian/changelog index b5e07c40..ce0ec646 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +livecd-rootfs (2.641) UNRELEASED; urgency=medium + + * Configure a better nocloud datasource for subiquity cloud-init. + + -- Dimitri John Ledkov Fri, 07 Feb 2020 22:11:26 +0000 + livecd-rootfs (2.640) focal; urgency=medium * Although the request flavour to install is oem-20.04, it really is diff --git a/live-build/ubuntu-server/hooks/032-installer-squashfs.binary b/live-build/ubuntu-server/hooks/032-installer-squashfs.binary index 59da66d9..d4b72679 100755 --- a/live-build/ubuntu-server/hooks/032-installer-squashfs.binary +++ b/live-build/ubuntu-server/hooks/032-installer-squashfs.binary @@ -64,6 +64,14 @@ EOF chroot $INSTALLER_ROOT apt-get -y install lupin-casper # Install linux-firmware for kernel to upload into hardware. chroot $INSTALLER_ROOT apt-get -y install linux-firmware + +# Make sure NoCloud is last +values=$(echo get cloud-init/datasources | chroot $INSTALLER_ROOT debconf-communicate | sed 's/^0 //;s/NoCloud, //;s/None/NoCloud, None/') +printf "%s\t%s\t%s\t%s\n" \ + cloud-init cloud-init/datasources multiselect "$values" | + chroot $INSTALLER_ROOT debconf-set-selections +chroot $INSTALLER_ROOT dpkg-reconfigure --frontend=noninteractive cloud-init + if [ `dpkg --print-architecture` = s390x ]; then chroot $INSTALLER_ROOT apt-get -y install s390-tools-zkey openssh-server rm $INSTALLER_ROOT/etc/netplan/00-installer-config.yaml diff --git a/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg b/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg index f737c9e0..577ff057 100644 --- a/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg +++ b/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg @@ -23,6 +23,9 @@ chpasswd: # This is the initial network config. # It can be overwritten by cloud-init or subiquity. network: + ## until https://bugs.launchpad.net/cloud-init/+bug/1861460 is fixed + config: disabled + ## version: 2 ethernets: all-en: @@ -34,6 +37,8 @@ network: name: "eth*" dhcp4: true +final_message: "## template: jinja\nCloud-init v. {{version}} finished at {{timestamp}}. Datasource {{datasource}}. Up {{uptime}} seconds\n\n\nWelcome to Ubuntu Server Installer!\n\nAbove you will find SSH host keys and a random password set for the `installer` user. You can use these credentials to ssh-in and complete the installation. If you provided SSH keys in the cloud-init datasource, they were also provisioned to the installer user.\n\nIf you have access to the graphical console, like TTY1 or HMC ASCII terminal you can complete the installation there too." + # Example datasource config # datasource: # Ec2: diff --git a/live-build/ubuntu-server/includes.binary/overlay/var/lib/cloud/seed/nocloud/meta-data b/live-build/ubuntu-server/includes.binary/overlay/var/lib/cloud/seed/nocloud/meta-data new file mode 100644 index 00000000..e69de29b diff --git a/live-build/ubuntu-server/includes.binary/overlay/var/lib/cloud/seed/nocloud/user-data b/live-build/ubuntu-server/includes.binary/overlay/var/lib/cloud/seed/nocloud/user-data new file mode 100644 index 00000000..e69de29b From 438606c5e8359c6a005402e6ddaea42b38432e54 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Fri, 7 Feb 2020 22:18:04 +0000 Subject: [PATCH 17/38] Encode CHANNEL specification in the UC20 model names. --- debian/changelog | 1 + live-build/auto/config | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index ce0ec646..24a09c89 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ livecd-rootfs (2.641) UNRELEASED; urgency=medium * Configure a better nocloud datasource for subiquity cloud-init. + * Encode CHANNEL specification in the UC20 model names. -- Dimitri John Ledkov Fri, 07 Feb 2020 22:11:26 +0000 diff --git a/live-build/auto/config b/live-build/auto/config index 3f1dcdb6..0dcc08ff 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -365,9 +365,20 @@ case $IMAGEFORMAT in ;; *) # Ubuntu Core 20 - # XXX: Currently uc20 assertions do not support global - # channel overrides. - MODEL="ubuntu-core-20-${MODEL#pc-}" + # Currently uc20 assertions do not support global + # channel overrides, instead we have per-channel models + case $CHANNEL in + stable) + MODEL="ubuntu-core-20-${MODEL#pc-}" + ;; + candidate|beta|edge|dangerous) + MODEL="ubuntu-core-20-${MODEL#pc-}-${CHANNEL}" + ;; + *) + echo "Unknown CHANNEL ${CHANNEL} specification for ${SUITE}" + exit 1 + ;; + esac ;; esac From 133c99c22c79c5709d2fdaace42387353df2bf32 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Fri, 7 Feb 2020 22:19:45 +0000 Subject: [PATCH 18/38] releasing package livecd-rootfs version 2.641 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 24a09c89..53be67a6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,9 @@ -livecd-rootfs (2.641) UNRELEASED; urgency=medium +livecd-rootfs (2.641) focal; urgency=medium * Configure a better nocloud datasource for subiquity cloud-init. * Encode CHANNEL specification in the UC20 model names. - -- Dimitri John Ledkov Fri, 07 Feb 2020 22:11:26 +0000 + -- Dimitri John Ledkov Fri, 07 Feb 2020 22:18:11 +0000 livecd-rootfs (2.640) focal; urgency=medium From 17dc48cf65333fc4f9a36a58e9fcdd4e4f0f2a23 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Mon, 10 Feb 2020 12:43:39 +0000 Subject: [PATCH 19/38] Set uc20 image size to 10G. --- debian/changelog | 6 ++++++ live-build/auto/config | 1 + 2 files changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 53be67a6..eef1bbf9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +livecd-rootfs (2.642) UNRELEASED; urgency=medium + + * Set uc20 image size to 10G. + + -- Dimitri John Ledkov Mon, 10 Feb 2020 12:43:23 +0000 + livecd-rootfs (2.641) focal; urgency=medium * Configure a better nocloud datasource for subiquity cloud-init. diff --git a/live-build/auto/config b/live-build/auto/config index 0dcc08ff..436df5fa 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -364,6 +364,7 @@ case $IMAGEFORMAT in UBUNTU_IMAGE_ARGS="$UBUNTU_IMAGE_ARGS -c $CHANNEL" ;; *) + UBUNTU_IMAGE_ARGS="--image-size 10G" # Ubuntu Core 20 # Currently uc20 assertions do not support global # channel overrides, instead we have per-channel models From a19d6273fe9cb49c908acf88795035735aff0a93 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Mon, 10 Feb 2020 12:43:50 +0000 Subject: [PATCH 20/38] releasing package livecd-rootfs version 2.642 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index eef1bbf9..9d05ae5b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -livecd-rootfs (2.642) UNRELEASED; urgency=medium +livecd-rootfs (2.642) focal; urgency=medium * Set uc20 image size to 10G. - -- Dimitri John Ledkov Mon, 10 Feb 2020 12:43:23 +0000 + -- Dimitri John Ledkov Mon, 10 Feb 2020 12:43:44 +0000 livecd-rootfs (2.641) focal; urgency=medium From d7045b2e0981fde4126dafee82c2af8680f8c0df Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Mon, 10 Feb 2020 23:50:03 +0000 Subject: [PATCH 21/38] Fixup subiquity: - drop ds-identify policy, not needed with improved cloud config - drop disabling network, doesn't work with ip= - fixup setting up the INSTALLER_ROOT mountpoint --- debian/changelog | 9 +++++++++ .../ubuntu-server/hooks/032-installer-squashfs.binary | 2 +- .../includes.binary/overlay/etc/cloud/cloud.cfg | 3 --- .../includes.binary/overlay/etc/cloud/ds-identify.cfg | 2 -- 4 files changed, 10 insertions(+), 6 deletions(-) delete mode 100644 live-build/ubuntu-server/includes.binary/overlay/etc/cloud/ds-identify.cfg diff --git a/debian/changelog b/debian/changelog index 9d05ae5b..d0af7733 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +livecd-rootfs (2.643) UNRELEASED; urgency=medium + + * subiquity: + - drop ds-identify policy, not needed with improved cloud config + - drop disabling network, doesn't work with ip= + - fixup setting up the INSTALLER_ROOT mountpoint + + -- Dimitri John Ledkov Mon, 10 Feb 2020 23:48:57 +0000 + livecd-rootfs (2.642) focal; urgency=medium * Set uc20 image size to 10G. diff --git a/live-build/ubuntu-server/hooks/032-installer-squashfs.binary b/live-build/ubuntu-server/hooks/032-installer-squashfs.binary index d4b72679..c3b73f63 100755 --- a/live-build/ubuntu-server/hooks/032-installer-squashfs.binary +++ b/live-build/ubuntu-server/hooks/032-installer-squashfs.binary @@ -35,7 +35,7 @@ mkdir -p "$INSTALLER_ROOT" "$OVERLAY_ROOT" # Create an installer squashfs layer mount_overlay "$FILESYSTEM_ROOT/" "$OVERLAY_ROOT/" "$INSTALLER_ROOT/" -setup_mountpoint binary/boot/squashfs.dir +setup_mountpoint "$INSTALLER_ROOT" # Override JobRunningTimeoutSec to 0s on the .device unit that # subiquity_config.mount depends on to avoid a 5s delay on switching diff --git a/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg b/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg index 577ff057..a0cdeb44 100644 --- a/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg +++ b/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg @@ -23,9 +23,6 @@ chpasswd: # This is the initial network config. # It can be overwritten by cloud-init or subiquity. network: - ## until https://bugs.launchpad.net/cloud-init/+bug/1861460 is fixed - config: disabled - ## version: 2 ethernets: all-en: diff --git a/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/ds-identify.cfg b/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/ds-identify.cfg deleted file mode 100644 index fd83107e..00000000 --- a/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/ds-identify.cfg +++ /dev/null @@ -1,2 +0,0 @@ -policy: search,found=first,maybe=none,notfound=enabled -datasource: None From 7904fd4fe50d2731414c42f9275a0e8a60d2b3bc Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Mon, 10 Feb 2020 23:50:20 +0000 Subject: [PATCH 22/38] releasing package livecd-rootfs version 2.643 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index d0af7733..f827a888 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,11 @@ -livecd-rootfs (2.643) UNRELEASED; urgency=medium +livecd-rootfs (2.643) focal; urgency=medium * subiquity: - drop ds-identify policy, not needed with improved cloud config - drop disabling network, doesn't work with ip= - fixup setting up the INSTALLER_ROOT mountpoint - -- Dimitri John Ledkov Mon, 10 Feb 2020 23:48:57 +0000 + -- Dimitri John Ledkov Mon, 10 Feb 2020 23:50:16 +0000 livecd-rootfs (2.642) focal; urgency=medium From e9170e053bd94c82aeed206deee6e2c1a384795d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Fri, 21 Feb 2020 12:46:43 +0100 Subject: [PATCH 23/38] Rename the raspi3 SUBARCH to raspi --- debian/changelog | 7 +++++++ live-build/auto/build | 2 +- live-build/auto/config | 13 +++++++++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index f827a888..91a9ae83 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +livecd-rootfs (2.644) UNRELEASED; urgency=medium + + * Rename the raspi3 SUBARCH to raspi, as we generate universal generic pi + images since long. + + -- Ɓukasz 'sil2100' Zemczak Fri, 21 Feb 2020 12:37:02 +0100 + livecd-rootfs (2.643) focal; urgency=medium * subiquity: diff --git a/live-build/auto/build b/live-build/auto/build index 2e4d9415..1a398e57 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -871,7 +871,7 @@ if [ "$NUMFLAVOURS" = 1 ] && [ "$LB_LINUX_FLAVOURS" != "none" ]; then fi case $SUBARCH in - raspi2|raspi3) + raspi|raspi2) # copy the kernel and initrd to a predictable directory for # ubuntu-image consumption. In some cases, like in pi2/3 # u-boot, the bootloader needs to contain the kernel and initrd, diff --git a/live-build/auto/config b/live-build/auto/config index 436df5fa..957da9b2 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -280,7 +280,7 @@ if [ -z "${IMAGEFORMAT:-}" ]; then case $PROJECT:${SUBPROJECT:-} in ubuntu-cpc:*|ubuntu:desktop-preinstalled) case $SUBARCH in - raspi3|imx6) + raspi|imx6) IMAGEFORMAT=ubuntu-image ;; *) @@ -326,10 +326,14 @@ case $IMAGEFORMAT in MODEL=pc-i386 ;; arm64+snapdragon) MODEL=dragonboard ;; + armhf+raspi) + MODEL=pi ;; armhf+raspi2) MODEL=pi2 ;; armhf+raspi3) MODEL=pi3 ;; + arm64+raspi) + MODEL=pi-arm64 ;; arm64+raspi3) MODEL=pi3-arm64 ;; armhf+cm3) @@ -404,7 +408,7 @@ case $IMAGEFORMAT in # Certain models have different names but are built from the same source gadget tree case $MODEL in - pi3-arm64) + pi-arm64|pi3-arm64) MODEL=pi3 ;; esac @@ -895,7 +899,8 @@ case $ARCH in add_package install linux-firmware-raspi2 u-boot-rpi flash-kernel u-boot-tools wpasupplicant BINARY_REMOVE_LINUX=false ;; - raspi3) + raspi) + # Generic Raspberry Pi images COMPONENTS='main restricted universe multiverse' KERNEL_FLAVOURS=raspi2 add_package install linux-firmware-raspi2 u-boot-rpi flash-kernel u-boot-tools wpasupplicant @@ -1000,7 +1005,7 @@ EOF esac case $ARCH+$SUBARCH in - armhf+raspi2|armhf+raspi3|arm64+raspi3) + armhf+raspi2|armhf+raspi|arm64+raspi) cat > config/hooks/01-firmware-directory.chroot_early < Date: Fri, 21 Feb 2020 12:47:48 +0100 Subject: [PATCH 24/38] releasing package livecd-rootfs version 2.644 --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 91a9ae83..1e6966b4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -livecd-rootfs (2.644) UNRELEASED; urgency=medium +livecd-rootfs (2.644) focal; urgency=medium * Rename the raspi3 SUBARCH to raspi, as we generate universal generic pi images since long. From 489f009e49253f3fec0c1cfc61fd5a1db1fb0115 Mon Sep 17 00:00:00 2001 From: Robert C Jennings Date: Fri, 21 Feb 2020 14:29:01 -0600 Subject: [PATCH 25/38] Use snap cli rather than custom snap-tool snap-tool was added to support a deprecate cohort-key feature of the snap store. Recent changes in snap assertions have added additional fields which snap-tool is not retrieving. This resulted in snap install failures on first boot. This patch removes snap-tool and returns to using the snap cli. This ensures snap downloads will function without odd incompatibilities. --- debian/changelog | 6 + debian/install | 1 - live-build/functions | 9 +- snap-tool | 603 ------------------------------------------- 4 files changed, 9 insertions(+), 610 deletions(-) delete mode 100755 snap-tool diff --git a/debian/changelog b/debian/changelog index 1e6966b4..2692b158 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +livecd-rootfs (2.645) UNRELEASED; urgency=medium + + * Use snap cli rather than custom snap-tool + + -- Robert C Jennings Fri, 21 Feb 2020 14:54:56 -0600 + livecd-rootfs (2.644) focal; urgency=medium * Rename the raspi3 SUBARCH to raspi, as we generate universal generic pi diff --git a/debian/install b/debian/install index 541221b4..818c3d11 100644 --- a/debian/install +++ b/debian/install @@ -4,4 +4,3 @@ get-ppa-fingerprint usr/share/livecd-rootfs minimize-manual usr/share/livecd-rootfs magic-proxy usr/share/livecd-rootfs lp-in-release usr/share/livecd-rootfs -snap-tool usr/share/livecd-rootfs diff --git a/live-build/functions b/live-build/functions index 8092f3a4..4fc31579 100644 --- a/live-build/functions +++ b/live-build/functions @@ -490,10 +490,7 @@ _snap_preseed() { # Determine if and what core snap is needed local snap_info - snap_info=$(/usr/share/livecd-rootfs/snap-tool info \ - --cohort-key="${COHORT_KEY:-}" \ - --channel="$CHANNEL" "${SNAP_NAME}" \ - ) + snap_info=$(snap info "${SNAP_NAME}") if [ $? -ne 0 ]; then echo "Failed to retrieve base of $SNAP_NAME!" @@ -513,8 +510,8 @@ _snap_preseed() { sh -c " set -x; cd \"$CHROOT_ROOT/var/lib/snapd/seed\"; - SNAPPY_STORE_NO_CDN=1 /usr/share/livecd-rootfs/snap-tool download \ - --cohort-key=\"${COHORT_KEY:-}\" \ + SNAPPY_STORE_NO_CDN=1 snap download \ + --cohort="${COHORT_KEY:-}" \ --channel=\"$CHANNEL\" \"$SNAP_NAME\"" || snap_download_failed=1 if [ $snap_download_failed = 1 ] ; then echo "If the channel ($CHANNEL) includes '*/ubuntu-##.##' track per " diff --git a/snap-tool b/snap-tool deleted file mode 100755 index cc4aa529..00000000 --- a/snap-tool +++ /dev/null @@ -1,603 +0,0 @@ -#!/usr/bin/python3 -#-*- encoding: utf-8 -*- -""" -This script can be used instead of the traditional `snap` command to download -snaps and accompanying assertions. It uses the new store API (v2) which allows -creating temporary snapshots of the channel map. - -To create such a snapshot run - - snap-tool cohort-create - -This will print a "cohort-key" to stdout, which can then be passed to future -invocations of `snap-tool download`. Whenever a cohort key is provided, the -store will provide a view of the channel map as it existed when the key was -created. -""" - -from textwrap import dedent - -import argparse -import base64 -import binascii -import getopt -import hashlib -import json -import os -import re -import shutil -import subprocess -import sys -import time -import urllib.error -import urllib.request - -EXIT_OK = 0 -EXIT_ERR = 1 - - -class SnapError(Exception): - """Generic error thrown by the Snap class.""" - pass - - -class SnapCraftError(SnapError): - """Error thrown on problems with the snapcraft APIs.""" - pass - - -class SnapAssertionError(SnapError): - """Error thrown on problems with the assertions API.""" - pass - - -class ExpBackoffHTTPClient: - """This class is an abstraction layer on top of urllib with additional - retry logic for more reliable downloads.""" - - class Request: - """This is a convenience wrapper around urllib.request.""" - - def __init__(self, request, do_retry, base_interval, num_tries): - """ - :param request: - An urllib.request.Request instance. - :param do_retry: - Whether to enable the exponential backoff and retry logic. - :param base_interval: - The initial interval to sleep after a failed attempt. - :param num_tries: - How many attempts to make. - """ - self._request = request - self._do_retry = do_retry - self._base_interval = base_interval - self._num_tries = num_tries - self._response = None - - def open(self): - """Open the connection.""" - if not self._response: - self._response = self._retry_urlopen() - - def close(self): - """Close the connection.""" - if self._response: - self._response.close() - self._response = None - - def data(self): - """Return the raw response body.""" - with self: - return self.read() - - def json(self): - """Return the deserialized response body interpreted as JSON.""" - return json.loads(self.data(), encoding="utf-8") - - def text(self): - """Return the response body as a unicode string.""" - encoding = "utf-8" - - with self: - content_type = self._response.getheader("Content-Type", "") - - if content_type == "application/json": - encoding = "utf-8" - else: - m = re.match(r"text/\S+;\s*charset=(?P\S+)", - content_type) - if m: - encoding=m.group("charset") - - return self.read().decode(encoding) - - def read(self, size=None): - """Read size bytes from the response. If size if not set, the - complete response body is read in.""" - return self._response.read(size) - - def __enter__(self): - """Make this class a context manager.""" - self.open() - return self - - def __exit__(self, type, value, traceback): - """Make this class a context manager.""" - self.close() - - def _retry_urlopen(self): - """Try to open the HTTP connection as many times as configured - through the constructor. Every time an error occurs, double the - time to wait until the next attempt.""" - for attempt in range(self._num_tries): - try: - return urllib.request.urlopen(self._request) - except Exception as e: - if isinstance(e, urllib.error.HTTPError) and e.code < 500: - raise - if attempt >= self._num_tries - 1: - raise - sys.stderr.write( - "WARNING: failed to open URL '{}': {}\n" - .format(self._request.full_url, str(e)) - ) - else: - break - - sleep_interval = self._base_interval * 2**attempt - sys.stderr.write( - "Retrying HTTP request in {} seconds...\n" - .format(sleep_interval) - ) - time.sleep(sleep_interval) - - - def __init__(self, do_retry=True, base_interval=2, num_tries=8): - """ - :param do_retry: - Whether to enable the retry logic. - :param base_interval: - The initial interval to sleep after a failed attempt. - :param num_tries: - How many attempts to make. - """ - self._do_retry = do_retry - self._base_interval = base_interval - self._num_tries = num_tries if do_retry else 1 - - def get(self, url, headers=None): - """Create a GET request that can be used to retrieve the resource - at the given URL. - - :param url: - An HTTP URL. - :param headers: - A dictionary of extra headers to send along. - :return: - An ExpBackoffHTTPClient.Request instance. - """ - return self._prepare_request(url, headers=headers) - - def post(self, url, data=None, json=None, headers=None): - """Create a POST request that can be used to submit data to the - endpoint at the given URL.""" - return self._prepare_request( - url, data=data, json_data=json, headers=headers - ) - - def _prepare_request(self, url, data=None, json_data=None, headers=None): - """Prepare a Request instance that can be used to retrieve data from - and/or send data to the endpoint at the given URL. - - :param url: - An HTTP URL. - :param data: - Raw binary data to send along in the request body. - :param json_data: - A Python data structure to be serialized and sent out in JSON - format. - :param headers: - A dictionary of extra headers to send along. - :return: - An ExpBackoffHTTPClient.Request instance. - """ - if data is not None and json_data is not None: - raise ValueError( - "Parameters 'data' and 'json_data' are mutually exclusive." - ) - - if json_data: - data = json.dumps(json_data, ensure_ascii=False) - if headers is None: - headers = {} - headers["Content-Type"] = "application/json" - if isinstance(data, str): - data = data.encode("utf-8") - - return ExpBackoffHTTPClient.Request( - urllib.request.Request(url, data=data, headers=headers or {}), - self._do_retry, - self._base_interval, - self._num_tries - ) - - -class Snap: - """This class provides methods to retrieve information about a snap and - download it together with its assertions.""" - - def __init__(self, name, channel="stable", arch="amd64", series=16, - cohort_key=None, assertion_url="https://assertions.ubuntu.com", - snapcraft_url="https://api.snapcraft.io", **kwargs): - """ - :param name: - The name of the snap. - :param channel: - The channel to operate on. - :param arch: - The Debian architecture of the snap (e.g. amd64, armhf, arm64, ...). - :param series: - The device series. This should always be 16. - :param cohort_key: - A cohort key to access a snapshot of the channel map. - """ - self._name = name - self._channel = channel - self._arch = arch - self._series = series - self._cohort_key = cohort_key - self._assertion_url = assertion_url - self._snapcraft_url = snapcraft_url - self._details = None - self._assertions = {} - - @classmethod - def cohort_create(cls): - """Get a cohort key for the current moment. A cohort key is valid - across all snaps, channels and architectures.""" - return Snap("core")\ - .get_details(cohort_create=True)\ - .get("cohort-key") - - def download(self, download_assertions=True): - """Download the snap container. If download_assertions is True, the - corresponding assertions will be downloaded, as well.""" - snap = self.get_details() - - snap_name = snap["name"] - snap_revision = snap["revision"] - publisher_id = snap["publisher"]["id"] - snap_download_url = snap["download"]["url"] - snap_byte_size = snap["download"]["size"] - filename = snap_name + "_" + str(snap_revision) - snap_filename = filename + ".snap" - assert_filename = filename + ".assert" - - skip_snap_download = False - - if os.path.exists(snap_filename) and os.path.getsize(snap_filename) \ - == snap_byte_size: - skip_snap_download = True - - headers = {} - - if os.environ.get("SNAPPY_STORE_NO_CDN", "0") != "0": - headers.update({ - "X-Ubuntu-No-Cdn": "true", - "Snap-CDN": "none", - }) - - if not skip_snap_download: - http_client = ExpBackoffHTTPClient() - response = http_client.get(snap_download_url, headers=headers) - with response, open(snap_filename, "wb+") as fp: - shutil.copyfileobj(response, fp) - - if os.path.getsize(snap_filename) != snap_byte_size: - raise SnapError( - "The downloaded snap does not have the expected size." - ) - - if not download_assertions: - return - - required_assertions = [ - "account-key", - "account", - "snap-declaration", - "snap-revision", - ] - - if publisher_id == "canonical": - required_assertions.remove("account") - - for assertion_name in required_assertions: - attr_name = "get_assertion_" + assertion_name.replace("-", "_") - # This will populate self._assertions[]. - getattr(self, attr_name)() - - with open(assert_filename, "w+", encoding="utf-8") as fp: - fp.write("\n".join(self._assertions[a] for a in - required_assertions)) - - def get_details(self, cohort_create=False): - """Get details about the snap. On subsequent calls, the cached results - are returned. If cohort_create is set to True, a cohort key will be - created and included in the result.""" - if self._details and not cohort_create: - return self._details - - if self.is_core_snap() and self._channel.startswith("stable/ubuntu-"): - sys.stderr.write( - "WARNING: switching channel from '{}' to 'stable' for '{}' " - "snap.\n".format(self._channel, self._name) - ) - self._channel = "stable" - - path = "/v2/snaps/refresh" - - data = { - "context": [], - "actions": [ - { - "action": "download", - "instance-key": "0", - "name": self._name, - "channel": self._channel, - } - ], - "fields": [ - "base", - "created-at", - "download", - "license", - "name", - "prices", - "publisher", - "revision", - "snap-id", - "summary", - "title", - "type", - "version", - ], - } - - # These are mutually exclusive. - if cohort_create: - data["actions"][0]["cohort-create"] = True - elif self._cohort_key: - data["actions"][0]["cohort-key"] = self._cohort_key - - try: - response_dict = self._do_snapcraft_request(path, json_data=data) - except SnapCraftError as e: - raise SnapError("failed to get details for '{}': {}" - .format(self._name, str(e))) - - snap_data = response_dict["results"][0] - - if snap_data.get("result") == "error": - raise SnapError( - "failed to get details for '{}': {}" - .format(self._name, snap_data.get("error", {}).get("message")) - ) - - # Have "base" initialized to something meaningful. - if self.is_core_snap(): - snap_data["snap"]["base"] = "" - elif snap_data["snap"].get("base") is None: - snap_data["snap"]["base"] = "core" - - # Copy the key into the snap details. - if "cohort-key" in snap_data: - snap_data["snap"]["cohort-key"] = snap_data["cohort-key"] - - if "error" in snap_data: - raise SnapError( - "failed to get details for '{}' in '{}' on '{}': {}" - .format(self._name, self._channel, self._arch, - snap_data["error"]["message"]) - ) - - self._details = snap_data["snap"] - return self._details - - def get_assertion_snap_revision(self): - """Download the snap-revision assertion associated with this snap. The - assertion is returned as a string.""" - if "snap-revision" in self._assertions: - return self._assertions["snap-revision"] - snap = self.get_details() - - snap_sha3_384 = base64.urlsafe_b64encode( - binascii.a2b_hex(snap["download"]["sha3-384"]) - ).decode("us-ascii") - - data = self._do_assertion_request("/v1/assertions/snap-revision/{}" - .format(snap_sha3_384)) - self._assertions["snap-revision"] = data - return data - - def get_assertion_snap_declaration(self): - """Download the snap-declaration assertion associated with this snap. - The assertion is returned as a string.""" - if "snap-declaration" in self._assertions: - return self._assertions["snap-declaration"] - snap = self.get_details() - series = self._series - snap_id = snap["snap-id"] - - data = self._do_assertion_request( - "/v1/assertions/snap-declaration/{}/{}" - .format(series, snap_id)) - - self._assertions["snap-declaration"] = data - return data - - def get_assertion_account(self): - """Download the account assertion associated with this snap. The - assertion is returned as a string.""" - if "account" in self._assertions: - return self._assertions["account"] - snap = self.get_details() - publisher_id = snap["publisher"]["id"] - data = self._do_assertion_request("/v1/assertions/account/{}" - .format(publisher_id)) - self._assertions["account"] = data - return data - - def get_assertion_account_key(self): - """Download the account-key assertion associated with this snap. The - assertion will be returned as a string.""" - if "account-key" in self._assertions: - return self._assertions["account-key"] - - declaration_data = self.get_assertion_snap_declaration() - sign_key_sha3 = None - - for line in declaration_data.splitlines(): - if line.startswith("sign-key-sha3-384:"): - sign_key_sha3 = line.split(":")[1].strip() - - data = self._do_assertion_request("/v1/assertions/account-key/{}" - .format(sign_key_sha3)) - - self._assertions["account-key"] = data - return data - - def is_core_snap(self): - return re.match(r"^core\d*$", self._name) != None - - def _do_assertion_request(self, path): - url = self._assertion_url + path - - headers = { - "Accept": "application/x.ubuntu.assertion", - } - - http_client = ExpBackoffHTTPClient() - try: - with http_client.get(url, headers=headers) as response: - return response.text() - except urllib.error.HTTPError as e: - raise SnapAssertionError(str(e)) - - def _do_snapcraft_request(self, path, json_data=None): - url = self._snapcraft_url + "/" + path - - headers = { - "Snap-Device-Series": str(self._series), - "Snap-Device-Architecture": self._arch, - } - - http_client = ExpBackoffHTTPClient() - try: - response = http_client.post(url, json=json_data, headers=headers) - with response: - return response.json() - except urllib.error.HTTPError as e: - raise SnapCraftError(str(e)) - - -class SnapCli: - - def __call__(self, args): - """Parse the command line arguments and execute the selected command.""" - options = self._parse_opts(args) - - try: - options.func(getattr(options, "snap", None), **vars(options)) - except SnapError as e: - sys.stderr.write("snap-tool {}: {}\n".format( - options.command, str(e))) - return EXIT_ERR - return EXIT_OK - - @staticmethod - def _get_host_deb_arch(): - result = subprocess.run(["dpkg", "--print-architecture"], - stdout=subprocess.PIPE, stderr=subprocess.PIPE, - universal_newlines=True, check=True) - - return result.stdout.strip() - - def _parse_opts(self, args): - main_parser = argparse.ArgumentParser() - subparsers = main_parser.add_subparsers(dest="command") - - parser_cohort_create = subparsers.add_parser("cohort-create", - help="Create a cohort key for the snap store channel map.") - parser_cohort_create.set_defaults(func=self._cohort_create) - - parser_download = subparsers.add_parser("download", - help="Download a snap from the store.") - parser_download.set_defaults(func=self._download) - - parser_info = subparsers.add_parser("info", - help="Retrieve information about a snap.") - parser_info.set_defaults(func=self._info) - - # Add common parameters. - for parser in [parser_download, parser_info]: - parser.add_argument("--cohort-key", dest="cohort_key", - help="A cohort key to pin the channel map to.", type=str) - parser.add_argument("--channel", dest="channel", - help="The publication channel to query (default: stable).", - type=str, default="stable") - parser.add_argument("--series", dest="series", - help="The device series (default: 16)", - type=int, default=16) - parser.add_argument("--arch", dest="arch", - help="The Debian architecture (default: amd64).", - type=str, default=self._get_host_deb_arch()) - parser.add_argument("snap", help="The name of the snap.") - - if not args: - main_parser.print_help() - sys.exit(EXIT_ERR) - - return main_parser.parse_args(args) - - def _cohort_create(self, _, **kwargs): - print(Snap.cohort_create()) - - def _download(self, snap_name, **kwargs): - Snap(snap_name, **kwargs).download() - - def _info(self, snap_name, **kwargs): - snap = Snap(snap_name, **kwargs) - info = snap.get_details() - - print(dedent("""\ - name: {} - summary: {} - arch: {} - base: {} - channel: {} - publisher: {} - license: {} - snap-id: {} - revision: {}""" - .format( - snap_name, - info.get("summary", ""), - snap._arch, - info.get("base"), - snap._channel, - info.get("publisher", {}).get("display-name", ""), - info.get("license", ""), - info.get("snap-id", ""), - info.get("revision", "") - )) - ) - - -if __name__ == "__main__": - try: - rval = SnapCli()(sys.argv[1:]) - except KeyboardInterrupt: - sys.stderr.write("snap-tool: caught keyboard interrupt, exiting.\n") - sys.exit(EXIT_ERR) - sys.exit(rval) From b843beb26b823d035f00a68f2877f544221c81b9 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Fri, 21 Feb 2020 13:02:47 -0800 Subject: [PATCH 26/38] releasing package livecd-rootfs version 2.645 --- debian/changelog | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2692b158..c474b1ed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,9 @@ -livecd-rootfs (2.645) UNRELEASED; urgency=medium +livecd-rootfs (2.645) focal; urgency=medium + [ Robert C Jennings ] * Use snap cli rather than custom snap-tool - -- Robert C Jennings Fri, 21 Feb 2020 14:54:56 -0600 + -- Steve Langasek Fri, 21 Feb 2020 13:02:43 -0800 livecd-rootfs (2.644) focal; urgency=medium From ede0be897b4258b1cc6f651c9ec77dac837fd977 Mon Sep 17 00:00:00 2001 From: Iain Lane Date: Mon, 24 Feb 2020 09:56:09 +0000 Subject: [PATCH 27/38] Pass --verbose to `snap info` so that it includes the base. --- debian/changelog | 6 ++++++ live-build/functions | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index c474b1ed..15fd7d6f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +livecd-rootfs (2.646) UNRELEASED; urgency=medium + + * Pass --verbose to `snap info` so that it includes the base. + + -- Iain Lane Mon, 24 Feb 2020 09:55:46 +0000 + livecd-rootfs (2.645) focal; urgency=medium [ Robert C Jennings ] diff --git a/live-build/functions b/live-build/functions index 4fc31579..3f88c5af 100644 --- a/live-build/functions +++ b/live-build/functions @@ -490,7 +490,7 @@ _snap_preseed() { # Determine if and what core snap is needed local snap_info - snap_info=$(snap info "${SNAP_NAME}") + snap_info=$(snap info --verbose "${SNAP_NAME}") if [ $? -ne 0 ]; then echo "Failed to retrieve base of $SNAP_NAME!" From bc3e962ee81e30b14edda02af84593e6fcc69846 Mon Sep 17 00:00:00 2001 From: Iain Lane Date: Mon, 24 Feb 2020 11:22:24 +0000 Subject: [PATCH 28/38] Finalise changelog --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 15fd7d6f..4f400b6a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -livecd-rootfs (2.646) UNRELEASED; urgency=medium +livecd-rootfs (2.646) focal; urgency=medium * Pass --verbose to `snap info` so that it includes the base. - -- Iain Lane Mon, 24 Feb 2020 09:55:46 +0000 + -- Iain Lane Mon, 24 Feb 2020 11:22:21 +0000 livecd-rootfs (2.645) focal; urgency=medium From d214127b9f409aca7cab201d138b11bc50b145a4 Mon Sep 17 00:00:00 2001 From: Robert C Jennings Date: Tue, 25 Feb 2020 16:00:37 -0600 Subject: [PATCH 29/38] Address snap base regression after snap-tool removal With the removal of snap-tool failures are seen in image builds that do not have the 'core' snap included by the seed. This is the case for the minimized subproject of the ubuntu-cpc project where lxd/core is removed. In that subproject, any binary hook which adds a snap that is based on 'core' will not add 'core' and fail 'snap debug validate-seed'. snap-tool included the following logic in the 'snap-tool info' when determining snap bases: # Have "base" initialized to something meaningful. if self.is_core_snap(): snap_data["snap"]["base"] = "" elif snap_data["snap"].get("base") is None: snap_data["snap"]["base"] = "core" The snap store does not return a base if the base is core which makes this necessary. This patch looks for the base in 'snap info' output and if none is found (and the snap is not snapd or core) it assumes the base is 'core' and installs it. This restores the behavior lost in the migration from snap-tool to snap cli. --- debian/changelog | 6 ++++++ live-build/functions | 15 +++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4f400b6a..0af70236 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +livecd-rootfs (2.647) focal; urgency=medium + + * Address snap base regression after snap-tool removal + + -- Robert C Jennings Tue, 25 Feb 2020 16:15:48 -0600 + livecd-rootfs (2.646) focal; urgency=medium * Pass --verbose to `snap info` so that it includes the base. diff --git a/live-build/functions b/live-build/functions index 3f88c5af..4daa6932 100644 --- a/live-build/functions +++ b/live-build/functions @@ -482,12 +482,16 @@ _snap_preseed() { return fi + # Pre-seed snap's base case $SNAP_NAME in snapd) # snapd is self-contained, ignore base ;; + core|core[0-9][0-9]) + # core and core## are self-contained, ignore base + ;; *) - # Determine if and what core snap is needed + # Determine which core snap is needed local snap_info snap_info=$(snap info --verbose "${SNAP_NAME}") @@ -499,11 +503,10 @@ _snap_preseed() { local core_snap=$(echo "$snap_info" | grep '^base:' | awk '{print $2}') - # If $core_snap is not the empty string then SNAP itself is not a core - # snap and we must additionally seed the core snap. - if [ -n "$core_snap" ]; then - _snap_preseed $CHROOT_ROOT $core_snap stable - fi + # If snap info does not list a base use 'core' + core_snap=${core_snap:-core} + + _snap_preseed $CHROOT_ROOT $core_snap stable ;; esac From f6e5da24f97c4573a7e442691d56f25c2298f650 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Tue, 3 Mar 2020 14:09:42 +0100 Subject: [PATCH 30/38] enable cloud-init in live session on all architectures --- .../hooks/032-installer-squashfs.binary | 15 ++++++--------- .../overlay/etc/netplan/00-installer-config.yaml | 13 ------------- 2 files changed, 6 insertions(+), 22 deletions(-) delete mode 100644 live-build/ubuntu-server/includes.binary/overlay/etc/netplan/00-installer-config.yaml diff --git a/live-build/ubuntu-server/hooks/032-installer-squashfs.binary b/live-build/ubuntu-server/hooks/032-installer-squashfs.binary index c3b73f63..c988a6bb 100755 --- a/live-build/ubuntu-server/hooks/032-installer-squashfs.binary +++ b/live-build/ubuntu-server/hooks/032-installer-squashfs.binary @@ -60,10 +60,11 @@ EOF # Prepare installer layer. -# Install casper for live session magic. -chroot $INSTALLER_ROOT apt-get -y install lupin-casper -# Install linux-firmware for kernel to upload into hardware. -chroot $INSTALLER_ROOT apt-get -y install linux-firmware +# Install: +# 1. linux-firmware for kernel to upload into hardware. +# 2. casper for live session magic. +# 3. openssh-server to enable the "ssh into live session" feature +chroot $INSTALLER_ROOT apt-get -y install linux-firmware lupin-casper openssh-server # Make sure NoCloud is last values=$(echo get cloud-init/datasources | chroot $INSTALLER_ROOT debconf-communicate | sed 's/^0 //;s/NoCloud, //;s/None/NoCloud, None/') @@ -73,11 +74,7 @@ printf "%s\t%s\t%s\t%s\n" \ chroot $INSTALLER_ROOT dpkg-reconfigure --frontend=noninteractive cloud-init if [ `dpkg --print-architecture` = s390x ]; then - chroot $INSTALLER_ROOT apt-get -y install s390-tools-zkey openssh-server - rm $INSTALLER_ROOT/etc/netplan/00-installer-config.yaml -else - # Don't let cloud-init run in the live session. - touch $INSTALLER_ROOT/etc/cloud/cloud-init.disabled + chroot $INSTALLER_ROOT apt-get -y install s390-tools-zkey fi chroot $INSTALLER_ROOT apt-get clean diff --git a/live-build/ubuntu-server/includes.binary/overlay/etc/netplan/00-installer-config.yaml b/live-build/ubuntu-server/includes.binary/overlay/etc/netplan/00-installer-config.yaml deleted file mode 100644 index b8399cb6..00000000 --- a/live-build/ubuntu-server/includes.binary/overlay/etc/netplan/00-installer-config.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# This is the initial network config. -# It can be overwritten by cloud-init or subiquity. -network: - version: 2 - ethernets: - all-en: - match: - name: "en*" - dhcp4: true - all-eth: - match: - name: "eth*" - dhcp4: true From 0dc12a1122dd6a53b7fc0b7b305fc4d0e6af606e Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Tue, 3 Mar 2020 14:11:22 +0100 Subject: [PATCH 31/38] remove stuff for copying autoinstall files around --- .../hooks/032-installer-squashfs.binary | 20 ------------------- .../system/subiquity_autoinstall.mount | 4 ---- 2 files changed, 24 deletions(-) delete mode 100644 live-build/ubuntu-server/includes.binary/overlay/usr/lib/systemd/system/subiquity_autoinstall.mount diff --git a/live-build/ubuntu-server/hooks/032-installer-squashfs.binary b/live-build/ubuntu-server/hooks/032-installer-squashfs.binary index c988a6bb..72df7f8f 100755 --- a/live-build/ubuntu-server/hooks/032-installer-squashfs.binary +++ b/live-build/ubuntu-server/hooks/032-installer-squashfs.binary @@ -50,14 +50,6 @@ JobRunningTimeoutSec=0s Wants=subiquity_config.mount EOF -AUTOINSTALL_DEVICE_UNIT='dev-disk-by\x2dlabel-autoinstall.device' -mkdir -p "$INSTALLER_ROOT/etc/systemd/system/$AUTOINSTALL_DEVICE_UNIT.d" -cat > "$INSTALLER_ROOT/etc/systemd/system/$AUTOINSTALL_DEVICE_UNIT.d/override.conf" < "$INSTALLER_ROOT"/etc/initramfs-tools/scripts/init-bottom/copy-autoinstall -#!/bin/sh -case \$1 in -prereqs) exit 0;; -esac - -[ -f /autoinstall.yaml ] && cp /autoinstall.yaml /run/initrd-autoinstall.yaml -EOF -chmod +x "$INSTALLER_ROOT"/etc/initramfs-tools/scripts/init-bottom/copy-autoinstall - teardown_mountpoint "$INSTALLER_ROOT" squashfs_f="${PWD}/livecd.${PROJECT}.installer.squashfs" diff --git a/live-build/ubuntu-server/includes.binary/overlay/usr/lib/systemd/system/subiquity_autoinstall.mount b/live-build/ubuntu-server/includes.binary/overlay/usr/lib/systemd/system/subiquity_autoinstall.mount deleted file mode 100644 index ae45838e..00000000 --- a/live-build/ubuntu-server/includes.binary/overlay/usr/lib/systemd/system/subiquity_autoinstall.mount +++ /dev/null @@ -1,4 +0,0 @@ -[Mount] -What=/dev/disk/by-label/autoinstall -Where=/autoinstall -Type=ext4 From c969c8e4b97360c2ad1673efada3da9f22e76fd6 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Tue, 3 Mar 2020 14:25:43 +0100 Subject: [PATCH 32/38] add runcmd to copy autoinstall from user-data to /autoinstall.yaml --- .../includes.binary/overlay/etc/cloud/cloud.cfg | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg b/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg index a0cdeb44..0b897d75 100644 --- a/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg +++ b/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg @@ -116,3 +116,15 @@ system_info: primary: http://ports.ubuntu.com/ubuntu-ports security: http://ports.ubuntu.com/ubuntu-ports ssh_svcname: ssh + +runcmd: + - - "python3" + - "-c" + - | + import subprocess, sys, yaml + user_data = yaml.safe_load(subprocess.run([ + "cloud-init", "query", "userdata"], + check=True, stdout=subprocess.PIPE, encoding='utf-8').stdout) + if 'autoinstall' in user_data: + with open("/autoinstall.yaml", "w") as fp: + yaml.dump(user_data['autoinstall'], fp) From 904f4789caa02802889279524ee0cd0c5525ab55 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Tue, 3 Mar 2020 15:10:32 +0100 Subject: [PATCH 33/38] update changelog --- debian/changelog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index 0af70236..4743d180 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +livecd-rootfs (2.648) UNRELEASED; urgency=medium + + * Enable cloud-init in live server installer live session. + * Remove code for old design for getting autoinstall.yaml. + * Add runcmd to extract autoinstall.yaml from user-data. + + -- Michael Hudson-Doyle Tue, 03 Mar 2020 15:09:01 +0100 + livecd-rootfs (2.647) focal; urgency=medium * Address snap base regression after snap-tool removal From 187fd01c3780c285f93c15cf0b454c20450975be Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Wed, 4 Mar 2020 09:24:18 +0100 Subject: [PATCH 34/38] re-add scripts-user to cloud_final_modules --- .../ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg b/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg index 0b897d75..a738bf15 100644 --- a/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg +++ b/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg @@ -65,6 +65,7 @@ cloud_config_modules: # The modules that run in the 'final' stage cloud_final_modules: - scripts-per-once + - scripts-user - ssh-authkey-fingerprints - keys-to-console - phone-home From de170d8bc1ffc03c48d0a2138f29ea0b36ca8b8b Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Wed, 4 Mar 2020 16:10:30 +0100 Subject: [PATCH 35/38] clarify changelog --- debian/changelog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 4743d180..ad30aa1a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ livecd-rootfs (2.648) UNRELEASED; urgency=medium - * Enable cloud-init in live server installer live session. + * Enable cloud-init in live server installer live session on all + architectures. * Remove code for old design for getting autoinstall.yaml. * Add runcmd to extract autoinstall.yaml from user-data. From 226a31dfe0c9d1d2ba11bcef3533430ff265dcec Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Wed, 4 Mar 2020 16:10:46 +0100 Subject: [PATCH 36/38] releasing package livecd-rootfs version 2.648 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index ad30aa1a..5bef7141 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,11 @@ -livecd-rootfs (2.648) UNRELEASED; urgency=medium +livecd-rootfs (2.648) focal; urgency=medium * Enable cloud-init in live server installer live session on all architectures. * Remove code for old design for getting autoinstall.yaml. * Add runcmd to extract autoinstall.yaml from user-data. - -- Michael Hudson-Doyle Tue, 03 Mar 2020 15:09:01 +0100 + -- Michael Hudson-Doyle Wed, 04 Mar 2020 16:10:35 +0100 livecd-rootfs (2.647) focal; urgency=medium From 49e550fb9e4c1ba1562cb3a7f4a493e857ba3088 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Thu, 5 Mar 2020 15:35:57 +0100 Subject: [PATCH 37/38] Fix autoinstall-extracting runcmd in the case no user-data is passed. --- debian/changelog | 6 ++++++ .../includes.binary/overlay/etc/cloud/cloud.cfg | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 5bef7141..4c9c5530 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +livecd-rootfs (2.649) UNRELEASED; urgency=medium + + * Fix autoinstall-extracting runcmd in the case no user-data is passed. + + -- Michael Hudson-Doyle Thu, 05 Mar 2020 15:35:17 +0100 + livecd-rootfs (2.648) focal; urgency=medium * Enable cloud-init in live server installer live session on all diff --git a/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg b/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg index a738bf15..ae6ce8a7 100644 --- a/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg +++ b/live-build/ubuntu-server/includes.binary/overlay/etc/cloud/cloud.cfg @@ -126,6 +126,6 @@ runcmd: user_data = yaml.safe_load(subprocess.run([ "cloud-init", "query", "userdata"], check=True, stdout=subprocess.PIPE, encoding='utf-8').stdout) - if 'autoinstall' in user_data: + if user_data is not None and 'autoinstall' in user_data: with open("/autoinstall.yaml", "w") as fp: yaml.dump(user_data['autoinstall'], fp) From 2b47f98242a3682eb459b29b707030802c51a801 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Thu, 5 Mar 2020 15:36:31 +0100 Subject: [PATCH 38/38] releasing package livecd-rootfs version 2.649 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4c9c5530..2910bb99 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -livecd-rootfs (2.649) UNRELEASED; urgency=medium +livecd-rootfs (2.649) focal; urgency=medium * Fix autoinstall-extracting runcmd in the case no user-data is passed. - -- Michael Hudson-Doyle Thu, 05 Mar 2020 15:35:17 +0100 + -- Michael Hudson-Doyle Thu, 05 Mar 2020 15:36:25 +0100 livecd-rootfs (2.648) focal; urgency=medium