Skip to content

Commit

Permalink
[Build] set apt Acquire::Retries to 3 for bullseye (sonic-net#12758)
Browse files Browse the repository at this point in the history
Why I did it
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 in bookworm (2.5.4)
And not yet affected version is used in buster (1.8.2.3)

How I did it
Set Acquire::Retries to 3 for sonic-slave-bullseye, docker-base-bullseye and final Debian image.

Ref: https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1876035

Signed-off-by: Konstantin Vasin [email protected]
  • Loading branch information
kv-y authored and StormLiangMS committed Dec 8, 2022
1 parent bf57d5e commit 00ecfc1
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions dockers/docker-base-bullseye/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions dockers/docker-base-bullseye/apt-multiple-retries
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Instruct apt to retry downloads on failures
# This is required only for bullseye.

Acquire::Retries "3";
4 changes: 4 additions & 0 deletions files/apt/apt.conf.d/apt-multiple-retries
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Instruct apt to retry downloads on failures
# This is required only for bullseye.

Acquire::Retries "3";
1 change: 1 addition & 0 deletions sonic-slave-bullseye/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ FROM {{ prefix }}debian:bullseye
MAINTAINER [email protected]

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"]
Expand Down
4 changes: 4 additions & 0 deletions sonic-slave-bullseye/apt-multiple-retries
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Instruct apt to retry downloads on failures
# This is required only for bullseye.

Acquire::Retries "3";

0 comments on commit 00ecfc1

Please sign in to comment.