[Bug 1969421] Re: 21.10 to 22.04 upgrade- package dpkg 1.21.1ubuntu2 failed to install/upgrade

Mike 1969421 at bugs.launchpad.net
Tue Apr 19 06:24:56 UTC 2022


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
Foundations Bugs, which is subscribed to dpkg in Ubuntu.
https://bugs.launchpad.net/bugs/1969421

Title:
  21.10 to 22.04 upgrade- package dpkg 1.21.1ubuntu2 failed to
  install/upgrade

Status in dpkg package in Ubuntu:
  New

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_1.21.1ubuntu2_amd64.deb ...
  Unpacking dpkg (1.21.1ubuntu2) over (1.20.9ubuntu2) ...
  Setting up dpkg (1.21.1ubuntu2) ...
  Installing new version of config file /etc/cron.daily/dpkg ...
  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
  ProcVersionSignature: Ubuntu 5.13.0-39.44-generic 5.13.19
  Uname: Linux 5.13.0-39-generic x86_64
  ApportVersion: 2.20.11-0ubuntu71.1
  Architecture: amd64
  CasperMD5CheckResult: unknown
  Date: Tue Apr 19 00:47:14 2022
  DuplicateSignature:
   package:dpkg:1.21.1ubuntu2
   Installing new version of config file /etc/cron.daily/dpkg ...
   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/python3.10, Python 3.10.4, python3-minimal, 3.10.4-0ubuntu2
  PythonDetails: /usr/bin/python3.10, Python 3.10.4, python-is-python3, 3.9.2-1
  RebootRequiredPkgs: Error: path contained symlinks.
  RelatedPackageVersions:
   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)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/1969421/+subscriptions




More information about the foundations-bugs mailing list