Skip to content

ESM backport importlib fix to released focal branch - #6940

Merged
blackboxsw merged 2 commits into
canonical:ubuntu/focal-24.4.xfrom
blackboxsw:ubuntu/focal-24.4.x
Jul 24, 2026
Merged

blackboxsw merged 2 commits into
canonical:ubuntu/focal-24.4.xfrom
blackboxsw:ubuntu/focal-24.4.x

Conversation

@blackboxsw

@blackboxsw blackboxsw commented Jul 17, 2026 •

Copy link
Copy Markdown
Collaborator

CPC is looking to sync changes to ESM images for importlib errors seen on Pro images.
Backport upstream fix a97e746 as a quilt patch to ensure both focal and bionic get the destination patch.

Proposed Commit Message

Separate commits

* releasing cloud-init version 24.4.1-0ubuntu0~20.04.3+esm2

* fix: import specific importlib.util avoiding traces in pro auto-attach
    
    Use direct submodule import of importlib.util to avoid AttributeError
    tracebacks from ua-auto-attach.service on GCE.
    
    Backport-of: a97e7466
    Fixes GH-6924

Additional Context

As this is an ESM fix, this release will be reviewed by security team to be included in ESM infra PPA instead of typical Ubuntiu SRU process.
This upstream fix will make it into LTS releases via typical SRU process.

Test Steps

quilt push -a  # patches apply

lxc launch ubuntu-minimal:focal f-min
lxc exec f-min -- pro attach <YOUR_TOKEN>
lxc exec f-min -- apt install ubuntu-pro-client cloud-init
lxc file push cloudinit/importer.py f-min/usr/lib/python3/dist-packages/cloudinit/
lxc exec f-min -- python3 /usr/lib/ubuntu-advantage/auto_attach.py   # confirm no traceback
quilt pop -a    # patched removed without issue

PPA for testing https://launchpad.net/~chad.smith/+archive/ubuntu/esm-test-pro-importlib

Merge type

  • Squash merge using "Proposed Commit Message"
  • Rebase and merge unique commits. Requires commit messages per-commit each referencing the pull request number (#<PR_NUM>)
  • git merge from command line after approval.

@blackboxsw
blackboxsw requested a review from holmanb July 17, 2026 13:44
@github-actions github-actions Bot added the packaging Supplemental package review requested label Jul 17, 2026
@blackboxsw

Copy link
Copy Markdown
Collaborator Author

Manual verifcation performed: SUCCESS

cat > ESM.yaml <<EOF
#cloud-config
ubuntu_advantage:
  token: MY_TOKEN
EOF

cat > ESM.list <<EOF
deb [ allow-insecure=yes ] https://ppa.launchpadcontent.net/chad.smith/esm-backport-testing/ubuntu focal main
EOF

lxc launch ubuntu-minimal:bionic f-esm-verification -c user.user-data="$(cat ESM_VALIDATION.yaml)"
lxc exec f-esm-verification -- cloud-init stauts --wait --format=yaml
lxc exec f-esm-verification -- apt install ubuntu-pro-client cloud-init -y  # latest ESM-released content


lxc exec f-esm-verification -- python3 /usr/lib/ubuntu-advantage/auto_attach.py   # confirm NO error

...
  File "/usr/lib/python3/dist-packages/cloudinit/mergers/__init__.py", line 134, in construct
    m_name, [__name__], [MERGER_ATTR]
  File "/usr/lib/python3/dist-packages/cloudinit/importer.py", line 52, in find_module
    if not importlib.util.find_spec(full_path):
AttributeError: module 'importlib' has no attribute 'util'


# install -proposed package from PPA
lxc file push ESM.list f-esm-verification/etc/apt/sources.list.d/

lxc exec f-esm-verification -- apt update
lxc exec f-esm-verification -- apt install cloud-init=24.4.1-0ubuntu0~20.04.3+esm2 --allow-unauthenticated -y

amspredator:~$ lxc exec f-esm-verification -- python3 /usr/lib/ubuntu-advantage/auto_attach.py   # confirm NO error
["2026-07-22T22:44:35.737", "INFO", "ubuntupro.lib.auto_attach", "main", 68, "cloud-init userdata has ubuntu-advantage key.", {}]
["2026-07-22T22:44:35.738", "INFO", "ubuntupro.lib.auto_attach", "main", 69, "Skipping auto-attach and deferring to cloud-init to setup and configure auto-attach", {}]
amspredator:~$ lxc exec f-esm-verification -- cloud-init --version
/usr/bin/cloud-init 24.4.1-0ubuntu0~20.04.3+esm2


lxc exec f-esm-verification -- python3 /usr/lib/ubuntu-advantage/auto_attach.py   # confirm NO error
...
["2026-07-22T22:18:27.745", "INFO", "ubuntupro.lib.auto_attach", "main", 68, "cloud-init userdata has ubuntu-advantage key.", {}]
["2026-07-22T22:18:27.746", "INFO", "ubuntupro.lib.auto_attach", "main", 70, "Skipping auto-attach and deferring to cloud-init to setup and configure auto-attach", {}]
...

Use direct submodule import of importlib.util to avoid AttributeError
tracebacks from ua-auto-attach.service on GCE.

Backport-of: a97e746
Fixes canonicalGH-6924
@blackboxsw
blackboxsw force-pushed the ubuntu/focal-24.4.x branch from 04cc91b to cc53f63 Compare July 23, 2026 13:38
@blackboxsw

Copy link
Copy Markdown
Collaborator Author

Bumping quilt patch to explicitly retain an import importlib for importlib.import_module calls.

@holmanb holmanb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This looks good to me.

@blackboxsw
blackboxsw merged commit cc53f63 into canonical:ubuntu/focal-24.4.x Jul 24, 2026
3 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packaging Supplemental package review requested security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants