From 1c23d91a3b48149c1dde5c6adf8364d674e837ae Mon Sep 17 00:00:00 2001 From: Jason Ertel Date: Thu, 13 Oct 2022 06:57:17 -0400 Subject: [PATCH] retry up to 25 minutes if APT is locked by an unattended upgrade. This is an increase from 8 minutes. --- setup/so-functions | 12 ++++++------ setup/so-preflight | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/setup/so-functions b/setup/so-functions index 7dfa7b047..985a231e1 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -946,17 +946,17 @@ installer_prereq_packages() { logCmd "systemctl start NetworkManager" elif [ "$OS" == ubuntu ]; then # Print message to stdout so the user knows setup is doing something - retry 50 10 "apt-get update" "" "Err:" >> "$setup_log" 2>&1 || exit 1 + retry 150 10 "apt-get update" "" "Err:" >> "$setup_log" 2>&1 || exit 1 # Install network manager so we can do interface stuff if ! command -v nmcli > /dev/null 2>&1; then - retry 50 10 "apt-get -y install network-manager" >> "$setup_log" 2>&1 || exit 1 + retry 150 10 "apt-get -y install network-manager" >> "$setup_log" 2>&1 || exit 1 { systemctl enable NetworkManager systemctl start NetworkManager } >> "$setup_log" 2<&1 fi if ! command -v curl > /dev/null 2>&1; then - retry 50 10 "apt-get -y install curl" >> "$setup_log" 2>&1 || exit 1 + retry 150 10 "apt-get -y install curl" >> "$setup_log" 2>&1 || exit 1 fi fi } @@ -1827,7 +1827,7 @@ remove_package() { fi else if dpkg -l | grep -q "$package_name"; then - retry 50 10 "apt purge -y \"$package_name\"" + retry 150 10 "apt purge -y \"$package_name\"" fi fi } @@ -2260,8 +2260,8 @@ update_packages() { logCmd "yum -y update --exclude=salt*,wazuh*,docker*,containerd*" logCmd "yum -y install yum-utils" else - retry 50 10 "apt-get -y update" >> "$setup_log" 2>&1 || exit 1 - retry 50 10 "apt-get -y upgrade" >> "$setup_log" 2>&1 || exit 1 + retry 150 10 "apt-get -y update" >> "$setup_log" 2>&1 || exit 1 + retry 150 10 "apt-get -y upgrade" >> "$setup_log" 2>&1 || exit 1 fi } diff --git a/setup/so-preflight b/setup/so-preflight index 59c78c70b..151651077 100755 --- a/setup/so-preflight +++ b/setup/so-preflight @@ -56,7 +56,7 @@ check_default_repos() { printf '%s' 'apt update.' | tee -a "$preflight_log" fi echo "" >> "$preflight_log" - retry 50 10 "apt-get -y update" >> $preflight_log 2>&1 + retry 150 10 "apt-get -y update" >> $preflight_log 2>&1 ret_code=$? [[ $ret_code == 0 ]] && printf '%s\n' ' SUCCESS' || printf '%s\n' ' FAILURE' @@ -161,7 +161,7 @@ preflight_prereqs() { if [[ $OS == 'centos' ]]; then : # no-op to match structure of other checks for $OS var else - retry 50 10 "apt-get -y install curl" >> "$preflight_log" 2>&1 || ret_code=1 + retry 150 10 "apt-get -y install curl" >> "$preflight_log" 2>&1 || ret_code=1 fi return $ret_code