From 9b625cac606dcfa97aa8a5fdfc702fb97f3ec08d Mon Sep 17 00:00:00 2001 From: Konstantin Vasin Date: Fri, 18 Nov 2022 19:36:47 +0300 Subject: [PATCH] [Build] set apt Acquire::Retries to 3 for bullseye There were some changes in apt source code in version 2.1.9. As a result apt used in bullseye (2.2.4) is intolerant to network issues. This was fixed in https://salsa.debian.org/apt-team/apt/-/commit/10631550f1f9788bdfd64d2434237a1448ab0626 Already fixed version is used bookworm (2.5.4) And not yet affected version is used in buster (1.8.2.3) Ref: https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1876035 Signed-off-by: Konstantin Vasin --- build_debian.sh | 2 +- dockers/docker-base-bullseye/Dockerfile.j2 | 1 + dockers/docker-base-bullseye/apt-multiple-retries | 4 ++++ files/apt/apt.conf.d/apt-multiple-retries | 4 ++++ sonic-slave-bullseye/Dockerfile.j2 | 1 + sonic-slave-bullseye/apt-multiple-retries | 4 ++++ 6 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 dockers/docker-base-bullseye/apt-multiple-retries create mode 100644 files/apt/apt.conf.d/apt-multiple-retries create mode 100644 sonic-slave-bullseye/apt-multiple-retries diff --git a/build_debian.sh b/build_debian.sh index c4d748ac4d21..fe31c442e6b3 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -110,7 +110,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT mount ## Pointing apt to public apt mirrors and getting latest packages, needed for latest security updates scripts/build_mirror_config.sh files/apt $CONFIGURED_ARCH $IMAGE_DISTRO sudo cp files/apt/sources.list.$CONFIGURED_ARCH $FILESYSTEM_ROOT/etc/apt/sources.list -sudo cp files/apt/apt.conf.d/{81norecommends,apt-{clean,gzip-indexes,no-languages},no-check-valid-until} $FILESYSTEM_ROOT/etc/apt/apt.conf.d/ +sudo cp files/apt/apt.conf.d/{81norecommends,apt-{clean,gzip-indexes,no-languages},no-check-valid-until,apt-multiple-retries} $FILESYSTEM_ROOT/etc/apt/apt.conf.d/ ## Note: set lang to prevent locale warnings in your chroot sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y update diff --git a/dockers/docker-base-bullseye/Dockerfile.j2 b/dockers/docker-base-bullseye/Dockerfile.j2 index c237015500df..6f124b7cdb48 100644 --- a/dockers/docker-base-bullseye/Dockerfile.j2 +++ b/dockers/docker-base-bullseye/Dockerfile.j2 @@ -30,6 +30,7 @@ COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"] COPY ["sources.list.{{ CONFIGURED_ARCH }}", "/etc/apt/sources.list"] COPY ["no_install_recommend_suggest", "/etc/apt/apt.conf.d"] COPY ["no-check-valid-until", "/etc/apt/apt.conf.d"] +COPY ["apt-multiple-retries", "/etc/apt/apt.conf.d"] # Update apt cache and # pre-install fundamental packages diff --git a/dockers/docker-base-bullseye/apt-multiple-retries b/dockers/docker-base-bullseye/apt-multiple-retries new file mode 100644 index 000000000000..c4c638252f92 --- /dev/null +++ b/dockers/docker-base-bullseye/apt-multiple-retries @@ -0,0 +1,4 @@ +# Instruct apt to retry downloads on failures +# This is required only for bullseye. + +Acquire::Retries "3"; diff --git a/files/apt/apt.conf.d/apt-multiple-retries b/files/apt/apt.conf.d/apt-multiple-retries new file mode 100644 index 000000000000..c4c638252f92 --- /dev/null +++ b/files/apt/apt.conf.d/apt-multiple-retries @@ -0,0 +1,4 @@ +# Instruct apt to retry downloads on failures +# This is required only for bullseye. + +Acquire::Retries "3"; diff --git a/sonic-slave-bullseye/Dockerfile.j2 b/sonic-slave-bullseye/Dockerfile.j2 index b22639e8318b..f4f24d847e84 100644 --- a/sonic-slave-bullseye/Dockerfile.j2 +++ b/sonic-slave-bullseye/Dockerfile.j2 @@ -22,6 +22,7 @@ FROM {{ prefix }}debian:bullseye MAINTAINER gulv@microsoft.com COPY ["no-check-valid-until", "/etc/apt/apt.conf.d/"] +COPY ["apt-multiple-retries", "/etc/apt/apt.conf.d/"] {%- if CROSS_BUILD_ENVIRON != "y" %} COPY ["sources.list.{{ CONFIGURED_ARCH }}", "/etc/apt/sources.list"] diff --git a/sonic-slave-bullseye/apt-multiple-retries b/sonic-slave-bullseye/apt-multiple-retries new file mode 100644 index 000000000000..c4c638252f92 --- /dev/null +++ b/sonic-slave-bullseye/apt-multiple-retries @@ -0,0 +1,4 @@ +# Instruct apt to retry downloads on failures +# This is required only for bullseye. + +Acquire::Retries "3";