From 3b8d1459b934e40f7c2a9656b0d592a8c34dce8a Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Wed, 4 May 2022 18:10:19 +0100 Subject: [PATCH] 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 --- templates/prep-scripts/debian_prep.sh.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/prep-scripts/debian_prep.sh.j2 b/templates/prep-scripts/debian_prep.sh.j2 index 24eb0d12..31a9325b 100644 --- a/templates/prep-scripts/debian_prep.sh.j2 +++ b/templates/prep-scripts/debian_prep.sh.j2 @@ -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(' ') }}