diff --git a/debian/changelog b/debian/changelog index ec079204..432aac61 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,87 @@ -livecd-rootfs (2.510) UNRELEASED; urgency=medium +livecd-rootfs (2.520) UNRELEASED; urgency=medium * Make lzma initramfs compression opt-in rather than opt-out, and do not opt-in to it for live-server builds to speed up the boot. (LP: #1750873) -- Michael Hudson-Doyle Tue, 13 Mar 2018 21:24:27 +1300 +livecd-rootfs (2.519) bionic; urgency=medium + + [ Robert C Jennings ] + * Refactor snap preseeding to allow additional snaps to be preseeded from + hooks + + -- Steve Langasek Tue, 10 Apr 2018 15:59:33 -0700 + +livecd-rootfs (2.518) bionic; urgency=medium + + * Make subiquity installer boot quicker, by making dhcp interfaces + optional, such that wait-online is not blocking bringing up the + installer UI. + + -- Dimitri John Ledkov Tue, 03 Apr 2018 14:56:58 +0100 + +livecd-rootfs (2.517) bionic; urgency=medium + + [ Simon Quigley ] + * Add proper lubuntu support in BASE_SEED. + + -- Iain Lane Tue, 03 Apr 2018 11:56:32 +0100 + +livecd-rootfs (2.516) bionic; urgency=medium + + [ Chris Glass ] + * Make sure we call the build "minimal" within the cloud build info, + when building a minimized image. + + -- Steve Langasek Tue, 27 Mar 2018 12:12:31 -0700 + +livecd-rootfs (2.515) bionic; urgency=medium + + * Set the default locale to C.UTF-8 in all server and cloud images. + (LP: #1751051, #1759003) + + -- Michael Hudson-Doyle Tue, 27 Mar 2018 09:59:02 +1300 + +livecd-rootfs (2.514) bionic; urgency=medium + + * On amd64, if building minimal images for bionic, xenial, or extra ppa, + use kvm kernel, otherwise fallback to virtual. + + -- Dimitri John Ledkov Wed, 21 Mar 2018 11:02:25 +0000 + +livecd-rootfs (2.513) bionic; urgency=medium + + * In the live-server build, prevent casper from mounting any existing + swap partitions from drives we might later be installing to. + (LP: #1743643) + + -- Michael Hudson-Doyle Wed, 21 Mar 2018 15:58:02 +1300 + +livecd-rootfs (2.512) bionic; urgency=medium + + * ubuntu-cpc: When performing a minimized build, don't generate artifacts + that won't boot with the linux-kvm kernel (LP: #1757223). + + -- Daniel Watkins Tue, 20 Mar 2018 13:42:50 -0400 + +livecd-rootfs (2.511) bionic; urgency=medium + + * Whitelist preserving "unowned" /var/log/journal. Maybe systemd package + should own the directory, and only adjust the permissions in + postinst. LP: #1754332 + + -- Dimitri John Ledkov Fri, 16 Mar 2018 18:36:56 +0000 + +livecd-rootfs (2.510) bionic; urgency=medium + + * Rename the directory containing the systemd override file for subiquity to + the correct name :/ + * Add Environment=SNAP_REEXEC=0 to the above override file. + * Remove the snap.subiquity.started overrides, that service is long gone. + + -- Michael Hudson-Doyle Thu, 15 Mar 2018 14:09:57 +1300 + livecd-rootfs (2.509) bionic; urgency=medium [ Steve Langasek ] diff --git a/live-build/auto/build b/live-build/auto/build index e28e6ca7..8689bcf1 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -15,6 +15,8 @@ if [ -z "${PROJECT:-}" ]; then exit 1 fi +. config/functions + # Link output files somewhere BuildLiveCD will be able to find them. PREFIX="livecd.$PROJECT${SUBARCH:+-$SUBARCH}" @@ -35,45 +37,12 @@ Setup_cleanup preinstall_snaps() { lb chroot_resolv install - snap_channel="stable/ubuntu-$(distro-info --series="$LB_DISTRIBUTION" \ - -r | awk '{ print $1 }')" - chroot chroot sh -c ' - set -x; - cd /var/lib/snapd/seed; - SNAPPY_STORE_NO_CDN=1 snap download core' + snap_prepare chroot + for snap in "$@"; do - chroot chroot sh -c " - set -x; - cd /var/lib/snapd/seed; - SNAPPY_STORE_NO_CDN=1 snap download --channel=$snap_channel \"${snap%/*}\"" + snap_preseed chroot "${snap}" done lb chroot_resolv remove - - CORE_SNAP=$(cd chroot/var/lib/snapd/seed; ls -1 core_*.snap) - - cat < chroot/var/lib/snapd/seed/seed.yaml -snaps: - - name: core - channel: stable - file: ${CORE_SNAP} -EOF - for snap in "$@"; do - snap_name=${snap%/*} - cat <> chroot/var/lib/snapd/seed/seed.yaml - - name: ${snap_name} - channel: $snap_channel -EOF - case ${snap} in */classic) echo " classic: true" >> chroot/var/lib/snapd/seed/seed.yaml;; esac - echo -n " file: " >> chroot/var/lib/snapd/seed/seed.yaml - (cd chroot/var/lib/snapd/seed; ls -1 ${snap_name}_*.snap) \ - >> chroot/var/lib/snapd/seed/seed.yaml - done - - mkdir -p chroot/var/lib/snapd/seed/snaps \ - chroot/var/lib/snapd/seed/assertions - mv chroot/var/lib/snapd/seed/*.assert \ - chroot/var/lib/snapd/seed/assertions/ - mv chroot/var/lib/snapd/seed/*.snap chroot/var/lib/snapd/seed/snaps/ } rm -f binary.success @@ -94,6 +63,16 @@ Expire-Date: 0 lb bootstrap "$@" + case $PROJECT in + ubuntu-server|ubuntu-cpc) + # Set locale to C.UTF-8 by default. We should + # probably do this for all images early in the + # 18.10 cycle but for now just do it for + # server and cpc products. + echo "LANG=C.UTF-8" > chroot/etc/default/locale + ;; + esac + if [ "${SUBPROJECT:-}" = minimized ] \ && ! Chroot chroot dpkg -l tzdata 2>&1 |grep -q ^ii; then # workaround for tzdata purge not removing these files @@ -374,26 +353,6 @@ deb file:/var/lib/preinstalled-pool/ $LB_DISTRIBUTION $LB_PARENT_ARCHIVE_AREAS case $PROJECT:$SUBPROJECT in *) if [ -e "config/seeded-snaps" ]; then - assertions_dir="chroot/var/lib/snapd/seed/assertions" - model_assertion="$assertions_dir/generic-classic.model" - account_key_assertion="$assertions_dir/generic.account-key" - account_assertion="$assertions_dir/generic.account" - - mkdir -p "$assertions_dir" - snap known --remote model series=16 \ - model=generic-classic brand-id=generic \ - > "$model_assertion" - account_key=$(sed -n -e's/sign-key-sha3-384: //p' \ - < "$model_assertion") - - snap known --remote account-key \ - public-key-sha3-384="$account_key" \ - > "$account_key_assertion" - account=$(sed -n -e's/account-id: //p' \ - < "$account_key_assertion") - - snap known --remote account account-id=generic \ - > "$account_assertion" snap_list=$(cat config/seeded-snaps) preinstall_snaps $snap_list fi @@ -409,8 +368,13 @@ deb file:/var/lib/preinstalled-pool/ $LB_DISTRIBUTION $LB_PARENT_ARCHIVE_AREAS fi fi if [ "$PROJECT" = "ubuntu-cpc" ]; then + if [ "${SUBPROJECT:-}" = minimized ]; then + BUILD_NAME=minimal + else + BUILD_NAME=server + fi cat > chroot/etc/cloud/build.info << EOF -build_name: server +build_name: $BUILD_NAME serial: $BUILDSTAMP EOF fi diff --git a/live-build/auto/config b/live-build/auto/config index 4017aba1..957100ae 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -629,10 +629,10 @@ case $PROJECT in # linux-kvm is available since you control the # archive and can provide this metapackage as # necessary. - if [ "$ARCH" != "amd64" ] || ([ -z "$EXTRA_PPAS" ] && [ "$SUITE" != xenial ]); then - KERNEL_FLAVOURS=virtual - else + if [ "$ARCH" = "amd64" ] && ([ -n "$EXTRA_PPAS" ] || [ "$SUITE" = xenial ] || [ "$SUITE" = bionic ]); then KERNEL_FLAVOURS=kvm + else + KERNEL_FLAVOURS=virtual fi else add_task install minimal standard cloud-image @@ -671,9 +671,15 @@ esac # we'll expand the base seed given here according to the STRUCTURE file, and # then look in all of the seeds found to see which snaps are seeded case $PROJECT:${SUBPROJECT:-} in - ubuntu:*|kubuntu*:*|lubuntu*:*|xubuntu*:*|ubuntu-mate*:*|ubuntustudio*:*|ubuntukylin*:*|ubuntu-budgie*:*) + ubuntu:*|kubuntu*:*|xubuntu*:*|ubuntu-mate*:*|ubuntustudio*:*|ubuntukylin*:*|ubuntu-budgie*:*) BASE_SEED='desktop' ;; + lubuntu-next:*) + BASE_SEED='desktop-qt' + ;; + lubuntu:*) + BASE_SEED='desktop-gtk' + ;; ubuntu-server:live) BASE_SEED='server' # subiquity is seeded but in a separate squashfs via hooks; set HOOK_SNAPS and ALL_SNAPS. @@ -829,9 +835,11 @@ lb config noauto \ echo "LB_CHROOT_HOOKS=\"$CHROOT_HOOKS\"" >> config/chroot echo "SUBPROJECT=\"${SUBPROJECT:-}\"" >> config/chroot +echo "LB_DISTRIBUTION=\"$SUITE\"" >> config/chroot echo "LB_BINARY_HOOKS=\"$BINARY_HOOKS\"" >> config/binary echo "BUILDSTAMP=\"$NOW\"" >> config/binary echo "SUBPROJECT=\"${SUBPROJECT:-}\"" >> config/binary +echo "LB_DISTRIBUTION=\"$SUITE\"" >> config/binary case $ARCH+$SUBARCH in armhf+raspi2) diff --git a/live-build/functions b/live-build/functions index 66aadff1..f3e1df0b 100644 --- a/live-build/functions +++ b/live-build/functions @@ -1,6 +1,7 @@ # vi: ts=4 expandtab syntax=sh -imagesize=${IMAGE_SIZE:-$((2252*1024**2))} # 2.2G (the current size we ship) +#imagesize=${IMAGE_SIZE:-$((2252*1024**2))} # 2.2G (the current size we ship) +imagesize=${IMAGE_SIZE:-2361393152} # 2.2G (the current size we ship) fs_label="${FS_LABEL:-rootfs}" rootfs_dev_mapper= @@ -360,3 +361,106 @@ recreate_initramfs() { esac mv "$CHROOT"/boot/initrd.img-* $DESTDIR } + +release_ver() { + # Return the release version number + distro-info --series="$LB_DISTRIBUTION" -r | awk '{ print $1 }' +} + +_snap_preseed() { + # Download the snap/assertion and add to the preseed + local CHROOT_ROOT=$1 + local SNAP=$2 + local SNAP_NAME=${SNAP%/*} + local CHANNEL=${3:?Snap channel must be specified} + + local seed_dir="$CHROOT_ROOT/var/lib/snapd/seed" + local snaps_dir="$seed_dir/snaps" + local seed_yaml="$seed_dir/seed.yaml" + local assertions_dir="$seed_dir/assertions" + + # Download the snap & assertion + local snap_download_failed=0 + chroot $CHROOT_ROOT sh -c " + set -x; + cd /var/lib/snapd/seed; + SNAPPY_STORE_NO_CDN=1 snap download \ + --channel=$CHANNEL \"$SNAP_NAME\"" || snap_download_failed=1 + if [ $snap_download_failed = 1 ] ; then + echo "If the channel ($CHANNEL) includes '*/ubuntu-##.##' track per " + echo "Ubuntu policy (ex. stable/ubuntu-18.04) the publisher will need " + echo "to temporarily create the channel/track to allow fallback during" + echo "download (ex. stable/ubuntu-18.04 falls back to stable if the" + echo "prior had been created in the past)." + exit 1 + fi + + mv -v $seed_dir/*.assert $assertions_dir + mv -v $seed_dir/*.snap $snaps_dir + + # Add the snap to the seed.yaml + ! [ -e $seed_yaml ] && echo "snaps:" > $seed_yaml + cat <> $seed_yaml + - + name: ${SNAP_NAME} + channel: ${CHANNEL} +EOF + + case ${SNAP} in */classic) echo " classic: true" >> $seed_yaml;; esac + + echo -n " file: " >> $seed_yaml + (cd $snaps_dir; ls -1 ${SNAP_NAME}_*.snap) >> $seed_yaml +} + +snap_prepare() { + # Configure basic snapd assertions and pre-seeds the 'core' snap + local CHROOT_ROOT=$1 + + local seed_dir="$CHROOT_ROOT/var/lib/snapd/seed" + local snaps_dir="$seed_dir/snaps" + local assertions_dir="$seed_dir/assertions" + local model_assertion="$assertions_dir/generic-classic.model" + local account_key_assertion="$assertions_dir/generic.account-key" + local account_assertion="$assertions_dir/generic.account" + + mkdir -p "$assertions_dir" + mkdir -p "$snaps_dir" + + if ! [ -e "$model_assertion" ] ; then + snap known --remote model series=16 \ + model=generic-classic brand-id=generic \ + > "$model_assertion" + fi + + if ! [ -e "$account_key_assertion" ] ; then + local account_key=$(sed -n -e's/sign-key-sha3-384: //p' \ + < "$model_assertion") + snap known --remote account-key \ + public-key-sha3-384="$account_key" \ + > "$account_key_assertion" + fi + + + if ! [ -e "$account_assertion" ] ; then + local account=$(sed -n -e's/account-id: //p' < "$account_key_assertion") + snap known --remote account account-id=$account \ + > "$account_assertion" + fi + + # Download the core snap + if ! [ -f $snaps_dir/core_[0-9]*.snap ] ; then + _snap_preseed $CHROOT_ROOT core stable + fi +} + +snap_preseed() { + # Preseed a snap in the image + local CHROOT_ROOT=$1 + local SNAP=$2 + # Per Ubuntu policy, all seeded snaps (with the exception of the core + # snap) must pull from stable/ubuntu-$(release_ver) as their channel. + local CHANNEL=${3:-"stable/ubuntu-$(release_ver)"} + + snap_prepare $CHROOT_ROOT + _snap_preseed $CHROOT_ROOT $SNAP $CHANNEL +} diff --git a/live-build/ubuntu-cpc/hooks/040-vmdk-image.binary b/live-build/ubuntu-cpc/hooks/040-vmdk-image.binary index 95b1d9a3..32740127 100755 --- a/live-build/ubuntu-cpc/hooks/040-vmdk-image.binary +++ b/live-build/ubuntu-cpc/hooks/040-vmdk-image.binary @@ -3,6 +3,15 @@ # # Generate VMDK files +case ${SUBPROJECT:-} in + minimized) + echo "Skipping minimized $0 build as images won't boot with linux-kvm" + exit 0 + ;; + *) + ;; +esac + case $ARCH in amd64) ;; *) echo "VMDK images are not supported for $ARCH yet."; diff --git a/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary b/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary index 48d77789..77a4b11a 100755 --- a/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary +++ b/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary @@ -9,6 +9,15 @@ # # For this step, we re-use the VMDK's made in 040-vmdk-image.binary +case ${SUBPROJECT:-} in + minimized) + echo "Skipping minimized $0 build as images won't boot with linux-kvm" + exit 0 + ;; + *) + ;; +esac + # Switch on $ARCH to determine which ID and description to use in the produced # OVF. We have fancy Ubuntu-specific IDs in the OVF specification, we might as diff --git a/live-build/ubuntu-cpc/hooks/042-vagrant.binary b/live-build/ubuntu-cpc/hooks/042-vagrant.binary index d92b7080..cb6c593c 100755 --- a/live-build/ubuntu-cpc/hooks/042-vagrant.binary +++ b/live-build/ubuntu-cpc/hooks/042-vagrant.binary @@ -15,6 +15,15 @@ # some packages in it, convert it to a vmdk, and then assemble the vagrant # box. +case ${SUBPROJECT:-} in + minimized) + echo "Skipping minimized $0 build as images won't boot with linux-kvm" + exit 0 + ;; + *) + ;; +esac + case $IMAGE_TARGETS in ""|*vagrant*) ;; diff --git a/live-build/ubuntu-cpc/hooks/099-cleanup.chroot b/live-build/ubuntu-cpc/hooks/099-cleanup.chroot index cf2b7dd1..ec0b05c6 100755 --- a/live-build/ubuntu-cpc/hooks/099-cleanup.chroot +++ b/live-build/ubuntu-cpc/hooks/099-cleanup.chroot @@ -27,7 +27,7 @@ do done # Remove un-owned log directories -whitelisted_dirs=(/var/log/fsck) +whitelisted_dirs=(/var/log/fsck /var/log/journal) for log_d in $(find /var/log/* -type d) do diff --git a/live-build/ubuntu-server/hooks/032-installer-squashfs.binary b/live-build/ubuntu-server/hooks/032-installer-squashfs.binary index a0b77a20..bab6ab76 100755 --- a/live-build/ubuntu-server/hooks/032-installer-squashfs.binary +++ b/live-build/ubuntu-server/hooks/032-installer-squashfs.binary @@ -53,6 +53,10 @@ EOF chroot $SQUASH_ROOT apt-get update chroot $SQUASH_ROOT apt-get -y install user-setup curtin lupin-casper +# For bug #1743643 "Install to dirty disk with swap fails" remove the +# "helpful" casper script that mounts any swap partitions it finds. +rm -f $SQUASH_ROOT/usr/share/initramfs-tools/scripts/casper-bottom/*swap + # Installing casper means we need a new initramfs UPDATE_INITRAMFS_OPTIONS=CASPER_GENERATE_UUID=1 recreate_initramfs $SQUASH_ROOT 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 index b8399cb6..bfa19a26 100644 --- 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 @@ -7,7 +7,9 @@ network: match: name: "en*" dhcp4: true + optional: true all-eth: match: name: "eth*" dhcp4: true + optional: true diff --git a/live-build/ubuntu-server/includes.binary/overlay/etc/systemd/system/snap.subiquity.started.service.d/no-reexec.conf b/live-build/ubuntu-server/includes.binary/overlay/etc/systemd/system/snap.subiquity.started.service.d/no-reexec.conf deleted file mode 100644 index 52bf88df..00000000 --- a/live-build/ubuntu-server/includes.binary/overlay/etc/systemd/system/snap.subiquity.started.service.d/no-reexec.conf +++ /dev/null @@ -1,3 +0,0 @@ -[Service] -RemainAfterExit=yes -Environment=SNAP_REEXEC=0 diff --git a/live-build/ubuntu-server/includes.binary/overlay/etc/systemd/system/snapd.refresh.timer b/live-build/ubuntu-server/includes.binary/overlay/etc/systemd/system/snapd.refresh.timer deleted file mode 120000 index dc1dc0cd..00000000 --- a/live-build/ubuntu-server/includes.binary/overlay/etc/systemd/system/snapd.refresh.timer +++ /dev/null @@ -1 +0,0 @@ -/dev/null \ No newline at end of file diff --git a/live-build/ubuntu-server/includes.binary/overlay/lib/systemd/system/snap.subiquity.subquity-service.d/subiquity.conf b/live-build/ubuntu-server/includes.binary/overlay/lib/systemd/system/snap.subiquity.subiquity-service.service.d/subiquity.conf similarity index 91% rename from live-build/ubuntu-server/includes.binary/overlay/lib/systemd/system/snap.subiquity.subquity-service.d/subiquity.conf rename to live-build/ubuntu-server/includes.binary/overlay/lib/systemd/system/snap.subiquity.subiquity-service.service.d/subiquity.conf index 9ae26356..f5da92cd 100644 --- a/live-build/ubuntu-server/includes.binary/overlay/lib/systemd/system/snap.subiquity.subquity-service.d/subiquity.conf +++ b/live-build/ubuntu-server/includes.binary/overlay/lib/systemd/system/snap.subiquity.subiquity-service.service.d/subiquity.conf @@ -4,6 +4,7 @@ After=systemd-user-sessions.service plymouth-quit-wait.service ConditionPathExists=!/run/subiquity/complete [Service] +Environment=SNAP_REEXEC=0 UtmpIdentifier=tty1 TTYPath=/dev/tty1 TTYReset=yes diff --git a/live-build/ubuntu-server/includes.binary/overlay/etc/systemd/system/snapd.service.d/no-reexec.conf b/live-build/ubuntu-server/includes.binary/overlay/lib/systemd/system/snapd.service.d/no-reexec.conf similarity index 100% rename from live-build/ubuntu-server/includes.binary/overlay/etc/systemd/system/snapd.service.d/no-reexec.conf rename to live-build/ubuntu-server/includes.binary/overlay/lib/systemd/system/snapd.service.d/no-reexec.conf