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
changes/25/31125/4
Manuel Montecelo 6 years ago
parent 9c5343a071
commit c621c37622

@ -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
}

Loading…
Cancel
Save