Disable apt phased updates inside containers.

Inside a chroot, phased updates are disabled [1]. This means that
the container base image always gets the latest packages regardless
of what is happening with the phasing.

At runtime, the default in Ubuntu releases 21.04 and onward is to
obey the package phasing information. This means that packages
inside the OSA built container image can be newer than the installation
candidates once the container is running, leading to installation
errors. This is particularly sensitive with source packages such as
systemd where there is a very tight version coupling between
all components leading to only one valid installation candidate.

This patch creates apt config inside the container base image to
always install the latest package version regardless of phasing.

There does not seem to be any alternative, as phasing is always
disabled during the debootstrap.

[1] https://discourse.ubuntu.com/t/phased-updates-in-apt-in-21-04/20345

Change-Id: Ia558e3aa1447220016c53349cf9dac0b822d06f4
This commit is contained in:
Jonathan Rosser 2022-05-04 18:10:19 +01:00 committed by Dmitriy Rabotyagov
parent 5f47e6d310
commit 3b8d1459b9
1 changed files with 3 additions and 0 deletions

View File

@ -17,6 +17,9 @@ apt-get update
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes eatmydata
export LD_PRELOAD=/usr/lib/{{ ansible_facts['architecture'] }}-linux-gnu/libeatmydata.so
#Chroots are built with phased updates disabled, so we must disable them at runtime to avoid package version errors
echo "APT::Get::Always-Include-Phased-Updates \"true\";" | tee /etc/apt/apt.conf.d/95phased-updates
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes gnupg
apt-get upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes {{ lxc_cache_distro_packages | join(' ') }}