[Bug 1822340] Re: [UIFe] motd messaging rewrite

Chad Smith 1822340 at bugs.launchpad.net
Mon Jan 4 18:28:59 UTC 2021


Xenial and Bionic SRU verification SUCCESS for MOTD messaging changes

--- BEGIN xenial update-notifier testing
--- Launch cloud-init with ppa:ua-client/proposed enabled
Creating test-sru-xenial
Starting test-sru-xenial
--- Wait for cloud-init to finish
........................................................................
status: done
time: Mon, 04 Jan 2021 18:18:43 +0000
detail:
DataSourceNoCloud [seed=/var/lib/cloud/seed/nocloud-net][dsmode=net]
--- Attach Ubuntu-Advantage, enabling services
Enabling default service esm-infra
Updating package lists
ESM Infra enabled
This machine is now attached to 'chad.smith at canonical.com'

SERVICE       ENTITLED  STATUS    DESCRIPTION
esm-infra     yes       enabled   UA Infra: Extended Security Maintenance (ESM)
livepatch     yes       n/a       Canonical Livepatch service

Enable services with: ua enable <service>

     Account: chad.smith at canonical.com
Subscription: chad.smith at canonical.com
-- Downgrading package to stable ubuntu release libkrad0=1.13.2+dfsg-5
Reading package lists...
Building dependency tree...
Reading state information...
The following package was automatically installed and is no longer required:
  libfreetype6
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
  libverto-libevent1 libverto1
The following NEW packages will be installed:
  libkrad0 libverto-libevent1 libverto1
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 36.1 kB of archives.
After this operation, 207 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 libverto-libevent1 amd64 0.2.4-2.1ubuntu2 [5742 B]
Get:2 http://archive.ubuntu.com/ubuntu xenial/main amd64 libverto1 amd64 0.2.4-2.1ubuntu2 [9132 B]
Get:3 http://archive.ubuntu.com/ubuntu xenial/main amd64 libkrad0 amd64 1.13.2+dfsg-5 [21.3 kB]
Fetched 36.1 kB in 0s (50.5 kB/s)
Selecting previously unselected package libverto-libevent1:amd64.
(Reading database ... 25866 files and directories currently installed.)
Preparing to unpack .../libverto-libevent1_0.2.4-2.1ubuntu2_amd64.deb ...
Unpacking libverto-libevent1:amd64 (0.2.4-2.1ubuntu2) ...
Selecting previously unselected package libverto1:amd64.
Preparing to unpack .../libverto1_0.2.4-2.1ubuntu2_amd64.deb ...
Unpacking libverto1:amd64 (0.2.4-2.1ubuntu2) ...
Selecting previously unselected package libkrad0:amd64.
Preparing to unpack .../libkrad0_1.13.2+dfsg-5_amd64.deb ...
Unpacking libkrad0:amd64 (1.13.2+dfsg-5) ...
Processing triggers for libc-bin (2.23-0ubuntu11.2) ...
Setting up libverto-libevent1:amd64 (0.2.4-2.1ubuntu2) ...
Setting up libverto1:amd64 (0.2.4-2.1ubuntu2) ...
Setting up libkrad0:amd64 (1.13.2+dfsg-5) ...
Processing triggers for libc-bin (2.23-0ubuntu11.2) ...
update-notifier	
Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:2 http://ppa.launchpad.net/ua-client/staging/ubuntu xenial InRelease
Hit:3 http://archive.ubuntu.com/ubuntu xenial-backports InRelease       
Get:4 https://esm.ubuntu.com/infra/ubuntu xenial-infra-security InRelease [7458 B]
Get:5 https://esm.ubuntu.com/infra/ubuntu xenial-infra-updates InRelease [7457 B]
Fetched 14.9 kB in 0s (20.2 kB/s)                            
Reading package lists... Done
2 packages can be updated. 0 updates are security updates.
SUCCESS: did not find UA Infra: Extended Security Maintenance (ESM) is enabled
SUCCESS: found 0 updates are security updates security updates pre-upgrade
--- Upgrade update-notifier from -proposed
  update-notifier-common
Get:1 http://archive.ubuntu.com/ubuntu xenial-proposed/main amd64 update-notifier-common all 3.168.13 [133 kB]
dpkg-preconfigure: unable to re-open stdin: No such file or directory
Preparing to unpack .../update-notifier-common_3.168.13_all.deb ...
Unpacking update-notifier-common (3.168.13) over (3.168.10) ...
Setting up update-notifier-common (3.168.13) ...
update-notifier	
SUCCESS: found UA Infra: Extended Security Maintenance (ESM) is enabled
--- Expect non-zero upgradable packages for MOTD from apt_check AFTER upgrade
UA Infra: Extended Security Maintenance (ESM) is enabled.

6 packages can be updated.
1 of these updates is fixed through UA Infra: ESM.
1 of these updates is a security update.
To see these additional updates run: apt list --upgradable
1 of these updates is a security update.
SUCCESS: found 1 ESM security updates post-upgrade
--- BEGIN bionic update-notifier testing
--- Launch cloud-init with ppa:ua-client/proposed enabled
Creating test-sru-bionic
Starting test-sru-bionic
--- Wait for cloud-init to finish
...........................................................................................................
status: done
time: Mon, 04 Jan 2021 18:19:42 +0000
detail:
DataSourceNoCloud [seed=/var/lib/cloud/seed/nocloud-net][dsmode=net]
--- Attach Ubuntu-Advantage, enabling services
Enabling default service esm-infra
Updating package lists
ESM Infra enabled
A reboot is required to complete install
This machine is now attached to 'chad.smith at canonical.com'

SERVICE       ENTITLED  STATUS    DESCRIPTION
esm-infra     yes       enabled   UA Infra: Extended Security Maintenance (ESM)
livepatch     yes       n/a       Canonical Livepatch service

Enable services with: ua enable <service>

     Account: chad.smith at canonical.com
Subscription: chad.smith at canonical.com
-- Downgrading package to stable ubuntu release libkrad0=1.16-2build1
Reading package lists...
Building dependency tree...
Reading state information...
The following package was automatically installed and is no longer required:
  libfreetype6
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
  libverto-libevent1 libverto1
The following NEW packages will be installed:
  libkrad0 libverto-libevent1 libverto1
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 36.3 kB of archives.
After this operation, 214 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 libverto-libevent1 amd64 0.2.4-2.1ubuntu3 [5796 B]
Get:2 http://archive.ubuntu.com/ubuntu bionic/main amd64 libverto1 amd64 0.2.4-2.1ubuntu3 [9090 B]
Get:3 http://archive.ubuntu.com/ubuntu bionic/main amd64 libkrad0 amd64 1.16-2build1 [21.4 kB]
Fetched 36.3 kB in 1s (46.2 kB/s)
Selecting previously unselected package libverto-libevent1:amd64.
(Reading database ... 28800 files and directories currently installed.)
Preparing to unpack .../libverto-libevent1_0.2.4-2.1ubuntu3_amd64.deb ...
Unpacking libverto-libevent1:amd64 (0.2.4-2.1ubuntu3) ...
Selecting previously unselected package libverto1:amd64.
Preparing to unpack .../libverto1_0.2.4-2.1ubuntu3_amd64.deb ...
Unpacking libverto1:amd64 (0.2.4-2.1ubuntu3) ...
Selecting previously unselected package libkrad0:amd64.
Preparing to unpack .../libkrad0_1.16-2build1_amd64.deb ...
Unpacking libkrad0:amd64 (1.16-2build1) ...
Setting up libverto-libevent1:amd64 (0.2.4-2.1ubuntu3) ...
Setting up libverto1:amd64 (0.2.4-2.1ubuntu3) ...
Setting up libkrad0:amd64 (1.16-2build1) ...
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...
update-notifier	
1 package can be updated. 1 update is a security update.
SUCCESS: did not find UA Infra: Extended Security Maintenance (ESM) is enabled
SUCCESS: found 1 update is a security update security updates pre-upgrade
--- Upgrade update-notifier from -proposed
  update-notifier-common
Get:1 http://archive.ubuntu.com/ubuntu bionic-proposed/main amd64 update-notifier-common all 3.192.1.9 [132 kB]
dpkg-preconfigure: unable to re-open stdin: No such file or directory
Preparing to unpack .../update-notifier-common_3.192.1.9_all.deb ...
Unpacking update-notifier-common (3.192.1.9) over (3.192.1.7) ...
Setting up update-notifier-common (3.192.1.9) ...
update-notifier	
SUCCESS: found UA Infra: Extended Security Maintenance (ESM) is enabled
--- Expect non-zero upgradable packages for MOTD from apt_check AFTER upgrade
UA Infra: Extended Security Maintenance (ESM) is enabled.

15 packages can be updated.
1 of these updates is a security update.
To see these additional updates run: apt list --upgradable
1 of these updates is a security update.
SUCCESS: found 1 ESM security updates post-upgrade


** Description changed:

  [Impact]
  Changes to the motd and update counting to count ESM security upgrades as security upgrades, and show some information about ESM upgrades.
  
  [Test case]
  The motd output has unit tests for the various combinations, passing counts of various upgrade types. That said, the actual counting might be wrong.
  
  The regression potential is higher in releases with ESM, as they'll get
  more messages and have more stuff that could go wrong.
  
- 
  #!/bin/bash
- 
  #
  # SRU Verification update-notifier + ubuntu=advantage-tools
  # Test procedure:
  # - launch container Trusty, Xenial or Bionic
  # - Install ubuntu-advantage-tools from https://launchpad.net/~ua-client/+archive/ubuntu/proposed which supports esm on trusty, xenial, bionic, and focal
  # - Attach container to UA subscription (which activates the ESM APT repos
  # - run apt_check --human-readable to assert ESM pkg counts ARE NOT reported
  # - Upgrade update-notifier to -proposed
  # - re-run apt_check --human-readable to assert ESM pkg counts ARE reported
  
  set -e
  UA_TOKEN=$1
  if [ -z "$1" ]; then
   echo "Usage: $0 <contractTOKEN>"
   exit 1
  fi
- # sources:
- #   ua.proposed:
- #      source: deb http://ppa.launchpad.net/canonical-server/ua-client-daily/ubuntu \$RELEASE main
- #      keyid: 94E187AD53A59D1847E4880F8A295C4FB8B190B7
  
- cat > test-uru.yaml <<EOF
+ cat > test-un.yaml <<EOF
  #cloud-config
  ssh_import_id: [chad.smith]
  package_update: true
  package_upgrade: true
  apt:
    sources:
-       ua.proposed: deb http://ppa.launchpad.net/ua-client/proposed/ubuntu \$RELEASE main
-       keyid: 6E34E7116C0BC933
+       ua.proposed:
+           source: deb http://ppa.launchpad.net/ua-client/staging/ubuntu \$RELEASE main
+           keyid: 6E34E7116C0BC933
  EOF
  
- 
- 
- cat > setup_proposed.sh <<EOF                                                   
- #/bin/bash                                                                      
- mirror=http://archive.ubuntu.com/ubuntu                                         
+ cat > setup_proposed.sh <<EOF
+ #/bin/bash
+ mirror=http://archive.ubuntu.com/ubuntu
  echo deb \$mirror \$(lsb_release -sc)-proposed main | tee /etc/apt/sources.list.d/proposed.list
- apt-get update -q                                                               
- apt-get install -qy update-notifier
- EOF   
+ apt-get update -q
+ apt-get install -qy update-notifier-common
+ EOF
  
  wait_for_boot() {
    local vm=$1 release=$2
    echo "--- Wait for cloud-init to finish"
    sleep 5
-     lxc exec ${vm} -- cloud-init status --wait --long                           
+     lxc exec ${vm} -- cloud-init status --wait --long
  }
  
- for release in xenial bionic focal; do
+ for release in xenial bionic; do
    echo "--- BEGIN $release update-notifier testing"
    vm=test-sru-$release
    echo "--- Launch cloud-init with ppa:ua-client/proposed enabled"
    lxc launch ubuntu-daily:${release} ${vm} -c user.user-data="$(cat test-un.yaml)"
    wait_for_boot ${vm} ${release}
    echo "--- Attach Ubuntu-Advantage, enabling services"
    lxc exec ${vm} -- ua attach ${UA_TOKEN}
-   echo "--- Check Original MOTD output from apt_check before upgrade"
-   lxc exec ${vm} -- /usr/lib/update-notifier/apt-check --human-readable
+   case "$release" in
+         xenial) 
+             UPGRADE_MATCH="0 updates are security updates";
+             downrev_pkg="libkrad0=1.13.2+dfsg-5";;
+         bionic)
+             UPGRADE_MATCH="1 update is a security update"
+             downrev_pkg="libkrad0=1.16-2build1";;
+         focal)
+             UPGRADE_MATCH="0 updates are security updates"
+             downrev_pkg="hello=2.10-2ubuntu2";;
+         groovy)
+             UPGRADE_MATCH="1 of these updates is a security update"
+             downrev_pkg="apport-retrace=2.20.11-0ubuntu50";;
+   esac
+   echo "-- Downgrading package to stable ubuntu release $downrev_pkg"
+   lxc exec ${vm} -- apt-get install $downrev_pkg --yes -q
+   lxc exec ${vm} -- dpkg-query --show update-notifier
+   if [ "$release" = "xenial" ]; then
+       # Xenial-updates have already included esm package updates.
+       # Drop the xenial-updates apt source so we can be sure we are seeing only
+       # available esm updates
+       lxc exec ${vm} -- sed -e "/xenial-updates/ s/^#*/#/" -i /etc/apt/sources.list
+       lxc exec ${vm} -- sed -e "/xenial-security/ s/^#*/#/" -i /etc/apt/sources.list
+       lxc exec ${vm} -- apt-get update
+   fi
+   MOTD=`lxc exec ${vm} -- /usr/lib/update-notifier/apt-check --human-readable`
+   echo ${MOTD}
+   POST_UPGRADE_MSG="UA Infra: Extended Security Maintenance (ESM) is enabled"
+   echo $MOTD | grep -q "${POST_UPGRADE_MSG}" && echo "FAILURE: found ${POST_UPGRADE_MSG}" ||  echo "SUCCESS: did not find ${POST_UPGRADE_MSG=}"
+   echo $MOTD | grep -q "${UPGRADE_MATCH}" && echo "SUCCESS: found ${UPGRADE_MATCH} security updates pre-upgrade" || echo "FAILURE: did not find expected ${UPGRADE_MATCH} ESM security updates"
    echo "--- Upgrade update-notifier from -proposed"
    lxc file push setup_proposed.sh ${vm}/
-   lxc exec ${vm} -- bash /setup-proposed.sh | grep update-notifier
-   echo "--- Check upadate-notifier(-proposed) MOTD output from apt_check after upgrade"
+   lxc exec ${vm} -- bash /setup_proposed.sh | grep update-notifier
+   lxc exec ${vm} -- dpkg-query --show update-notifier
+    MOTD=`lxc exec ${vm} -- /usr/lib/update-notifier/apt-check --human-readable`
+   echo $MOTD | grep -q "${POST_UPGRADE_MSG}" && echo "SUCCESS: found ${POST_UPGRADE_MSG}" ||  echo "FAILURE: did not find ${POST_UPGRADE_MSG=}"
+   echo "--- Expect non-zero upgradable packages for MOTD from apt_check AFTER upgrade"
    lxc exec ${vm} -- /usr/lib/update-notifier/apt-check --human-readable
+   lxc exec ${vm} -- /usr/lib/update-notifier/apt-check --human-readable | grep '1 of these updates is a security update' && echo "SUCCESS: found 1 ESM security updates post-upgrade" || echo "FAILURE: did not find expected 1 ESM security updates post-upgrade"
  done
  
  
  [Regression potential]
  Potentially wrong reporting, lost translations.
  
  [disco UIFe]
  https://lists.ubuntu.com/archives/ubuntu-translators/2019-April/007534.html
  ubuntu-doc held for moderation
  
  [SRU]
  We're only SRUing this to trusty, as xenial and bionic will have some more changes, and it would just be a waste of time to SRU the trusty one there.

** Tags removed: verification-needed verification-needed-bionic verification-needed-xenial
** Tags added: verification-done verification-done-bionic verification-done-xenial

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to update-notifier in Ubuntu.
https://bugs.launchpad.net/bugs/1822340

Title:
  [UIFe] motd messaging rewrite

Status in update-notifier package in Ubuntu:
  Fix Released
Status in update-notifier source package in Trusty:
  Fix Released
Status in update-notifier source package in Xenial:
  Fix Committed
Status in update-notifier source package in Bionic:
  Fix Committed

Bug description:
  [Impact]
  Changes to the motd and update counting to count ESM security upgrades as security upgrades, and show some information about ESM upgrades.

  [Test case]
  The motd output has unit tests for the various combinations, passing counts of various upgrade types. That said, the actual counting might be wrong.

  The regression potential is higher in releases with ESM, as they'll
  get more messages and have more stuff that could go wrong.

  #!/bin/bash
  #
  # SRU Verification update-notifier + ubuntu=advantage-tools
  # Test procedure:
  # - launch container Trusty, Xenial or Bionic
  # - Install ubuntu-advantage-tools from https://launchpad.net/~ua-client/+archive/ubuntu/proposed which supports esm on trusty, xenial, bionic, and focal
  # - Attach container to UA subscription (which activates the ESM APT repos
  # - run apt_check --human-readable to assert ESM pkg counts ARE NOT reported
  # - Upgrade update-notifier to -proposed
  # - re-run apt_check --human-readable to assert ESM pkg counts ARE reported

  set -e
  UA_TOKEN=$1
  if [ -z "$1" ]; then
   echo "Usage: $0 <contractTOKEN>"
   exit 1
  fi

  cat > test-un.yaml <<EOF
  #cloud-config
  ssh_import_id: [chad.smith]
  package_update: true
  package_upgrade: true
  apt:
    sources:
        ua.proposed:
            source: deb http://ppa.launchpad.net/ua-client/staging/ubuntu \$RELEASE main
            keyid: 6E34E7116C0BC933
  EOF

  cat > setup_proposed.sh <<EOF
  #/bin/bash
  mirror=http://archive.ubuntu.com/ubuntu
  echo deb \$mirror \$(lsb_release -sc)-proposed main | tee /etc/apt/sources.list.d/proposed.list
  apt-get update -q
  apt-get install -qy update-notifier-common
  EOF

  wait_for_boot() {
    local vm=$1 release=$2
    echo "--- Wait for cloud-init to finish"
    sleep 5
      lxc exec ${vm} -- cloud-init status --wait --long
  }

  for release in xenial bionic; do
    echo "--- BEGIN $release update-notifier testing"
    vm=test-sru-$release
    echo "--- Launch cloud-init with ppa:ua-client/proposed enabled"
    lxc launch ubuntu-daily:${release} ${vm} -c user.user-data="$(cat test-un.yaml)"
    wait_for_boot ${vm} ${release}
    echo "--- Attach Ubuntu-Advantage, enabling services"
    lxc exec ${vm} -- ua attach ${UA_TOKEN}
    case "$release" in
          xenial) 
              UPGRADE_MATCH="0 updates are security updates";
              downrev_pkg="libkrad0=1.13.2+dfsg-5";;
          bionic)
              UPGRADE_MATCH="1 update is a security update"
              downrev_pkg="libkrad0=1.16-2build1";;
          focal)
              UPGRADE_MATCH="0 updates are security updates"
              downrev_pkg="hello=2.10-2ubuntu2";;
          groovy)
              UPGRADE_MATCH="1 of these updates is a security update"
              downrev_pkg="apport-retrace=2.20.11-0ubuntu50";;
    esac
    echo "-- Downgrading package to stable ubuntu release $downrev_pkg"
    lxc exec ${vm} -- apt-get install $downrev_pkg --yes -q
    lxc exec ${vm} -- dpkg-query --show update-notifier
    if [ "$release" = "xenial" ]; then
        # Xenial-updates have already included esm package updates.
        # Drop the xenial-updates apt source so we can be sure we are seeing only
        # available esm updates
        lxc exec ${vm} -- sed -e "/xenial-updates/ s/^#*/#/" -i /etc/apt/sources.list
        lxc exec ${vm} -- sed -e "/xenial-security/ s/^#*/#/" -i /etc/apt/sources.list
        lxc exec ${vm} -- apt-get update
    fi
    MOTD=`lxc exec ${vm} -- /usr/lib/update-notifier/apt-check --human-readable`
    echo ${MOTD}
    POST_UPGRADE_MSG="UA Infra: Extended Security Maintenance (ESM) is enabled"
    echo $MOTD | grep -q "${POST_UPGRADE_MSG}" && echo "FAILURE: found ${POST_UPGRADE_MSG}" ||  echo "SUCCESS: did not find ${POST_UPGRADE_MSG=}"
    echo $MOTD | grep -q "${UPGRADE_MATCH}" && echo "SUCCESS: found ${UPGRADE_MATCH} security updates pre-upgrade" || echo "FAILURE: did not find expected ${UPGRADE_MATCH} ESM security updates"
    echo "--- Upgrade update-notifier from -proposed"
    lxc file push setup_proposed.sh ${vm}/
    lxc exec ${vm} -- bash /setup_proposed.sh | grep update-notifier
    lxc exec ${vm} -- dpkg-query --show update-notifier
     MOTD=`lxc exec ${vm} -- /usr/lib/update-notifier/apt-check --human-readable`
    echo $MOTD | grep -q "${POST_UPGRADE_MSG}" && echo "SUCCESS: found ${POST_UPGRADE_MSG}" ||  echo "FAILURE: did not find ${POST_UPGRADE_MSG=}"
    echo "--- Expect non-zero upgradable packages for MOTD from apt_check AFTER upgrade"
    lxc exec ${vm} -- /usr/lib/update-notifier/apt-check --human-readable
    lxc exec ${vm} -- /usr/lib/update-notifier/apt-check --human-readable | grep '1 of these updates is a security update' && echo "SUCCESS: found 1 ESM security updates post-upgrade" || echo "FAILURE: did not find expected 1 ESM security updates post-upgrade"
  done

  
  [Regression potential]
  Potentially wrong reporting, lost translations.

  [disco UIFe]
  https://lists.ubuntu.com/archives/ubuntu-translators/2019-April/007534.html
  ubuntu-doc held for moderation

  [SRU]
  We're only SRUing this to trusty, as xenial and bionic will have some more changes, and it would just be a waste of time to SRU the trusty one there.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/update-notifier/+bug/1822340/+subscriptions



More information about the foundations-bugs mailing list