** Description changed:

+ [Impact]
+ 
+ Users are not able to install or upgrade ubuntu-advantage-tools in
+ situations where cloud-init is installed in the system, but did not run
+ - either because of some error, or it was disabled, or it did not
+ finished executing yet.
+ 
+ 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-advantage-tools cloud-init".
+ 
+ Running the above using the patched version of ubuntu-advantage-tools
+ should succeed without any errors.
+ 
+ [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-advantage-tools (27.2.1~21.10.1) ...
  ERROR: File not found '/run/cloud-init/instance-data.json'. Provide a
  path to instance data json file using --instance-data           dpkg:
  error processing package ubuntu-advantage-tools (--configure):
  installed ubuntu-advantage-tools package post-installation script
  subprocess returned error exit status 1                            dpkg:
  dependency problems prevent configuration of ubuntu-minimal:
  ubuntu-minimal depends on ubuntu-advantage-tools; however:
  Package ubuntu-advantage-tools is not configured yet.
  
  ProblemType: Package
  DistroRelease: Ubuntu 21.10
  Package: ubuntu-advantage-tools 27.2.1~21.10.1
  Uname: Linux 5.4.72-microsoft-standard-WSL2 x86_64
  ApportVersion: 2.20.11-0ubuntu67
  Architecture: amd64
  CasperMD5CheckResult: unknown
  Date: Mon Jul 19 14:32:11 2021
  DuplicateSignature:
   package:ubuntu-advantage-tools:27.2.1~21.10.1
   Installing new version of config file /etc/ubuntu-advantage/uaclient.conf ...
   ERROR: File not found '/run/cloud-init/instance-data.json'. Provide a path 
to instance data json file using --instance-data
   dpkg: error processing package ubuntu-advantage-tools (--configure):
    installed ubuntu-advantage-tools package post-installation script 
subprocess returned error exit status 1
  ErrorMessage: installed ubuntu-advantage-tools package post-installation 
script subprocess returned error exit status 1
  Python3Details: /usr/bin/python3.9, Python 3.9.6, python3-minimal, 3.9.4-1
  PythonDetails: N/A
  RebootRequiredPkgs: libc6
  RelatedPackageVersions:
   dpkg 1.20.9ubuntu2
   apt  2.3.6
  SourcePackage: ubuntu-advantage-tools
  Title: package ubuntu-advantage-tools 27.2.1~21.10.1 failed to 
install/upgrade: installed ubuntu-advantage-tools package post-installation 
script subprocess returned error exit status 1
  UpgradeStatus: Upgraded to impish on 2021-07-19 (0 days ago)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1936833

Title:
  postinst fails when cloud-init is installed but never ran

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


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to