package ansible-core 2.12.0-1 failed to install/upgrade: installed ansible-core package post-installation script subprocess returned error exit status 1

Bug #1969917 reported by maznio
84
This bug affects 16 people
Affects Status Importance Assigned to Milestone
ansible-core (Ubuntu)
Invalid
Undecided
Athos Ribeiro
Jammy
Fix Released
Undecided
Athos Ribeiro

Bug Description

[Impact]

ansible-core installs a broken symlink pointing to
/usr/lib/python3.10/dist-packages/ansible/release.py, which is not installed by the package.
dh_python injects a postinst script that pre-compiles the .py files in the package. The presence of this broken symlink leads the postinst script to fail, leaving the package installation in a failed state.

[Test Plan]

Install the package and verify that the installation process completes successfully.

[Where problems could occur]

While there are no files under /usr/lib/python3.10 for this package, it does currently ship empty directories and broken symlinks. If, for some reason, a user is checking for the presence of any of those, their scripts/workflows could break and they´d need to perform their checks against the directory without the minor version (usr/lib/python3/).

Moreover, possible previous changes in the build dependencies may introduce unexpected changes within the built package. We would need to address any of those individually.

[Other Info]

Bileto ticket: https://bileto.ubuntu.com/#/ticket/4899
PPA with test build: https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/4899/+packages

[Original report]

During installation of package ansible-core on Ubuntu 22.04 the following error occurs:

...
Setting up ansible-core (2.12.0-1) ...
[Errno 2] No such file or directory: '/usr/lib/python3.10/dist-packages/ansible/module_utils/ansible_release.py'dpkg: error processing package ansible
-core (--configure):
 installed ansible-core package post-installation script subprocess returned error exit status 1
Processing triggers for man-db (2.10.2-1) ...
Errors were encountered while processing:
 ansible-core
E: Sub-process /usr/bin/dpkg returned an error code (1)

Installing package `ansible` (without `-core`) works.

Additional info:

$ lsb_release -rd
Description: Ubuntu 22.04 LTS
Release: 22.04

$ apt-cache policy ansible-core
ansible-core:
  Installed: (none)
  Candidate: 2.12.0-1
  Version table:
     2.12.0-1 500
        500 http://ae.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages

ProblemType: Package
DistroRelease: Ubuntu 22.04
Package: ansible-core 2.12.0-1
ProcVersionSignature: Ubuntu 5.15.0-25.25-generic 5.15.30
Uname: Linux 5.15.0-25-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.11-0ubuntu82
Architecture: amd64
CasperMD5CheckResult: pass
Date: Fri Apr 22 14:32:17 2022
DuplicateSignature:
 package:ansible-core:2.12.0-1
 Setting up ansible-core (2.12.0-1) ...
 [Errno 2] No such file or directory: '/usr/lib/python3.10/dist-packages/ansible/module_utils/ansible_release.py'dpkg: error processing package ansible-core (--configure):
  installed ansible-core package post-installation script subprocess returned error exit status 1
ErrorMessage: installed ansible-core package post-installation script subprocess returned error exit status 1
InstallationDate: Installed on 2022-04-20 (1 days ago)
InstallationMedia: Ubuntu 22.04 LTS "Jammy Jellyfish" - Beta amd64 (20220329.1)
PackageArchitecture: all
Python3Details: /usr/bin/python3.10, Python 3.10.4, python3-minimal, 3.10.4-0ubuntu2
PythonDetails: N/A
RelatedPackageVersions:
 dpkg 1.21.1ubuntu2
 apt 2.4.5
SourcePackage: ansible-core
Title: package ansible-core 2.12.0-1 failed to install/upgrade: installed ansible-core package post-installation script subprocess returned error exit status 1
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

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

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ansible-core (Ubuntu):
status: New → Confirmed
Revision history for this message
Fredrik Jonson (fredrik-jonson) wrote :

A similar issue appears to have been adressed by Debian in issue
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1001040

Also ansible-core version 2.12.4-1 in Ubuntu appears to have the proper build dependency.

http://archive.ubuntu.com/ubuntu/pool/universe/a/ansible-core/ansible-core_2.12.4-1.dsc

Will ansible-core 2.12.4-1 be made available to Jaunty/22.04 or should the patch be backported?

Revision history for this message
zapyon (zapyon) wrote :

As it is impossible to install ansible-core because of this bug I suggest increasing the priority

tags: removed: need-duplicate-check
Revision history for this message
Chad Smith (chad.smith) wrote :

The ansible-core.postinst invoked py3compile -p ansible-core as postinstallation script. On Ubuntu, that is generating a broken symlink for some reason at /usr/lib/python3.10/dist-packages/ansible/module_utils/ansible_release.py

lrwxrwxrwx 1 root root 13 Nov 18 2021 /usr/lib/python3.10/dist-packages/ansible/module_utils/ansible_release.py -> ../release.py

Note the symlink is pointing to the release.py module path below /usr/lib/python3.10/

But, on this package actually delivers the ansible/release.py over in /usr/lib/python3/dist-packages/ansible/release.py

root@test-jammy:~# dpkg -L ansible-core | grep release
/usr/lib/python3/dist-packages/ansible/release.py
/usr/lib/python3/dist-packages/ansible/module_utils/ansible_release.py
/usr/lib/python3.10/dist-packages/ansible/module_utils/ansible_release.py

Changed in ansible-core (Ubuntu):
assignee: nobody → Athos Ribeiro (athos-ribeiro)
tags: added: server-todo
Changed in ansible-core (Ubuntu Jammy):
status: New → Triaged
assignee: nobody → Athos Ribeiro (athos-ribeiro)
Changed in ansible-core (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

A potential fix has been uploaded to the following PPA:

https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/4899/+packages

description: updated
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

The autopkgtest change was forwarded to debian in https://salsa.debian.org/debian/ansible-core/-/merge_requests/1

description: updated
Changed in ansible-core (Ubuntu Jammy):
status: Triaged → In Progress
Revision history for this message
Chris Halse Rogers (raof) wrote : Please test proposed package

Hello maznio, or anyone else affected,

Accepted ansible-core into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/ansible-core/2.12.0-1ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in ansible-core (Ubuntu Jammy):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-jammy
Revision history for this message
Sam Clements (borntyping) wrote :

Package ansible-core/2.12.0-1ubuntu0.1 fixes this issue for me.

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Thanks, Sam!

I also verified that installing 2.12.0-1ubuntu0.1 from jammy-proposed does not trigger the configuration issues reported, therefore, fixing this bug.

tags: added: verification-done verification-done-jammy
removed: verification-needed verification-needed-jammy
Revision history for this message
Bran Kop (kopbran) wrote :

sudo apt-get install ansible-core -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
  cowsay sshpass
Recommended packages:
  ansible
The following NEW packages will be installed:
  ansible-core
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/1168 kB of archives.
After this operation, 7493 kB of additional disk space will be used.
Selecting previously unselected package ansible-core.
(Reading database ... 59299 files and directories currently installed.)
Preparing to unpack .../ansible-core_2.12.0-1_all.deb ...
Unpacking ansible-core (2.12.0-1) ...
Setting up ansible-core (2.12.0-1) ...
[Errno 2] No such file or directory: '/usr/lib/python3.10/dist-packages/ansible/module_utils/ansible_release.py'dpkg: error processing package ansible-core (--configure):
 installed ansible-core package post-installation script subprocess returned error exit status 1
Processing triggers for man-db (2.10.2-1) ...
Errors were encountered while processing:
 ansible-core
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Hi Bran,

This is the issue that has been originally reported for this bug. From your logs, I see you installed ansible-core 2.12.0-1, which is the affected version.

To verify the fix, you need to install ansible-core from the -proposed pocket.
Instructions on how to do so are available at https://wiki.ubuntu.com/Testing/EnableProposed.

Please, do verify this new version fixes the issue for you.

Since Sam and I already verified this one, the fix will likely land in jammy in a few days, as long as your test results with the new package version will not show us there is something wrong with this update.

Thanks!

Revision history for this message
Ryan Lue (rlue) wrote :

@Athos Ribeiro,

Installing 2.12.0-1 from jammy-proposed worked for me.

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

This bug was fixed in the package ansible-core - 2.12.0-1ubuntu0.1

---------------
ansible-core (2.12.0-1ubuntu0.1) jammy; urgency=medium

  * d/control: switch build-dep from python3-all to python3. (LP: #1969917)
  * d/t/unit: run DEP8 tests with python 3.10.

 -- Athos Ribeiro <email address hidden> Fri, 12 Aug 2022 09:19:45 -0300

Changed in ansible-core (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Robie Basak (racb) wrote : Update Released

The verification of the Stable Release Update for ansible-core has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.