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()
(
admindir=${DPKG_ADMINDIR:-/var/lib/dpkg}
cd "$admindir"
for file in *; do
# Check whether this is a known file we do not want to act on.
case "$file" in
alternatives|\
arch|\
available|available-old|\
cmethopt|methlock|methods|\
diversions|diversions-old|\
info|parts|triggers|updates|\
lock|lock-frontend|\
statoverride|statoverride-old|\
status|status-old)
# Ignore known files just to make sure.
continue
;;
*)
esac
# Check whether the file looks like an alternative state 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/$file"
;;
*)
echo "warning: unknown dpkg database file $admindir/$file is not a
misplaced alternative state... leaving as is" 1>&2
continue
;;
esac
done
)
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1969421
Title:
21.10 to 22.04 upgrade- package dpkg 1.21.1ubuntu2 failed to
install/upgrade
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/1969421/+subscriptions
--
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs