From: Michael Prokop Date: Tue, 10 Sep 2019 09:05:05 +0000 (+0200) Subject: Rebuild /var/lib/dpkg/available to install not-yet-installed packages in update runs X-Git-Tag: v0.34.2~1 X-Git-Url: http://git.grml.org/?p=grml-live.git;a=commitdiff_plain;h=ef74e870ca6a2b6f307d6390d7fb9f6964299551 Rebuild /var/lib/dpkg/available to install not-yet-installed packages in update runs When executing grml-live in update mode (grml-live [...] -u) using an existing grml_chroot, then script GRMLBASE/98-clean-chroot has emptied /var/lib/dpkg/available in a previous run already. Executing `apt-get update` does NOT re-generate the file. This leads to FAI's install_packages with its mkpackagelist() and clean_pkg_list() failing to install requested packages, but reporting all packages with: | WARNING: These unknown packages are removed from the installation list: [...] This is unexpected, as an update run shouldn't just update existing packages, but also try to install any additionally requested packages from the software selection (as a package might not have been installed due to missing dependencies, that have been taken care of in the meanwhile). So if we'd detect an existing /var/lib/dpkg/available that is empty, then we would have to rebuild it using /usr/lib/dpkg/methods/apt/update. Since /usr/lib/dpkg/methods/apt/update essentially also executes 'apt-get update' underneath, there's no need to run 'apt-get update' only with empty /var/lib/dpkg/available, instead let's always rely on /usr/lib/dpkg/methods/apt/update. --- diff --git a/etc/grml/fai/config/hooks/instsoft.GRMLBASE b/etc/grml/fai/config/hooks/instsoft.GRMLBASE index eb0204a..c9932d8 100755 --- a/etc/grml/fai/config/hooks/instsoft.GRMLBASE +++ b/etc/grml/fai/config/hooks/instsoft.GRMLBASE @@ -60,9 +60,11 @@ EOF $ROOTCMD ln -s /bin/true /usr/sbin/grub-probe fi - # Update package lists (so they exist at all), so we actually can - # install software. - $ROOTCMD apt-get update + # Update package lists (so they exist at all), so we can install + # software; if /var/lib/dpkg/available is empty, it was was probably + # cleaned by GRMLBASE/98-clean-chroot, so we need to rebuild it + # anyway + $ROOTCMD /usr/lib/dpkg/methods/apt/update /var/lib/dpkg/ apt apt if $FILE_RC ; then echo "Installing file-rc as FILE_RC class is enabled."