← Back to team overview

group.of.nepali.translators team mailing list archive

[Bug 2006508] Re: /usr/lib/ubuntu-advantage/esm_cache.py:RuntimeError:/usr/lib/ubuntu-advantage/esm_cache.py@22:main:update_esm_caches:is_current_series_lts:get_platform_info

 

This bug was fixed in the package ubuntu-advantage-tools -
27.13.5~22.10.1

---------------
ubuntu-advantage-tools (27.13.5~22.10.1) kinetic; urgency=medium

  * Backport new upstream release

ubuntu-advantage-tools (27.13.5~23.04.1) lunar; urgency=medium

  * d/ubuntu-advantage-tools.postinst:
    - fix version for cleaning the esm-apps stale unauthenticated files
      (LP: #2006765)

ubuntu-advantage-tools (27.13.4~23.04.1) lunar; urgency=medium

  * d/ubuntu-advantage-tools.postinst:
    - remove stale esm-apps unauthenticated caches (LP: #2004193)
  * apt-hook:
    - Change esm-apps advertisement message on apt upgrade to
      make it clearer that the service is providing more upgrades
      and not restricting user to only get updates if esm-apps
      is enabled (LP: #2006510)
  * contract:
    - make code aware that the effective date is not a required field
      in the machine-token.json file (LP: #2006351)
  * esm_cache
    - do not fail if we cannot extract information from
      /etc/os-release file (LP: #2006508)
  * security-status:
    -  consider packages without a candidate as 'unknown' (LP: #2006049)
  * status:
    - treat null effective contract dates as unknown/expired
      (LP: #2004650)
  * timer:
    - recycle invalid jobs-status.json file if we detect it is
      corrupted (LP: #2006261)

 -- Renan Rodrigo <renanrodrigo@xxxxxxxxxxxxx>  Thu, 09 Feb 2023
14:36:17 -0300

** Changed in: ubuntu-advantage-tools (Ubuntu Kinetic)
       Status: Fix Committed => Fix Released

** Changed in: ubuntu-advantage-tools (Ubuntu Jammy)
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/2006508

Title:
  /usr/lib/ubuntu-advantage/esm_cache.py:RuntimeError:/usr/lib/ubuntu-
  advantage/esm_cache.py@22:main:update_esm_caches:is_current_series_lts:get_platform_info

Status in ubuntu-advantage-tools package in Ubuntu:
  New
Status in ubuntu-advantage-tools source package in Xenial:
  Fix Released
Status in ubuntu-advantage-tools source package in Bionic:
  Fix Released
Status in ubuntu-advantage-tools source package in Focal:
  Fix Released
Status in ubuntu-advantage-tools source package in Jammy:
  Fix Released
Status in ubuntu-advantage-tools source package in Kinetic:
  Fix Released
Status in ubuntu-advantage-tools source package in Lunar:
  New

Bug description:
  [Original Description]

  The Ubuntu Error Tracker has been receiving reports about a problem regarding ubuntu-advantage-tools.  This problem was most recently seen with package version 27.13.3~22.04.1, the problem page at https://errors.ubuntu.com/problem/40e03a6c527c3448d3cebf9af7558e3f64887e4d contains more details, including versions of packages affected, stacktrace or traceback, and individual crash reports.
  If you do not have access to the Ubuntu Error Tracker and are a software developer, you can request it at http://forms.canonical.com/reports/.

  [Impact]

  User will see a degrade state on systemd because the `esm_cache` job
  will fail, since it cannot properly parse /etc/os-release.

  This is probably affecting releases that are ubuntu based, and not
  Ubuntu itself.

  [ Test Case ]

  Scenario 1:

  1) Launch a LXD container with an affected Ubuntu release
  2) Install the Pro client version with the fix
  3) Modify /etc/os-release so that we don't have the fields VERSION, VERSION_CODENAME and VERSION_ID
  4) Run the esm_cache job and verify that it doesn't break anymore
  5) Check /var/log/ubuntu-advantage.log to see that we have alerted the user about this scenario

  Scenario 2:

  1) Launch a LXD container with an affected Ubuntu release
  2) Install the Pro client version with the fix
  3) Modify /etc/os-release so that we don't have the fields VERSION_CODENAME and VERSION_ID and change VERSION to "22.04 LTS (modified to 22.04 LTS)"
  4) Run the esm_cache job and verify that it doesn't break anymore
  5) Check /var/log/ubuntu-advantage.log to see that we have alerted the user about this scenario

  Scenario 3:

  1) Launch a LXD container with an affected Ubuntu release
  2) Install the Pro client version with the fix
  3) Modify /etc/os-release so that VERSION is set to "22.04 LTS (modified to 22.04 LTS)"
  4) Run the esm_cache job and verify that it doesn't break anymore
  5) Check /var/log/ubuntu-advantage.log to see that the job did not generated any error logs

  To test all of these scenarios, we have used the following script:

  ---------------------------
  #!/bin/bash
  set -e

  series=$1
  scenario=$2
  name=$series-dev

  
  function cleanup {
      lxc delete $name --force
  }

  function on_err {
      echo -e "Test Failed"
      cleanup
      exit 1
  }

  trap on_err ERR

  lxc launch ubuntu-daily:$series $name
  sleep 5

  lxc exec $name -- apt-get update > /dev/null
  lxc exec $name -- apt-get install ubuntu-advantage-tools > /dev/null

  # Show latest version of Pro client
  # ----------------------------------------------------------------
  echo "Show latest version of Pro client"
  echo "#############################"
  lxc exec $name -- apt-cache policy ubuntu-advantage-tools
  echo -e "#############################\n"
  # ----------------------------------------------------------------

  # Reproduce the error
  # ----------------------------------------------------------------

  if [ $scenario == "1" ]; then
    lxc exec $name -- sed -i '/VERSION=.*/d' /etc/os-release
    lxc exec $name -- sed -i '/VERSION_ID=.*/d' /etc/os-release
    lxc exec $name -- sed -i '/VERSION_CODENAME=.*/d' /etc/os-release
  elif [ $scenario == "2" ]; then
    lxc exec $name -- sed -i '/VERSION_ID=.*/d' /etc/os-release
    lxc exec $name -- sed -i '/VERSION_CODENAME=.*/d' /etc/os-release
    lxc exec $name -- sed -i 's/VERSION=.*/VERSION="22.04 LTS"/' /etc/os-release
  else
    lxc exec $name -- sed -i 's/VERSION=.*/VERSION="22.04 LTS"/' /etc/os-release
  fi

  echo "Show content /etc/os-release"
  echo "#############################"
  lxc exec $name -- cat /etc/os-release
  echo -e "#############################\n"

  echo "Show error related to /etc/os-release"
  echo "#############################"
  lxc exec $name -- sh -c "python3 /usr/lib/ubuntu-advantage/esm_cache.py || true "
  echo -e "#############################\n"
  # ----------------------------------------------------------------

  # Add proposed
  # ----------------------------------------------------------------
  lxc exec $name -- sh -c "echo \"deb http://archive.ubuntu.com/ubuntu $series-proposed main\" | tee /etc/apt/sources.list.d/proposed.list"
  lxc exec $name -- apt-get update > /dev/null
  lxc exec $name -- apt-get install ubuntu-advantage-tools > /dev/null
  # ----------------------------------------------------------------

  # Show latest version of Pro client
  # ----------------------------------------------------------------
  echo "Show proposed version of Pro client"
  echo "#############################"
  lxc exec $name -- apt-cache policy ubuntu-advantage-tools
  echo -e "#############################\n"
  # ----------------------------------------------------------------

  
  if [ $scenario != "3" ]; then
    echo "Check that command doesn't fail, but we output the error message"
  else
    echo "Error no longer appear"
  fi
  echo "#############################"
  lxc exec $name -- python3 /usr/lib/ubuntu-advantage/esm_cache.py
  echo -e "#############################\n"

  if [ $scenario != "3" ]; then
    echo "Check that we have logged the issue"
  else
    echo "Check that we have not logged the issue"
  fi

  echo "#############################"
  lxc exec $name -- tail /var/log/ubuntu-advantage.log
  echo -e "#############################\n"

  cleanup
  --------------------------------------

  [ Regression potential ]

  We are modifying how we collect information from /etc/os-release. If we have a mismatch between VERSION_ID and VERSION_CODENAME from VERSION, we might now pass different information to the contract server. However, we
  believe this is low risk, as those fields should be consistent among themselves

  [ Discussion]

  Before running the esm_cache job, we check to see if the machine is an
  ESM release. To perform that check, we gather information from
  /etc/os-release. If we cannot find the require information there, we
  raise an Exception that is not being treated on the esm_cache job. We
  are now not only handling better how we extract information from
  /etc/os-release, but also making the esm_cache job more resilient to
  potential unexpected exceptions

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-advantage-tools/+bug/2006508/+subscriptions