package libpam-modules 1.3.1-5ubuntu4.6 failed to install/upgrade: new libpam-modules:amd64 package pre-installation script subprocess returned error exit status 2

Asked by Farrokh GHAMSARY

Upgrade from Ubuntu 20.04 to 22.04 which created and error

ProblemType: Package
DistroRelease: Ubuntu 20.04
Package: libpam-modules 1.3.1-5ubuntu4.6
ProcVersionSignature: Ubuntu 5.4.0-148.165-generic 5.4.231
Uname: Linux 5.4.0-148-generic x86_64
ApportVersion: 2.20.11-0ubuntu27.26
Architecture: amd64
CasperMD5CheckResult: skip
Date: Wed May 17 09:02:11 2023
Ec2AMI: ami-00026187
Ec2AMIManifest: FIXME
Ec2AvailabilityZone: nova
Ec2InstanceType: b2-30
Ec2Kernel: unavailable
Ec2Ramdisk: unavailable
ErrorMessage: new libpam-modules:amd64 package pre-installation script subprocess returned error exit status 2
Python3Details: /usr/bin/python3.8, Python 3.8.10, python3-minimal, 3.8.2-0ubuntu2
PythonDetails: N/A
RelatedPackageVersions:
 dpkg 1.21.1ubuntu2.1
 apt 2.0.9
SourcePackage: pam
Title: package libpam-modules 1.3.1-5ubuntu4.6 failed to install/upgrade: new libpam-modules:amd64 package pre-installation script subprocess returned error exit status 2
UpgradeStatus: Upgraded to focal on 2023-05-17 (0 days ago)

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu pam Edit question
Assignee:
No assignee Edit question
Solved by:
Farrokh GHAMSARY
Solved:
Last query:
Last reply:
Revision history for this message
Farrokh GHAMSARY (fghamsary) said :
#1

As already said, this was due to configuration of my machine

Revision history for this message
Manfred Hampl (m-hampl) said :
#2

The key message is:

you are using pam_tally or pam_tally2 in your configuration
The pam_tally and pam_tally2 modules have been removed from PAM. You are using one of these
modules in your PAM configuration in /etc/pam.d. You must remove the uses of these modules
before PAM can be upgraded; including these modules in your PAM configuration after the upgrade

You have to remove the links to pam_tally and pam_tally2 from your /etc/pam.d configuration files (end eventually replace them by pam_faillock). Then you can re-try the install/update of the new pam package.

see also https://askubuntu.com/a/1410181

What is the output of the command
grep tally /etc/pam.d/*

Revision history for this message
Farrokh GHAMSARY (fghamsary) said :
#3

Thanks I figured it out afterwards, and changed the configuration.
As I already marked on the question as well.
The problem was that it was in the middle of do-release-upgrade, so all the process have been stopped, but it could have been changed somehow so that the process will not be stopped.
As the do-release-upgrade have been stopped completely, I had to do the upgrade manually from there on.

Nothing impossible but, some supplementary steps not to forget as well.