diff --git a/ansible/files/admin_api_scripts/pg_upgrade_scripts/initiate.sh b/ansible/files/admin_api_scripts/pg_upgrade_scripts/initiate.sh index 6998376a5..2d0909ec4 100755 --- a/ansible/files/admin_api_scripts/pg_upgrade_scripts/initiate.sh +++ b/ansible/files/admin_api_scripts/pg_upgrade_scripts/initiate.sh @@ -375,13 +375,16 @@ EXTRA_NIX_CONF # Fixing erros generated by previous dpkg executions (package upgrades et co) echo "2. Fixing potential errors generated by dpkg" + echo "2.1 Killing off any old hanging apt-get processes" + # One hour is old enough to be bad + pkill -f apt-get --older 3600 2>/dev/null || echo "No hanging apt-get processes found" DEBIAN_FRONTEND=noninteractive dpkg --configure -a --force-confold || true # handle errors generated by dpkg # Needed for PostGIS, since it's compiled with Protobuf-C support now echo "3. Installing libprotobuf-c1 and libicu66 if missing" if [[ ! "$(apt list --installed libprotobuf-c1 | grep "installed")" ]]; then - apt-get update -y - apt --fix-broken install -y libprotobuf-c1 libicu66 || true + apt-get -o DPkg::Lock::Timeout=600 update -y # wait up to 10 minutes for any dpkg locks to clear before updating package lists + apt --fix-broken install -y libprotobuf-c1 libicu66 || true # apt has builtin 2 minute wait lock fi echo "4. Setup locale if required" @@ -400,8 +403,8 @@ EXTRA_NIX_CONF UBUNTU_VERSION=$(lsb_release -rs) # install amazon disk utilities if not present on 24.04 if [ "${UBUNTU_VERSION}" = "24.04" ] && ! /usr/bin/dpkg-query -W amazon-ec2-utils >/dev/null 2>&1; then - apt-get update - apt-get install -y amazon-ec2-utils || true + apt-get -o DPkg::Lock::Timeout=600 update + apt-get -o DPkg::Lock::Timeout=600 install -y amazon-ec2-utils || true fi if command -v ebsnvme-id >/dev/null 2>&1 && /usr/bin/dpkg-query -W amazon-ec2-utils >/dev/null 2>&1; then for nvme_dev in $(lsblk -dprno name,size,mountpoint,type | grep disk | awk '{print $1}'); do