21.10 to 22.04 upgrade- package dpkg 1.21.1ubuntu2 failed to install/upgrade
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dpkg (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Decided to start my upgrade to 22.04 two days early (2022-04-19) from a fully patched 21.10 on AMD A6-5400K APU with Radeon HD Graphics.
I did do-release-upgrade -d and it failed to finish installing dpkg. This prevented a number of dependent packages from being installed.
Here's the main error, which happens repeatedly with a manual "apt install dpkg":
Preparing to unpack .../dpkg_
Unpacking dpkg (1.21.1ubuntu2) over (1.20.9ubuntu2) ...
Setting up dpkg (1.21.1ubuntu2) ...
Installing new version of config file /etc/cron.
head: error reading 'info.bak': Is a directory
dpkg: error processing package dpkg (--configure):
installed dpkg package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
dpkg
ProblemType: Package
DistroRelease: Ubuntu 21.10
Package: dpkg 1.21.1ubuntu2
ProcVersionSign
Uname: Linux 5.13.0-39-generic x86_64
ApportVersion: 2.20.11-0ubuntu71.1
Architecture: amd64
CasperMD5CheckR
Date: Tue Apr 19 00:47:14 2022
DuplicateSignature:
package:
Installing new version of config file /etc/cron.
head: error reading 'info.bak': Is a directory
dpkg: error processing package dpkg (--configure):
installed dpkg package post-installation script subprocess returned error exit status 1
ErrorMessage: installed dpkg package post-installation script subprocess returned error exit status 1
InstallationDate: Installed on 2018-01-07 (1562 days ago)
InstallationMedia: Ubuntu 17.10 "Artful Aardvark" - Release amd64 (20171018)
Python3Details: /usr/bin/
PythonDetails: /usr/bin/
RebootRequiredPkgs: Error: path contained symlinks.
RelatedPackageV
dpkg 1.21.1ubuntu2
apt 2.3.9
SourcePackage: dpkg
Title: package dpkg 1.21.1ubuntu2 failed to install/upgrade: installed dpkg package post-installation script subprocess returned error exit status 1
UpgradeStatus: Upgraded to impish on 2022-04-19 (0 days ago)
tags: | removed: need-duplicate-check |
Ok I figured it out. You can close this ticket unless you think others might encounter the same issue.
I must have followed instructions like at https:/ /wiki.aleen42. com/qa/ dpkg.html to rename /var/lib/dpkg/info to /var/lib/ dpkg/info. bak, and it was choking on the directory because head can't operate on a directory. I moved /var/lib/ dpkg/info. bak somewhere else and it fixed the problem.
The post install script /var/lib/ dpkg/info/ dpkg.postinst contains the following code that will choke if there is a directory in /var/lib/ dpkg/info/ :
fixup_misplaced _alternatives( ) ${DPKG_ ADMINDIR: -/var/lib/ dpkg}
(
admindir=
cd "$admindir"
for file in *; do available- old|\ methlock| methods| \ diversions- old|\ parts|triggers| updates| \ lock-frontend| \ e|statoverride- old|\ status- old)
# Check whether this is a known file we do not want to act on.
case "$file" in
alternatives|\
arch|\
available|
cmethopt|
diversions|
info|
lock|
statoverrid
status|
# Ignore known files just to make sure.
continue
;;
*)
esac
# Check whether the file looks like an alternative state file. $file"
mode="$(head -1 "$file")"
case "$mode" in
auto|manual)
# Looks like a state file, we will handle this one.
echo "Moving misplaced alternative state file $admindir/$file..."
mv "$file" "alternatives/
;;
*)
echo "warning: unknown dpkg database file $admindir/$file is not a misplaced alternative state... leaving as is" 1>&2
continue
;;
esac
done
)