crash in log of cloned Pro instance: uaclient.exceptions.AlreadyAttachedError: <uaclient.config.UAConfig object at 0xfoo>

Bug #1867573 reported by Christian Reis
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-advantage-tools (Ubuntu)
Fix Released
High
Chad Smith

Bug Description

I used Packer to create my own version of an Ubuntu Pro instance. When it comes up, it's not associated with a subscription (based on the output of ua status) and the log reports a crash, with foo and bar below replaced with identifiers:

2020-03-16 04:12:37,179 - cli.py:(594) [ERROR]: This machine is already attached to 'foo'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/uaclient/cli.py", line 576, in wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/uaclient/cli.py", line 616, in main
    return args.action(args, cfg)
  File "/usr/lib/python3/dist-packages/uaclient/cli.py", line 88, in new_f
    raise exceptions.AlreadyAttachedError(cfg)
uaclient.exceptions.AlreadyAttachedError: <uaclient.config.UAConfig object at 0xbar>

UPDATE: The packer copy preserves product codes:

ubuntu@ip-172-31-29-146:~$ curl -s http://169.254.169.254/latest/dynamic/instance-identity/document
[...]
  "marketplaceProductCodes" : [ "ex9l8qw4x21426rsfg7am8gym" ],
[...]
}

So the net is we need to be able to reprovision keys transparently when the instance ID has changed.

Revision history for this message
Christian Reis (kiko) wrote :

Actually, the packer copy does seem to preserve product codes:

ubuntu@ip-172-31-29-146:~$ curl -s http://169.254.169.254/latest/dynamic/instance-identity/document
[...]
  "marketplaceProductCodes" : [ "ex9l8qw4x21426rsfg7am8gym" ],
[...]
}

So we have two bugs; I'll file the other one if we don't have one yet.

Revision history for this message
Christian Reis (kiko) wrote :

Updated the description based on the comment above; it's just one bug now.

description: updated
Revision history for this message
Casey Marshall (cmars) wrote :

Since `ua auto-attach` runs on boot, it needs to be improved to detect changes in instance-id. If the instance-id changes, all prior tokens should be deleted prior (or as part of) `ua auto-attach`.

Chad Smith (chad.smith)
Changed in ubuntu-advantage-tools (Ubuntu):
assignee: nobody → Chad Smith (chad.smith)
status: New → In Progress
Joshua Powers (powersj)
Changed in ubuntu-advantage-tools (Ubuntu):
status: In Progress → Triaged
importance: Undecided → High
Revision history for this message
Chad Smith (chad.smith) wrote :

A pull request has been submitted to address this issue
https://github.com/CanonicalLtd/ubuntu-advantage-client/pull/1016

Chad Smith (chad.smith)
Changed in ubuntu-advantage-tools (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Chad Smith (chad.smith) wrote :

An upstream fix has landed for this issue.
https://github.com/CanonicalLtd/ubuntu-advantage-client/commit/5881e7760c89a7ef64439b97ec44b45aea290a55

We are starting the publishing process for new AWS Ubuntu Pro images.

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

This bug was fixed in the package ubuntu-advantage-tools - 20.3

---------------
ubuntu-advantage-tools (20.3) focal; urgency=medium

  * New upstream release 20.3:
    - ubuntu-pro: automatically reattach across instance id delta
      (LP: #1867573)
    - integration testing:
      + add behave tests ua subcommands for attached vm
      + add invalid token tests
      + add reuse_container test docs
      + refactor token parameter

 -- Chad Smith <email address hidden> Mon, 30 Mar 2020 14:49:17 -0600

Changed in ubuntu-advantage-tools (Ubuntu):
status: Fix Committed → 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.