Your message dated Mon, 5 Aug 2024 00:18:16 -0700
with message-id 
<CAOU6tAAvS=0dA_DWGO6ZnLQP0bUNU+9VokNdj9rDQ=xodms...@mail.gmail.com>
and subject line Re: Bug#1077942: bash: unable to execute installed bash 
package post-installation script (/var/lib/dpkg/info/bash.postinst): No such 
file or directory
has caused the Debian Bug report #1077942,
regarding bash: unable to execute installed bash package post-installation 
script (/var/lib/dpkg/info/bash.postinst): No such file or directory
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1077942: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1077942
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: bash
Version: 5.2.21-2.1

Hi!

I noticed CI failing on:

Preparing to unpack .../bash_5.2.21-2.1_amd64.deb ...
Unpacking bash (5.2.21-2.1) over (5.0-4) ...
Setting up bash (5.2.21-2.1) ...
dpkg (subprocess): unable to execute installed bash package
post-installation script (/var/lib/dpkg/info/bash.postinst): No such
file or directory
dpkg: error processing package bash (--configure):
 installed bash package post-installation script subprocess returned
error exit status 2
Errors were encountered while processing:
 bash

The file does exist:
# ls -la /var/lib/dpkg/info/bash.postinst
-rwxr-xr-x 1 root root 486 Jun  5 15:19 /var/lib/dpkg/info/bash.postinst

I tied adding the executable bit and fixing the extra space in the
shebang line but neither had any effect:

# chmod +x /var/lib/dpkg/info/bash.postinst
# sed 's|#! /bin/bash|#!/bin/bash|' -i /var/lib/dpkg/info/bash.postinst
# apt-get install -qq --fix-missing
Setting up bash (5.2.21-2.1) ...
dpkg (subprocess): unable to execute installed bash package
post-installation script (/var/lib/dpkg/info/bash.postinst): No such
file or directory
dpkg: error processing package bash (--configure):
 installed bash package post-installation script subprocess returned
error exit status 2
Errors were encountered while processing:
 bash

Any suggestions what might be going on?


PS. I would be happy to help with the package maintenance and building
a CI for it if you in future decide to host the sources on
salsa.debian.org instead of Bazaar
(https://qa.debian.org/cgi-bin/vcswatch?package=bash).

--- End Message ---
--- Begin Message ---
Hi!

Sorry for the wrong alarm. This was due to the usrmerge upgrade and
root cause was the shebang referring to #!/bin/bash at a time in the
upgrade process when it didn't exist.

Closing issue.

*****
Notes:

Running this hack confirms the finding, as after that the upgrade proceeds:

sed 's|#!/bin/dash|#!/usr/bin/dash|' -i /var/lib/dpkg/info/*.postinst
sed 's|#!/bin/bash|#!/usr/bin/bash|' -i /var/lib/dpkg/info/*.postinst
sed 's|#! /bin/bash|#!/usr/bin/bash|' -i /var/lib/dpkg/info/*.postinst
sed 's|#!/bin/sh|#!/usr/bin/sh|' -i /var/lib/dpkg/info/*.postinst
sed 's|#! /bin/sh|#!/usr/bin/sh|' -i /var/lib/dpkg/info/*.postinst

..the underlying issue is however attempting to upgrade in a container
jumping over a release, which is by design not supported.

If anybody reading this absolutely needs to hack a CI system to test
upgrades despite jumping over releases, the CI code in
https://salsa.debian.org/debian/entr/-/merge_requests/6 contains an
example of how to do it.

script:

.test-enable-sid-repos: &test-enable-sid-repos
  # Install tools that may be needed to circumvent issues in the upgrade
  - apt-get install -qq --yes --no-install-recommends ca-certificates curl
  # Replace any old repos with just Sid, and trust blindly as old
Debian releases won't have latest Sid in their keyring
  - echo 'deb [trusted=yes] http://deb.debian.org/debian sid main' >
/etc/apt/sources.list
  # Upgrade minimal stack first
  - apt-get update -q
  - apt-get install -q --yes apt || export APT_STATUS="failed"
  # Upgrades from Bullseye (or older) to Trixie (or newer) will pull in
  # base-files 13.4+, which fails on:
  #   Preparing to unpack .../base-files_13.4_amd64.deb ...
  #   *************************************************************************
  #   *
  #   * The base-files package cannot be installed because
  #   * /bin is a directory, but should be a symbolic link.
  #   *
  #   * Please install the usrmerge package to convert this system to
merged-/usr.
  #   *
  #   * For more information please read https://wiki.debian.org/UsrMerge.
  #   *
  #   *************************************************************************
  # Therefore, an older base-files must be used:
  - |
    if [ "$APT_STATUS" = "failed" ]
    then
      curl -sLO
https://snapshot.debian.org/archive/debian/20240531T083821Z/pool/main/b/base-files/base-files_13.2_amd64.deb
      # Apt version in Jessie does not support 'apt install
./package.deb', use this only for Stretch or newer
      apt-get install -q --yes --no-install-recommends
./base-files_13.2_amd64.deb || true
      # Ensure upgrades past 13.2 are blocked to avoid failure on usrmerge issue
      apt-mark hold base-files
      apt-get install -q --yes --fix-broken apt
    fi || export BASE_FILES_STATUS="failed"
  # Latest apt attempts to pull in latest libc6, which fails on:
  #   libc6 : Breaks: base-files (< 13.3~) but 13.2 is to be installed
  # Therefore, older libc6 and it's dependency libc6-bin must be used:
  - |
    if [ "$BASE_FILES_STATUS" = "failed" ]
    then
      curl -sLO
https://snapshot.debian.org/archive/debian/20240531T083821Z/pool/main/g/glibc/libc6_2.38-11_amd64.deb
      curl -sLO
https://snapshot.debian.org/archive/debian/20240531T083821Z/pool/main/g/glibc/libc-bin_2.38-11_amd64.deb
      # Apt version in Jessie does not support 'apt install
./package.deb', use this only for Stretch or newer
      apt-get install -q --yes --no-install-recommends
./libc6_2.38-11_amd64.deb ./libc-bin_2.38-11_amd64.deb || true
      # Ensure upgrades past 2.38-11 are blocked to avoid failure on
usrmerge issue
      apt-mark hold libc6 libc-bin
      apt-get install -q --yes --fix-broken apt
    fi || export LIBC_STATUS="failed"
  # Due to https://bugs.debian.org/993755 and #975077 upgrades from Buster
  # (or older) to Bookworm (or newer) fails on:
  #   /usr/bin/perl: error while loading shared libraries: libcrypt.so.1: cannot
  #     open shared object file: No such file or directory
  #   dpkg: error processing package libc6:amd64 (--configure):
  # Therefore, the workaround in
  # 
https://www.debian.org/releases/bookworm/amd64/release-notes/ch-information.en.html#libcrypt-upgrade-from-buster
  # needs to be applied:
  - |
    if [ "$LIBC_STATUS" = "failed" ]
    then
      cd $(mktemp -d) # Use temp dir where apt can download and unpack files
      apt-get -q --yes download libcrypt1
      dpkg-deb -x libcrypt1_*.deb .
      cp -ra usr/lib/* /lib/ || true # libcrypt 1:4.4.36-3+
      cd - # Back to CI run directory
      find /lib/*/libcrypt.* -ls # Show that new libcrypt is there
      apt-mark unhold libc6 libc-bin
      apt-get install -q --yes --fix-broken --no-install-recommends
./libc6_2.38-11_amd64.deb ./libc-bin_2.38-11_amd64.deb || true
      # Ensure upgrades past 2.38-11 are blocked to avoid failure on
usrmerge issue
      apt-mark hold libc6 libc-bin
      apt-get install -q --yes apt
    fi
  # If system has not undergone usrmerge upgrade, don't attempt it in
CI containers
  - test -L /bin || apt-mark hold usrmerge usr-is-merged
  # For debugging purposes show what packages are now on hold
  - apt-mark showhold
  # Update base system
  - |
    # Upgrading from Stretch will fail on conflicts with util-linux:
    #   dpkg: error processing archive
/var/cache/apt/archives/util-linux_2.40.2-1_amd64.deb (--unpack):
    #     trying to overwrite '/etc/pam.d/su', which is also in
package login 1:4.4-4.1+deb9u1
    #   dpkg: error processing archive
/var/cache/apt/archives/util-linux_2.40.2-1_amd64.deb (--unpack):
    #     trying to overwrite
'/usr/share/bash-completion/completions/findmnt', which is also in
package mount 2.29.2-1+deb9u1
    # Circumvent this by removing the conflicting packages first, as they are
    # not essential for the upgrade to run.
    apt-get remove login mount --yes --allow-remove-essential || true
  - |
    # First 'apt-get upgrade' run fails on:
    #   dpkg (subprocess): unable to execute installed bash package
post-installation script (/var/lib/dpkg/info/bash.postinst): No such
file or directory
    # Second run fails on:
    #   dpkg (subprocess): unable to execute installed dash package
post-installation script (/var/lib/dpkg/info/dash.postinst): No such
file or directory
    # Third run fails on:
    #   update-alternatives: error: alternative path /bin/more doesn't exist
    # Repeat upgrade attempts until passes
    function usrmerge-temp-fix {
      for x in bash dash sh more cp ln sleep
      do
        if [ -x /usr/bin/$x ]
        then
          cp -av /usr/bin/$x /bin/
        fi
      done
    }
    until apt-get install -q --yes bash dash util-linux coreutils
lsb-base login mount
    do
      test -f /bin/cp || /usr/bin/cp -av /usr/bin/cp /bin
      usrmerge-temp-fix || true
    done

--- End Message ---

Reply via email to