postinst fails when cloud-init is installed but never ran
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-advantage-tools (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Xenial |
Fix Released
|
Critical
|
Unassigned | ||
Bionic |
Fix Released
|
Critical
|
Unassigned | ||
Focal |
Fix Released
|
Critical
|
Unassigned | ||
Hirsute |
Fix Released
|
Critical
|
Unassigned |
Bug Description
[Impact]
Users are not able to install or upgrade ubuntu-
When cloud-init runs, instance-data.json will be available and cloud-id does not fail. The fix checks for the existence of this file, and does not run the script if the file is not present.
Backporting the fix will enable users to install or upgrade ubuntu-advantage tools without problems.
[Test Plan]
The bug can be reproduced by running:
"schroot -c impish-amd64 -u root -d /",
and then within the chroot, running:
"apt-get update && apt-get install -y ubuntu-
Running the above using the patched version of ubuntu-
[Where problems could occur]
The fix itself just skips a call that adds a warning notice to ua.
If the user is running on a cloud and has some kind of error in cloud-init, the user may miss a warning about having the wrong metapackages for the cloud. However, in the case where cloud-init did not run because of some error, the instance has a problem anyway.
If it happens that cloud init did not run yet - as if this happens at image creation time - then cloud-init will be later executed, and the cloud-id checked in the code so those wrong metapackages are not installed.
[Original Description]
This happens when upgrading to Ubuntu 21.10. This is the full error:
Setting up ubuntu-
ProblemType: Package
DistroRelease: Ubuntu 21.10
Package: ubuntu-
Uname: Linux 5.4.72-
ApportVersion: 2.20.11-0ubuntu67
Architecture: amd64
CasperMD5CheckR
Date: Mon Jul 19 14:32:11 2021
DuplicateSignature:
package:
Installing new version of config file /etc/ubuntu-
ERROR: File not found '/run/cloud-
dpkg: error processing package ubuntu-
installed ubuntu-
ErrorMessage: installed ubuntu-
Python3Details: /usr/bin/python3.9, Python 3.9.6, python3-minimal, 3.9.4-1
PythonDetails: N/A
RebootRequiredPkgs: libc6
RelatedPackageV
dpkg 1.20.9ubuntu2
apt 2.3.6
SourcePackage: ubuntu-
Title: package ubuntu-
UpgradeStatus: Upgraded to impish on 2021-07-19 (0 days ago)
Related branches
- Lucas Kanashiro (community): Approve
- Athos Ribeiro (community): Approve
-
Diff: 28 lines (+9/-1)2 files modifieddebian/changelog (+8/-0)
debian/ubuntu-advantage-tools.postinst (+1/-1)
tags: | removed: need-duplicate-check |
Changed in ubuntu-advantage-tools (Ubuntu): | |
status: | Incomplete → Confirmed |
description: | updated |
tags: | added: regression-update |
Changed in ubuntu-advantage-tools (Ubuntu Xenial): | |
importance: | Undecided → Critical |
Changed in ubuntu-advantage-tools (Ubuntu Bionic): | |
importance: | Undecided → Critical |
Changed in ubuntu-advantage-tools (Ubuntu Focal): | |
importance: | Undecided → Critical |
Changed in ubuntu-advantage-tools (Ubuntu Hirsute): | |
importance: | Undecided → Critical |
description: | updated |
tags: |
added: verification-done verification-done-bionic verification-done-focal verification-done-hirsute verification-done-xenial removed: verification-needed verification-needed-bionic verification-needed-focal verification-needed-hirsute verification-needed-xenial |
Thanks for the bug report!
ubuntu- advantage- tools tries to run `cloud-id` if the command is present during postinst to find a certain edge case and notify the user.
It looks like cloud-id was available, but instance-data.json was missing, so cloud-id failed. I believe this would occur if cloud-init is installed on this system but never ran. If you are able to get cloud-init to run and then try to upgrade ubuntu- advantage- tools again, I suspect it will work.
Regardless, ubuntu- advantage- tools should probably be able to handle this situation without failing.