3

Sat down at work to do a routine apt update && apt upgrade and encountered some issue with ubuntu-advantage-tools.

I'm not sure what this package is for, but it came in with Ubuntu 20.04.2 LTS (GNU/Linux 5.4.72-microsoft-standard-WSL2 x86_64).

I've tried the usual apt purge and tried to install again, but it still doesn't succeed.

$ sudo apt install ubuntu-minimal
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  ubuntu-advantage-tools
The following NEW packages will be installed:
  ubuntu-advantage-tools ubuntu-minimal
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/847 kB of archives.
After this operation, 3233 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package ubuntu-advantage-tools.
(Reading database ... 58786 files and directories currently installed.)
Preparing to unpack .../ubuntu-advantage-tools_27.2.1~20.04.1_amd64.deb ...
Unpacking ubuntu-advantage-tools (27.2.1~20.04.1) ...
Selecting previously unselected package ubuntu-minimal.
Preparing to unpack .../ubuntu-minimal_1.450.2_amd64.deb ...
Unpacking ubuntu-minimal (1.450.2) ...
Setting up ubuntu-advantage-tools (27.2.1~20.04.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
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: dependency problems prevent configuration of ubuntu-minimal:
 ubuntu-minimal depends on ubuntu-advantage-tools; however:
  Package ubuntu-advantage-tools is not configured yet.

dpkg: error processing package ubuntu-minimal (--configure):
 dependency problems - leaving unconfigured
Processing triggers for man-db (2.9.1-1) ...
Errors were encountered while processing:
 ubuntu-advantage-tools
 ubuntu-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

I just show the example of installing ubuntu-minimal because this was (i think) the only thing depending on ubuntu-advantage-tools, and removing ubuntu-advantage-tools also removed ubuntu-minimal.

I can re-create my Ubuntu WSL thing but its kind of a PITA. I'm not getting commercial support from Canonical, do I need to worry about this package being borky? More worried about that ubuntu-minimal metapackage being broken, actually.

Thanks!

I did end up 'resetting' my WSL Ubuntu install, did an initial "apt update && apt full-upgrade -y && apt autoremove -y" and the error came back. Maybe Ubuntu has a buggy package right now?

[... bunch of other apt output here ...]

Setting up ubuntu-advantage-tools (27.2.1~20.04.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

[... bunch of other apt output here ...]

Errors were encountered while processing:
 ubuntu-advantage-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

2 Answers 2

1

ubuntu-advantage-tools upgrade fails configure Bug #1938097

sudo vim +295 /var/lib/dpkg/info/ubuntu-advantage-tools.postinst
# or use gedit, nano, or else

change line 295 to

cloud_id=$(cloud-id || true)

making this change and then

run dpkg --configure -a

An alternative workaround is uninstalling the cloud-init package. If this package is not installed, cloud-init cannot be found, so the error does not happen.

1

In my case (Ubuntu 18.04) this caused a catch 22 because the package requires some Python3 packages which were not installed and apt could not complete installation.

The fix for me was hard remove of ubuntu-advantage-tools to install python3 packages then reinstall

To hard remove ubuntu-advantage-tools reference from apt:

sudo mv /var/lib/dpkg/info/ubuntu-advantage-tools* /tmp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.