** Description changed: [Impact] This is a major rewrite of ubuntu-advantage-client. This version introduces an updated command line interface (UA Client) to simplify some interaction with Ubuntu Advantage support offerings, and interacts with a new service backend built specifically for this new streamlined experience. Disco, Eoan, and Focal already have this rewrite (but an older version of it), but trusty, xenial, bionic and cosmic do not. This update is for trusty only at the moment, because the other LTSs and later releases have other services available under the UA umbrella which haven't yet been fully converted to the new backend. [Test Case] There are free services available for Trusty and anyone with an ubuntu one account can try them out with the new client. - - In order to attach a machine to UA, first obtain a token at - https://auth.contracts.canonical.com/. With that token, attach the - machine with this command: + 1. + In order to attach a machine to UA, first obtain a token at https://auth.contracts.canonical.com/. With that token, attach the machine with this command: sudo ua attach <token> If that's successful, you will have ESM-infra enabled at the end. Additional test cases to confirm that the package correctly handles upgrades for all relevant cases: - - 2. Script reference https://gist.github.com/panlinux/4caaf069356da7436d97b47afce32234 - - a. Start with a fresh Ubuntu instance which does not have u-a-t installed (i.e. ubuntu-minimal is not installed). Install u-a-t from -updates. - Do not enable ua. Upgrade to u-a-t from -proposed. - b. In an identical instance, install u-a-t from -proposed. - c. Confirm that the on-disk results of a) and b) are identical. + 2. Script reference + https://gist.github.com/panlinux/4caaf069356da7436d97b47afce32234 + + a. Start with a fresh Ubuntu instance which does not have u-a-t installed (i.e. ubuntu-minimal is not installed). Install u-a-t from -updates. + Do not enable ua. Upgrade to u-a-t from -proposed. + b. In an identical instance, install u-a-t from -proposed. + c. Confirm that the on-disk results of a) and b) are identical. sudo su - # adjust if needed, i.e., point to a mirror export ARCHIVE_URL=http://br.archive.ubuntu.com/ubuntu export PROPOSED_REPO="deb $ARCHIVE_URL trusty-proposed main" mkdir /esm-sru cd /esm-sru truncate -s 10G file.img zpool create -O sync=disabled tank $(pwd)/file.img zfs create tank/trusty-minimal debootstrap --exclude=ubuntu-minimal trusty /tank/trusty-minimal $ARCHIVE_URL zfs snapshot tank/trusty-minimal@fresh # confirm no ubuntu-minimal nor ubuntu-advantage-tools chroot /tank/trusty-minimal dpkg -l | grep -E "(ubuntu-minimal|ubuntu-advantage)" # create a clone from trusty-minimal called trusty-2a zfs clone tank/trusty-minimal@fresh tank/trusty-2a # add extra pockets cat >> /tank/trusty-2a/etc/apt/sources.list <<EOF deb $ARCHIVE_URL trusty-updates main deb $ARCHIVE_URL trusty-security main EOF # install u-a-t from updates chroot /tank/trusty-2a/ apt-get update chroot /tank/trusty-2a/ apt-get install ubuntu-advantage-tools -y # upgrade to u-a-t from proposed cat > /tank/trusty-2a/etc/apt/sources.list.d/proposed.list <<EOF $PROPOSED_REPO EOF chroot /tank/trusty-2a/ apt-get update chroot /tank/trusty-2a/ apt-get install ubuntu-advantage-tools -y # clone the first fresh snapshot and call it trusty-2b zfs clone tank/trusty-minimal@fresh tank/trusty-2b # install u-a-t directly from proposed cat >> /tank/trusty-2b/etc/apt/sources.list <<EOF deb $ARCHIVE_URL trusty-updates main deb $ARCHIVE_URL trusty-security main EOF cat > /tank/trusty-2b/etc/apt/sources.list.d/proposed.list <<EOF $PROPOSED_REPO EOF chroot /tank/trusty-2b/ apt-get update chroot /tank/trusty-2b/ apt-get install ubuntu-advantage-tools -y # get files from both datasets, stripping the zfs prefix find /tank/trusty-2a/ | sed -r 's,^/tank/[^/]+,,' | sort > trusty-2a.list find /tank/trusty-2b/ | sed -r 's,^/tank/[^/]+,,' | sort > trusty-2b.list - 3. Script reference https://gist.github.com/panlinux/4843bfc1e726a3f006aa44190411d582 - a. Start with a fresh Ubuntu instance which does not have u-a-t installed (i.e. ubuntu-minimal is not installed). Install u-a-t from -updates. Enable esm with 'ubuntu-advantage enable-esm'. Upgrade to u-a-t from -proposed. - b. In an identical instance, install u-a-t from -proposed. Enable esm with 'ubuntu-advantage attach'. - c. Confirm that the on-disk results of a) and b) are identical. + a. Start with a fresh Ubuntu instance which does not have u-a-t installed (i.e. ubuntu-minimal is not installed). Install u-a-t from -updates. Enable esm with 'ubuntu-advantage enable-esm'. Upgrade to u-a-t from -proposed. + b. In an identical instance, install u-a-t from -proposed. Enable esm with 'ubuntu-advantage attach'. + c. Confirm that the on-disk results of a) and b) are identical. sudo su - # adjust if needed, i.e., point to a mirror export ARCHIVE_URL=http://br.archive.ubuntu.com/ubuntu export PROPOSED_REPO="deb $ARCHIVE_URL trusty-proposed main" # these are needed export LEGACY_ESM_TOKEN="user:password" export UA_CONTRACT_TOKEN="<token>" mkdir /esm-sru cd /esm-sru truncate -s 10G file.img zpool create -O sync=disabled tank $(pwd)/file.img zfs create tank/trusty-minimal debootstrap --exclude=ubuntu-minimal trusty /tank/trusty-minimal $ARCHIVE_URL zfs snapshot tank/trusty-minimal@fresh # confirm no ubuntu-minimal nor ubuntu-advantage-tools chroot /tank/trusty-minimal dpkg -l | grep -E "(ubuntu-minimal|ubuntu-advantage)" # create a clone from trusty-minimal called trusty-3a zfs clone tank/trusty-minimal@fresh tank/trusty-3a # add extra pockets cat >> /tank/trusty-3a/etc/apt/sources.list <<EOF deb $ARCHIVE_URL trusty-updates main deb $ARCHIVE_URL trusty-security main EOF # install u-a-t from updates chroot /tank/trusty-3a/ apt-get update chroot /tank/trusty-3a/ apt-get install ubuntu-advantage-tools -y # enable esm chroot /tank/trusty-3a/ ubuntu-advantage enable-esm "$LEGACY_ESM_TOKEN" # upgrade to u-a-t from proposed cat > /tank/trusty-3a/etc/apt/sources.list.d/proposed.list <<EOF $PROPOSED_REPO EOF chroot /tank/trusty-3a/ apt-get update chroot /tank/trusty-3a/ apt-get install ubuntu-advantage-tools -y # clone the first fresh snapshot and call it trusyt-3b zfs clone tank/trusty-minimal@fresh tank/trusty-3b # install u-a-t directly from proposed cat >> /tank/trusty-3b/etc/apt/sources.list <<EOF deb $ARCHIVE_URL trusty-updates main deb $ARCHIVE_URL trusty-security main EOF cat > /tank/trusty-3b/etc/apt/sources.list.d/proposed.list <<EOF $PROPOSED_REPO EOF chroot /tank/trusty-3b/ apt-get update chroot /tank/trusty-3b/ apt-get install ubuntu-advantage-tools -y # with the new u-a-t from proposed, run attach, which also enables esm chroot /tank/trusty-3b/ ua attach $UA_CONTRACT_TOKEN # get files from both datasets, stripping the zfs prefix find /tank/trusty-3a/ | sed -r 's,^/tank/[^/]+,,' | sort > trusty-3a.list find /tank/trusty-3b/ | sed -r 's,^/tank/[^/]+,,' | sort > trusty-3b.list - 4.Script reference https://gist.github.com/blackboxsw/0e968aeabd42c23df619d29c7906c76e - 4a. Start with a fresh Ubuntu instance which does have u-a-t installed. Enable esm with 'ubuntu-advantage enable-esm'. Upgrade to u-a-t from -proposed. - 4b. In an identical instance, upgrade to u-a-t from -proposed. Enable esm with 'ubuntu-advantage attach'. - 4c. Confirm that the on-disk results of a) and b) are identical other than legacyToken|contractToken + 4a. Start with a fresh Ubuntu instance which does have u-a-t installed. Enable esm with 'ubuntu-advantage enable-esm'. Upgrade to u-a-t from -proposed. + 4b. In an identical instance, upgrade to u-a-t from -proposed. Enable esm with 'ubuntu-advantage attach'. + 4c. Confirm that the on-disk results of a) and b) are identical other than legacyToken|contractToken export LEGACY_ESM_TOKEN=<ppauser:password> export UA_CONTRACT_TOKEN=<NewContractToken> export ARCHIVE_URL=http://archive.ubuntu.com/ubuntu echo -- BEGIN test 4a: enable esm via `ubuntu-advantage enable-esm` on typical trusty-updates cloud-images which already have -updates installed # Launch a basic trusty cloud-image that is updated to latest ubuntu-advantage-tools from -updates cat > update-uat-trusty.yaml <<EOF #cloud-config package_update: true package_upgrade: true runcmd: - - apt-get install -qy ubuntu-advantage-tools + - apt-get install -qy ubuntu-advantage-tools EOF lxc launch ubuntu-daily:trusty esm-sru-4a -c user.user-data="$(cat update-uat-trusty.yaml)" echo "Wait for cloud-init to finish startup on trusty" RUNLEVEL="NOTSET" while ! [ "N 2" = "$RUNLEVEL" ]; do echo -n '.'; sleep 1; RUNLEVEL=`lxc exec esm-sru-4a runlevel`; done; echo mkdir /esm-sru cd /esm-sru mkdir 4a 4b echo "Confirm u-a-t is already installed" lxc exec esm-sru-4a -- apt-cache policy ubuntu-advantage-tools cat > ppa-key << EOF -----BEGIN PGP PUBLIC KEY BLOCK----- xo0EUs00cgEEAJJqaPue5gzQiLB1krT9slYbqVW/bSBpW9+qX8gFI44IVM/Bo3yh 9BPAs1RAzja96N0FS6SNlew4JYfk7MBT2sFDGpm3bTKt9Go7muO0JkvKv0vYgrrw qORlWK3SfsYa6EpsCdVzZPAKvGzc8I0XywVgcJhM5okx+3J2naBaSp9NABEBAAHN K0xhdW5jaHBhZCBQUEEgZm9yIENJIFRyYWluIFBQQSBTZXJ2aWNlIFRlYW3CuAQT AQIAIgUCUs00cgIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQhVBBKOzx IEy62gP/T2h98ongV+RXekM1DpgTNoH0PBHrZVj4zfrvrYKZOaxRmJ6TWtzG8tFI uB4gPjaFeenJBhCFaZ9UncFQemS9jztQ/pA049L1N7Tijd8/BKD7gc7tM07+Fq+Q 6DT7VuUFiVlfZUwWYzk5UXEk6ctluoIRpnRWUHmh6NssuAgd1Nk= =aPbC -----END PGP PUBLIC KEY BLOCK----- EOF # emit script to upgrade u-a-t cat > add_uat_apt_pocket.sh << EOF #/bin/bash pocket_name=\$1 if [ "\$pocket_name" = "devel" ]; then - echo deb [trusted=yes] http://ppa.launchpad.net/ci-train-ppa-service/3830/ubuntu trusty main | tee /etc/apt/sources.list.d/\$pocket_name.list - apt-key add /ppa-key + echo deb [trusted=yes] http://ppa.launchpad.net/ci-train-ppa-service/3830/ubuntu trusty main | tee /etc/apt/sources.list.d/\$pocket_name.list + apt-key add /ppa-key else - echo deb $ARCHIVE_URL \$pocket_name main | tee /etc/apt/sources.list.d/\$pocket_name.list + echo deb $ARCHIVE_URL \$pocket_name main | tee /etc/apt/sources.list.d/\$pocket_name.list fi EOF lxc file push ppa-key esm-sru-4a/ lxc file push add_uat_apt_pocket.sh esm-sru-4a/ lxc exec esm-sru-4a chmod 755 /add_uat_apt_pocket.sh echo "Make a pristine lxc snapshot for 4a and 4b" lxc snapshot esm-sru-4a esm-sru-4a-pristine echo "Enable esm via ubuntu-advantage enable-esm" lxc exec esm-sru-4a -- ubuntu-advantage enable-esm $LEGACY_ESM_TOKEN echo "Confirm ansible is available for esm PPA" lxc exec esm-sru-4a apt-cache policy ansible echo "Upgrade u-a-t to trusty-proposed" lxc exec esm-sru-4a /add_uat_apt_pocket.sh trusty-proposed # or devel lxc exec esm-sru-4a -- apt-get update -q; lxc exec esm-sru-4a -- apt-get install -qy ubuntu-advantage-tools; echo "Confirm ansible is available for esm PPA" lxc exec esm-sru-4a apt-cache policy ansible lxc exec esm-sru-4a -- find / -xdev | sort > 4a/files.list lxc file pull -r esm-sru-4a/etc 4a/ - echo -- BEGIN test 4b: upgrade u-a-t to -proposed version on typical trusty-updates cloud-images which already have -updates installed lxc restore esm-sru-4a esm-sru-4a-pristine echo "Confirm u-a-t is already installed from trusty-updates v. 10ubuntu0.14.04.4" lxc exec esm-sru-4a -- apt-cache policy ubuntu-advantage-tools echo "Upgrade u-a-t to trusty-proposed" lxc exec esm-sru-4a /add_uat_apt_pocket.sh trusty-proposed # or devel lxc exec esm-sru-4a -- apt-get update -q; lxc exec esm-sru-4a -- apt-get install -qy ubuntu-advantage-tools; echo "Enable esm via: ua attach <contractToken>" lxc exec esm-sru-4a ua attach $UA_CONTRACT_TOKEN echo "Confirm ansible is available for esm PPA" lxc exec esm-sru-4a apt-cache policy ansible lxc exec esm-sru-4a -- find / -xdev | sort > 4b/files.list lxc file pull -r esm-sru-4a/etc 4b/ echo --- BEGIN test 4c: ensure no filesystem diffs between 4a and 4b with exception of token used diff -urN 4a 4b - - 5. Script reference https://gist.github.com/panlinux/e5bda289401660d77ed5eff4d980c30c + 5. Script reference + https://gist.github.com/panlinux/e5bda289401660d77ed5eff4d980c30c a. Start with a fresh Ubuntu *precise* instance which does have u-a-t installed and esm enabled. Dist-upgrade to trusty, then upgrade to u-a-t from -proposed. echo --- BEGIN test 5a: dist-upgrade an esm-enable precise-updates to trusty-updates, then upgrade to -proposed mkdir -p 5a/var/lib/ echo "Launch precise container with allowing ssh access for <LP_ID>" cat >precise.yaml <<EOF #cloud-config ssh_import_id: [<LP_ID>] EOF lxc launch ubuntu-daily:precise sru-precise -c user.user-data="$(cat precise.yaml)" echo "Enable esm on precise" lxc exec sru-precise ubuntu-advantage enable-esm <legacyToken> echo "Dist-upgrade precise -> trusty" VM_IP=`lxc list dev-p -c 4 | awk '/10/{print $2}'` ssh ubuntu@$VM_IP sudo mkdir -p /etc/update-manager/release-upgrades.d echo -e "[Sources]\nAllowThirdParty=yes" > allow.cfg sudo mv allow.cfg /etc/update-manager/release-upgrades.d sudo do-release-upgrade # respond yes to any interactive prompts echo "Confirm ansible is available for trusty esm PPA" apt-cache policy ansible echo "Upgrade u-a-t to trusty-proposed" lxc file push ua_tools_install_from_pocket.sh sru-precise/ lxc exec sru-precise "bash /ua_tools_install_from_pocket.sh trusty-proposed" lxc exec sru-precise -- dpkg -l > 5a/dpkg.list lxc file pull -r sru-precise/etc 5a/ lxc file pull -r sru-precise/var/lib/ubuntu-advantage 5a/var/lib lxc stop sru-precise lxc delete sru-precise b. In an identical instance, dist-upgrade to trusty with -proposed enabled. echo --- BEGIN test 5b: dist-upgrade an esm-enable precise-proposed to trusty-proposed mkdir -p 5b/var/lib/ echo "Launch precise container with allowing ssh access for <LP_ID>" cat >precise.yaml <<EOF #cloud-config ssh_import_id: [<LP_ID>] EOF lxc launch ubuntu-daily:precise sru-precise -c user.user-data="$(cat precise.yaml)" echo "Enable esm on precise" lxc exec sru-precise ubuntu-advantage enable-esm <legacyToken> echo "Upgrade u-a-t to precise-proposed" # no-op lxc file push ua_tools_install_from_pocket.sh sru-precise/ lxc exec sru-precise "bash /ua_tools_install_from_pocket.sh sru-proposed" lxc exec sru-precise "apt-get dist-upgrade" echo "Dist-upgrade precise-proposed -> trusty-proposed" VM_IP=`lxc list dev-p -c 4 | awk '/10/{print $2}'` ssh ubuntu@$VM_IP sudo mkdir -p /etc/update-manager/release-upgrades.d echo -e "[Sources]\nAllowThirdParty=yes" > allow.cfg sudo mv allow.cfg /etc/update-manager/release-upgrades.d sudo do-release-upgrade # respond yes to any interactive prompts echo "Confirm ansible is available for trusty esm PPA" apt-cache policy ansible lxc exec sru-precise -- dpkg -l > 5b/dpkg.list lxc file pull -r sru-precise/etc 5b/ lxc file pull -r sru-precise/var/lib/ubuntu-advantage 5b/var/lib lxc stop sru-precise lxc delete sru-precise c. Confirm that the on-disk results of a) and b) are identical. echo --- BEGIN test 5c: confirm filesytem changes of test 5a and 5b are identical dirr -urN 5a 5b [Regression Potential] This is a major rewrite from bash to python3 and there are changes in behavior. - new services will be listed, but not avaialble for trusty, only for later LTSs - even when ESM is not enabled, an apt hook will advertise the availability of updates in that repository. This hook has failed in the past while this package was in disco, and that failed the apt transaction. This has of course been fixed since then (see #1824523 and #1824523). [Other Info] This is the FFe bug that got this rewrite into Disco at that time: https://bugs.launchpad.net/ubuntu/+source/ubuntu-advantage-tools/+bug/1814157 Development of this client is happening on github: https://github.com/CanonicalLtd/ubuntu-advantage-client Recently esm was renamed to esm-infra. Upgrading from an older package where it was just "esm" is handled in postinst. The ESM-infra GPG key can be verified by checking the signed release file over https: ESM: https://esm.ubuntu.com/ubuntu/dists/trusty-infra-updates/InRelease and https://esm.ubuntu.com/ubuntu/dists/trusty-infra-security/InRelease On an upgrade, existing users of trusty esm are expected to run "sudo ua attach [<token>]", although not doing it won't disable their existing ESM access. The new ua tool just won't recognize esm as being active in its "ua status" output until the attach operation is complete. The same applies to livepatch, if it was enabled before.
-- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1832757 Title: Update ubuntu-advantage-client To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/ubuntu-advantage-tools/+bug/1832757/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs