MT#57643 Ensure /var/lib/dpkg/available exists on Debian releases <=buster

Since version 1.20.0, dpkg no longer creates /var/lib/dpkg/available
(see #647911). Now that we upgraded our Grml-Sipwise deployment system
to bookworm, we have dpkg v1.21.22 on our live system, and mmdebstrap
relies on dpkg of the host system for execution.

But on Debian releases until and including buster, dpkg fails to operate
with e.g. `dpkg --set-selections`, if /var/lib/dpkg/available doesn't
exist:

| The following NEW packages will be installed:
|   nullmailer
| [...]
| debconf: delaying package configuration, since apt-utils is not installed
| dpkg: error: failed to open package info file '/var/lib/dpkg/available' for reading: No such file or directory

We *could* also switch from mmdebstrap to debootstrap for deploying
Debian releases <=buster, but this would be slower and we use mmdebstrap
since quite some time for everything. So instead let's create
/var/lib/dpkg/available after bootstrapping the system.

Reported towards mmdebstrap as #1037946.

Change-Id: I0a87ca255d5eb7144a9c093051c0a6a3114a3c0b
mr11.4
Michael Prokop 2 years ago
parent eccdc586ae
commit 0fedba6144

@ -2144,6 +2144,19 @@ if [ -d "${TARGET}/var/lib/apt/lists/auxfiles" ]; then
rmdir "${TARGET}/var/lib/apt/lists/auxfiles"
fi
# MT#57643: dpkg >=1.20.0 (as present on Debian/bookworm and newer) no
# longer creates /var/lib/dpkg/available (see #647911). mmdebstrap relies
# on and uses dpkg of the host system. But on Debian releases until and
# including buster, dpkg fails to operate with e.g. `dpkg
# --set-selections`, if /var/lib/dpkg/available doesn't exist, so let's
# ensure /var/lib/dpkg/available exists on Debian releases <=buster.
case "${DEBIAN_RELEASE}" in
stretch|buster)
echo "Generating /var/lib/dpkg/available to work around dpkg >=1.20.0 issue for Debian release '${DEBIAN_RELEASE}'"
chroot "${TARGET}" /usr/lib/dpkg/methods/apt/update /var/lib/dpkg
;;
esac
# MT#7805
if "$NGCP_INSTALLER" ; then
cat << EOT | augtool --root="$TARGET"

Loading…
Cancel
Save