From c621c37622cbc154cfc5b260b433bab18f73b15e Mon Sep 17 00:00:00 2001 From: Manuel Montecelo Date: Tue, 2 Jul 2019 13:11:29 +0200 Subject: [PATCH] TT#61152 Add configuration Acquire::Retries=3, for apt to retry downloads In the event of network blips, HA switchovers or failure of the servers, there might be a problem downloading some of the hundreds or thousands of packages needed for installation. Set the option to retry 3 times in the case of such failures, to try to minimise their impact. This has to be done in several places because mmdebstrap (which uses apt) and apt-get are invoked at different points. Change-Id: I5acbd9895fa37452026e582c241ced945fbba3d7 --- templates/scripts/includes/deployment.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/templates/scripts/includes/deployment.sh b/templates/scripts/includes/deployment.sh index 91d6d8d..6f791a3 100755 --- a/templates/scripts/includes/deployment.sh +++ b/templates/scripts/includes/deployment.sh @@ -321,6 +321,12 @@ ensure_packages_installed() { echo "deb ${DEBIAN_URL}/debian/ buster main contrib non-free" > \ "${TMPDIR}/etc/sources.list" + mkdir -p "${TMPDIR}"/etc/apt/apt.conf.d/ + cat > "${TMPDIR}"/etc/apt/apt.conf.d/73_acquire_retries << EOF +# NGCP_MANAGED_FILE -- deployment.sh +Acquire::Retries "3"; +EOF + DEBIAN_FRONTEND='noninteractive' apt-get \ -o dir::cache="${TMPDIR}/cachedir" \ -o dir::state="${TMPDIR}/statedir" \ @@ -1405,6 +1411,8 @@ DEBOPT_OPTIONS=("--no-merged-usr") # install only "Essential:yes" packages plus apt (explicitly included in minbase variant), # systemd + network related packages DEBOPT_OPTIONS+=("--variant=minbase --include=systemd,systemd-sysv,init,isc-dhcp-client,ifupdown") +# TT#61152 Add configuration Acquire::Retries=3, for apt to retry downloads +DEBOPT_OPTIONS+=("--aptopt='Acquire::Retries \"3\"' ") if [[ -n "${EFI_PARTITION}" ]] ; then if efi_support ; then @@ -1632,6 +1640,12 @@ deb ${MIRROR} ${DEBIAN_RELEASE} main contrib non-free deb ${SEC_MIRROR} ${DEBIAN_RELEASE}-security main contrib non-free deb ${MIRROR} ${DEBIAN_RELEASE}-updates main contrib non-free deb ${DBG_MIRROR} ${DEBIAN_RELEASE}-debug main contrib non-free +EOF + + mkdir -p "${TARGET}"/etc/apt/apt.conf.d/ + cat > "${TARGET}"/etc/apt/apt.conf.d/73_acquire_retries << EOF +# NGCP_MANAGED_FILE -- deployment.sh +Acquire::Retries "3"; EOF }