missing version dependency on distro-info

Bug #1932028 reported by James Troup
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
ubuntu-advantage-tools (Ubuntu)
Fix Released
Medium
Grant Orndorff
Xenial
Fix Released
Undecided
Unassigned
Bionic
Fix Released
Undecided
Unassigned
Focal
Fix Released
Undecided
Unassigned
Hirsute
Fix Released
Undecided
Unassigned

Bug Description

[Impact]

If a user on xenial or on bionic has an old version of distro-info and then upgraded ubuntu-advantage-tools, they will get periodic tracebacks from our update_messaging systemd unit, and enabling services with ua will always fail.

The fix is to specify the required versions of distro-info that ubuntu-advantage-tools needs to function.

Backporting this fix is necessary to ensure xenial and bionic users who happen to have an older version of distro-info are able to enable ubuntu-advantage services without first finding this bug, then manually upgrading distro-info.

[Test Plan]

This should be tested on both xenial and bionic. These test steps assume that the proposed version of ua to release is available in ppa:ua-client/staging - check with the ubuntu-advantage-tools team before proceeding to make sure this is the case.

First reproduce the issue.

In a xenial container:
```
sudo apt install distro-info=0.14build1 distro-info-data=0.28
sudo apt install ubuntu-advantage-tools
sudo python3 /usr/lib/ubuntu-advantage/ua_update_messaging.py
# expect a traceback
sudo ua attach YOUR_TOKEN
# expect error messages
sudo ua detach
# expect error messages
```

In a bionic container:
```
sudo apt install distro-info=0.18 distro-info-data=0.37
sudo apt install ubuntu-advantage-tools
sudo python3 /usr/lib/ubuntu-advantage/ua_update_messaging.py
# expect a traceback
sudo ua attach YOUR_TOKEN
# expect error messages
sudo ua detach
# expect error messages
```

To see the fix in action, on both xenial and bionic:
```
sudo add-apt-repository ppa:ua-client/staging
sudo apt-get update
sudo apt install ubuntu-advantage-tools
sudo python3 /usr/lib/ubuntu-advantage/ua_update_messaging.py
# there should be no traceback or error
sudo ua attach YOUR_TOKEN
# expect success and no error messages
sudo ua detach
# expect success and no error messages
```

[Where problems could occur]

In order to require the correct versions for both xenial and bionic and later releases, the Depends line is somewhat complex. The same line is required under Build-Depends as well. So if there is a mistake, such as if the version constraints incorrectly include a version they shouldn't, then this could cause errors during build as well as during install.

[Other Info]

The complexity in the depends line is because of the following versions of distro-info. This list includes which release they are one and which ones will work as our dependency:

- xenial: 0.14build1 doesn't work
- xenial: 0.14ubuntu0.2 works
- bionic: 0.18 doesn't work
- bionic: 0.18ubuntu0.18.04.1 works

focal and later have higher version numbers than 0.18

So to grab the correct version across all versions, we need to set a minumum version of 0.18ubuntu0.18.04.1 OR get exactly 0.14ubuntu0.2, but nothing in between.

[Original Description]

27.0~16.04.1 on Xenial. ubuntu-advantage-tools was upgraded, the rest of the machine is painfully behind.

Resulted in this:

Jun 15 13:34:46 MAAS systemd[1]: Starting Ubuntu Advantage APT and MOTD Messages...
Jun 15 13:34:46 MAAS python3[15434]: Traceback (most recent call last):
Jun 15 13:34:46 MAAS python3[15434]: File "/usr/lib/ubuntu-advantage/ua_update_messaging.py", line 302, in <module>
Jun 15 13:34:46 MAAS python3[15434]: update_apt_and_motd_messages(cfg=cfg)
Jun 15 13:34:46 MAAS python3[15434]: File "/usr/lib/ubuntu-advantage/ua_update_messaging.py", line 284, in update_apt_and_motd_messages
Jun 15 13:34:46 MAAS python3[15434]: if not util.is_lts(series):
Jun 15 13:34:46 MAAS python3[15434]: File "/usr/lib/python3/dist-packages/uaclient/util.py", line 353, in is_lts
Jun 15 13:34:46 MAAS python3[15434]: out, _err = subp(["/usr/bin/ubuntu-distro-info", "--supported-esm"])
Jun 15 13:34:46 MAAS python3[15434]: File "/usr/lib/python3/dist-packages/uaclient/util.py", line 608, in subp
Jun 15 13:34:46 MAAS python3[15434]: out, err = _subp(args, rcs, capture, timeout, env=env)
Jun 15 13:34:46 MAAS python3[15434]: File "/usr/lib/python3/dist-packages/uaclient/util.py", line 565, in _subp
Jun 15 13:34:46 MAAS python3[15434]: stderr=err.decode("utf-8"),
Jun 15 13:34:46 MAAS python3[15434]: uaclient.util.ProcessExecutionError: Failed running command '/usr/bin/ubuntu-distro-info --supported-esm' [exit(1)]. Message: ubuntu-distro-info: unrecognized option `--supported-esm'
Jun 15 13:34:46 MAAS systemd[1]: ua-messaging.service: Main process exited, code=exited, status=1/FAILURE
Jun 15 13:34:46 MAAS systemd[1]: Failed to start Ubuntu Advantage APT and MOTD Messages.
Jun 15 13:34:46 MAAS systemd[1]: ua-messaging.service: Unit entered failed state.
Jun 15 13:34:46 MAAS systemd[1]: ua-messaging.service: Failed with result 'exit-code'.

Installed distro-info was 0.14build1 ; upgrading to current fixed it.

Changed in ubuntu-advantage-tools (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Thiago Martins (martinx) wrote :

Hi,

I also see this problem with fresh installed Xenial.

It's interesting to see that it's a bit tricky to reproduce this problem. I have to upgrade "ubuntu-advantage-tools" shortly after installing Xenial.

Cheers!

Revision history for this message
Chad Smith (chad.smith) wrote :

https://github.com/canonical/ubuntu-advantage-client/pull/1684 landed with proper explicit versioned dependencies distro-info defined. Expect to see this in ubuntu-advantage-tools v. 27.3.

Right on unique failure reproduce is a base original release of xenial with an immediate upgrade of ubuntu-advantage-tolls. If daily APT updates run first before the ua-tools upgrade, this should be resolved by the fact that the version of distro-info in xenial-updates or bionic-updates is sufficient enough that this doesn't pose a problem.

Changed in ubuntu-advantage-tools (Ubuntu):
status: Triaged → Fix Committed
assignee: nobody → Grant Orndorff (orndorffgrant)
description: updated
description: updated
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-advantage-tools - 27.2~21.10.1

---------------
ubuntu-advantage-tools (27.2~21.10.1) impish; urgency=medium

  * d/control:
    - add comments to explain complex build-depends
    - add version requirement to distro-info (LP: #1932028)
  * d/tools.postinst:
    - run status.json schema patch script to avoid non-root status errors
  * New upstream release 27.2:
    - attach: print contract server reason for 403 (GH: #1630)
    - cli: add ua config set, unset and show subcommands
    - config:
      + add default ua_config setting values
      + only allow some fields to be set by envvar
      + use defaults for contract and security url
    - docs:
      + add proxy config options to man page
      + add instructions to generate MOTD messages
      + add support matrix info
      + remove broken api link
    - enable: allow downgrading packages during enable (GH: #1659)
    - fips:
      + add focal test for fips-updates
      + alert if wrong fips package installed on gov clouds
      + install correct fips package on gov clouds
      + only install conditional_packages if necessary and available
    - logs: log env vars that affect config on cli runs
    - proxy:
      + add config options to set proxies
      + print message when setting proxy
      + support configuring apt proxies
      + support configuring snap and livepatch proxies
      + support setting proxy for web requests
      + validate urls before setting as proxies
    - refresh: support refreshing config and contract separately
    - status
      + add config info to json output
      + add env vars to json output
      + do not show unavailable services in json output
      + support yaml format with same content as json format
      + update account info in json output
      + update contract info in json output
      + update root level keys of json output
    - refactor:
      + remove side effects from can_enable (GH: #1654, #1571)
      + use DatetimeAwareJSONDecoder to parse date strings
    - tests:
      + add additional enable test for incompatible services
      + add flag to enable proposed pocket
      + add test to check and print version being tested
      + drop trusty specific tests

 -- Grant Orndorff <email address hidden> Fri, 09 Jul 2021 13:07:23 -0400

Changed in ubuntu-advantage-tools (Ubuntu):
status: Fix Committed → Fix Released
Chad Smith (chad.smith)
Changed in ubuntu-advantage-tools (Ubuntu Xenial):
status: New → In Progress
Changed in ubuntu-advantage-tools (Ubuntu Bionic):
status: New → In Progress
Changed in ubuntu-advantage-tools (Ubuntu Focal):
status: New → In Progress
Changed in ubuntu-advantage-tools (Ubuntu Hirsute):
status: New → In Progress
Revision history for this message
Grant Orndorff (orndorffgrant) wrote :

I have verified the version of ubuntu-advantage-tools in -proposed fixes this bug. The logs of my tests are attached here.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-advantage-tools - 27.2.1~21.04.1

---------------
ubuntu-advantage-tools (27.2.1~21.04.1) hirsute; urgency=medium

  * Backport new upstream release: (LP: #1934902) to hirsute

 -- Chad Smith <email address hidden> Fri, 16 Jul 2021 12:49:23 -0600

Changed in ubuntu-advantage-tools (Ubuntu Hirsute):
status: In Progress → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-advantage-tools - 27.2.1~20.04.1

---------------
ubuntu-advantage-tools (27.2.1~20.04.1) focal; urgency=medium

  * Backport new upstream release: (LP: #1934902) to focal

 -- Chad Smith <email address hidden> Fri, 16 Jul 2021 12:48:51 -0600

Changed in ubuntu-advantage-tools (Ubuntu Focal):
status: In Progress → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-advantage-tools - 27.2.1~18.04.1

---------------
ubuntu-advantage-tools (27.2.1~18.04.1) bionic; urgency=medium

  * Backport new upstream release: (LP: #1934902) to bionic

 -- Chad Smith <email address hidden> Fri, 16 Jul 2021 12:48:22 -0600

Changed in ubuntu-advantage-tools (Ubuntu Bionic):
status: In Progress → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-advantage-tools - 27.2.1~16.04.1

---------------
ubuntu-advantage-tools (27.2.1~16.04.1) xenial; urgency=medium

  * Backport new upstream release: (LP: #1934902) to xenial

 -- Chad Smith <email address hidden> Fri, 16 Jul 2021 12:47:53 -0600

Changed in ubuntu-advantage-tools (Ubuntu Xenial):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.