diff --git a/templates/scripts/includes/deployment.sh b/templates/scripts/includes/deployment.sh index 8ba9d3c..83fb20f 100755 --- a/templates/scripts/includes/deployment.sh +++ b/templates/scripts/includes/deployment.sh @@ -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"