From 0f69edf79585c0e9d61faa5da6720d336963e9af Mon Sep 17 00:00:00 2001 From: Ladar Levison Date: Mon, 30 Oct 2023 15:03:45 -0500 Subject: [PATCH] Trying updated apt service masking on Ubuntu 20.04+ to reduce build failures. --- scripts/ubuntu2004/apt.sh | 37 ++++++++++++++++++++++++++++++++--- scripts/ubuntu2004/cleanup.sh | 14 +++++++++---- scripts/ubuntu2010/apt.sh | 22 ++++++++++++++++----- scripts/ubuntu2010/cleanup.sh | 19 +++++++++--------- scripts/ubuntu2104/apt.sh | 22 ++++++++++++++++----- scripts/ubuntu2104/cleanup.sh | 19 +++++++++--------- scripts/ubuntu2110/apt.sh | 23 +++++++++++++++++----- scripts/ubuntu2110/cleanup.sh | 19 +++++++++--------- scripts/ubuntu2204/apt.sh | 22 ++++++++++++++++----- scripts/ubuntu2204/cleanup.sh | 19 +++++++++--------- scripts/ubuntu2210/apt.sh | 22 ++++++++++++++++----- scripts/ubuntu2210/cleanup.sh | 19 +++++++++--------- scripts/ubuntu2304/apt.sh | 22 ++++++++++++++++----- scripts/ubuntu2304/cleanup.sh | 19 +++++++++--------- scripts/ubuntu2310/apt.sh | 22 ++++++++++++++++----- scripts/ubuntu2310/cleanup.sh | 19 +++++++++--------- 16 files changed, 227 insertions(+), 112 deletions(-) diff --git a/scripts/ubuntu2004/apt.sh b/scripts/ubuntu2004/apt.sh index c31c210ec..49ffe10ce 100644 --- a/scripts/ubuntu2004/apt.sh +++ b/scripts/ubuntu2004/apt.sh @@ -60,9 +60,40 @@ printf "APT::Periodic::Enable \"0\";\n" >> /etc/apt/apt.conf.d/10periodic printf "APT::Acquire::Retries \"0\";\n" >> /etc/apt/apt.conf.d/20retries fi -# Keep the daily apt updater from deadlocking our installs. -systemctl stop apt-daily.service apt-daily.timer -systemctl stop snapd.service snapd.socket + +# Stop the active services/timers. +systemctl --quiet is-active apt-daily.timer && systemctl stop apt-daily.timer +systemctl --quiet is-active apt-daily-upgrade.timer && systemctl stop apt-daily-upgrade.timer +systemctl --quiet is-active update-notifier-download.timer && systemctl stop update-notifier-download.timer + +systemctl --quiet is-active apt-news.service && systemctl stop apt-news.service +systemctl --quiet is-active apt-daily.service && systemctl stop apt-daily.service +systemctl --quiet is-active apt-daily-upgrade.service && systemctl stop apt-daily-upgrade.service + +systemctl --quiet is-active snapd.service && systemctl stop snapd.service + +systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service +systemctl --quiet is-active packagekit-offline-update.service && systemctl stop packagekit.service + +systemctl --quiet is-active unattended-upgrades.service && systemctl stop unattended-upgrades.service +systemctl --quiet is-active update-notifier-download.service && systemctl stop update-notifier-download.service + +# Disable them so they don't restart. +systemctl --quiet is-enabled apt-daily.timer && systemctl disable apt-daily.timer +systemctl --quiet is-enabled apt-daily-upgrade.timer && systemctl disable apt-daily-upgrade.timer +systemctl --quiet is-enabled update-notifier-download.timer && systemctl disable update-notifier-download.timer + +systemctl --quiet is-enabled apt-news.service && systemctl mask apt-news.service +systemctl --quiet is-enabled apt-daily.service && systemctl mask apt-daily.service +systemctl --quiet is-enabled apt-daily-upgrade.service && systemctl mask apt-daily-upgrade.service + +systemctl --quiet is-enabled packagekit.service && systemctl mask packagekit.service +systemctl --quiet is-enabled packagekit-offline-update.service && systemctl mask packagekit-offline-update.service + +systemctl --quiet is-enabled snapd.service && systemctl mask snapd.service + +systemctl --quiet is-enabled unattended-upgrades.service && systemctl mask unattended-upgrades.service +systemctl --quiet is-enabled update-notifier-download.service && systemctl mask update-notifier-download.service # Update the package database. retry apt-get --assume-yes -o Dpkg::Options::="--force-confnew" update; error diff --git a/scripts/ubuntu2004/cleanup.sh b/scripts/ubuntu2004/cleanup.sh index a87f4ea30..b32500a69 100644 --- a/scripts/ubuntu2004/cleanup.sh +++ b/scripts/ubuntu2004/cleanup.sh @@ -11,10 +11,6 @@ error() { export DEBIAN_FRONTEND=noninteractive export DEBCONF_NONINTERACTIVE_SEEN=true -# Keep the daily apt updater from deadlocking our installs. -systemctl stop apt-daily.service apt-daily.timer -systemctl stop snapd.service snapd.socket snapd.refresh.timer - # We should be able to run the following, but removing popularity-contest also removes the ubuntu-standard # package. The latter package contents are trivial, as it only contains a copyright notice, but its # presence signifies that the system is a "standard" Ubuntu installation, so we leave it be. @@ -34,3 +30,13 @@ apt-get --assume-yes purge; error # Removethe random seed so a unique value is used the first time the box is booted. systemctl --quiet is-active systemd-random-seed.service && systemctl stop systemd-random-seed.service [ -f /var/lib/systemd/random-seed ] && rm --force /var/lib/systemd/random-seed + +# *Unmask anything we might have masked in the apt module. +[ "$(systemctl is-enabled apt-news.service)" == "masked" ] && systemctl unmask apt-news.service +[ "$(systemctl is-enabled apt-daily.service)" == "masked" ] && systemctl unmask apt-daily.service +# [ "$(systemctl is-enabled apt-daily-upgrade.service)" == "masked" ] && systemctl unmask apt-daily-upgrade.service + +[ "$(systemctl is-enabled packagekit.service)" == "masked" ] && systemctl unmask packagekit.service +[ "$(systemctl is-enabled packagekit-offline-update.service)" == "masked" ] && systemctl unmask packagekit-offline-update.service + +[ "$(systemctl is-enabled snapd.service)" == "masked" ] && systemctl unmask snapd.service diff --git a/scripts/ubuntu2010/apt.sh b/scripts/ubuntu2010/apt.sh index 562c29f8e..780269882 100644 --- a/scripts/ubuntu2010/apt.sh +++ b/scripts/ubuntu2010/apt.sh @@ -94,16 +94,20 @@ EOF fi -# Keep the daily apt updater from deadlocking our the upgrade/install commands we are about to run. -# systemctl --quiet is-active snapd.service && systemctl stop snapd.service snapd.socket - # Stop the active services/timers. systemctl --quiet is-active apt-daily.timer && systemctl stop apt-daily.timer systemctl --quiet is-active apt-daily-upgrade.timer && systemctl stop apt-daily-upgrade.timer systemctl --quiet is-active update-notifier-download.timer && systemctl stop update-notifier-download.timer + +systemctl --quiet is-active apt-news.service && systemctl stop apt-news.service systemctl --quiet is-active apt-daily.service && systemctl stop apt-daily.service -systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service systemctl --quiet is-active apt-daily-upgrade.service && systemctl stop apt-daily-upgrade.service + +systemctl --quiet is-active snapd.service && systemctl stop snapd.service + +systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service +systemctl --quiet is-active packagekit-offline-update.service && systemctl stop packagekit.service + systemctl --quiet is-active unattended-upgrades.service && systemctl stop unattended-upgrades.service systemctl --quiet is-active update-notifier-download.service && systemctl stop update-notifier-download.service @@ -111,9 +115,17 @@ systemctl --quiet is-active update-notifier-download.service && systemctl stop u systemctl --quiet is-enabled apt-daily.timer && systemctl disable apt-daily.timer systemctl --quiet is-enabled apt-daily-upgrade.timer && systemctl disable apt-daily-upgrade.timer systemctl --quiet is-enabled update-notifier-download.timer && systemctl disable update-notifier-download.timer -systemctl --quiet is-enabled unattended-upgrades.service && systemctl disable unattended-upgrades.service + +systemctl --quiet is-enabled apt-news.service && systemctl mask apt-news.service systemctl --quiet is-enabled apt-daily.service && systemctl mask apt-daily.service systemctl --quiet is-enabled apt-daily-upgrade.service && systemctl mask apt-daily-upgrade.service + +systemctl --quiet is-enabled packagekit.service && systemctl mask packagekit.service +systemctl --quiet is-enabled packagekit-offline-update.service && systemctl mask packagekit-offline-update.service + +systemctl --quiet is-enabled snapd.service && systemctl mask snapd.service + +systemctl --quiet is-enabled unattended-upgrades.service && systemctl mask unattended-upgrades.service systemctl --quiet is-enabled update-notifier-download.service && systemctl mask update-notifier-download.service # Truncate the sources list in order to force a status purge. diff --git a/scripts/ubuntu2010/cleanup.sh b/scripts/ubuntu2010/cleanup.sh index 3d53d4889..775203f8b 100644 --- a/scripts/ubuntu2010/cleanup.sh +++ b/scripts/ubuntu2010/cleanup.sh @@ -11,16 +11,6 @@ error() { export DEBIAN_FRONTEND=noninteractive export DEBCONF_NONINTERACTIVE_SEEN=true -# Keep the daily apt updater from deadlocking our cleanup commands. -systemctl --quiet is-active snapd.service && systemctl stop snapd.service snapd.socket -systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service -systemctl --quiet is-active apt-daily.timer && systemctl stop apt-daily.timer -systemctl --quiet is-active apt-daily.service && systemctl stop apt-daily.service -systemctl --quiet is-active apt-daily-upgrade.timer && systemctl stop apt-daily-upgrade.timer -systemctl --quiet is-active apt-daily-upgrade.service && systemctl stop apt-daily-upgrade.service -systemctl --quiet is-active unattended-upgrades.service && systemctl stop unattended-upgrades.service -systemctl --quiet is-active update-notifier-donwload.service && systemctl stop update-notifier-donwload.service - # Remove cloud init packages. dpkg -l eatmydata &>/dev/null && apt-get --assume-yes purge eatmydata dpkg -l libeatmydata1 &>/dev/null && apt-get --assume-yes purge libeatmydata1 @@ -67,3 +57,12 @@ sed -i '/old-releases.ubuntu.com/d' /etc/hosts systemctl --quiet is-active systemd-random-seed.service && systemctl stop systemd-random-seed.service [ -f /var/lib/systemd/random-seed ] && rm --force /var/lib/systemd/random-seed +# *Unmask anything we might have masked in the apt module. +[ "$(systemctl is-enabled apt-news.service)" == "masked" ] && systemctl unmask apt-news.service +[ "$(systemctl is-enabled apt-daily.service)" == "masked" ] && systemctl unmask apt-daily.service +# [ "$(systemctl is-enabled apt-daily-upgrade.service)" == "masked" ] && systemctl unmask apt-daily-upgrade.service + +[ "$(systemctl is-enabled packagekit.service)" == "masked" ] && systemctl unmask packagekit.service +[ "$(systemctl is-enabled packagekit-offline-update.service)" == "masked" ] && systemctl unmask packagekit-offline-update.service + +[ "$(systemctl is-enabled snapd.service)" == "masked" ] && systemctl unmask snapd.service diff --git a/scripts/ubuntu2104/apt.sh b/scripts/ubuntu2104/apt.sh index 672774d5d..98547ac02 100644 --- a/scripts/ubuntu2104/apt.sh +++ b/scripts/ubuntu2104/apt.sh @@ -94,16 +94,20 @@ EOF fi -# Keep the daily apt updater from deadlocking our the upgrade/install commands we are about to run. -# systemctl --quiet is-active snapd.service && systemctl stop snapd.service snapd.socket - # Stop the active services/timers. systemctl --quiet is-active apt-daily.timer && systemctl stop apt-daily.timer systemctl --quiet is-active apt-daily-upgrade.timer && systemctl stop apt-daily-upgrade.timer systemctl --quiet is-active update-notifier-download.timer && systemctl stop update-notifier-download.timer + +systemctl --quiet is-active apt-news.service && systemctl stop apt-news.service systemctl --quiet is-active apt-daily.service && systemctl stop apt-daily.service -systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service systemctl --quiet is-active apt-daily-upgrade.service && systemctl stop apt-daily-upgrade.service + +systemctl --quiet is-active snapd.service && systemctl stop snapd.service + +systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service +systemctl --quiet is-active packagekit-offline-update.service && systemctl stop packagekit.service + systemctl --quiet is-active unattended-upgrades.service && systemctl stop unattended-upgrades.service systemctl --quiet is-active update-notifier-download.service && systemctl stop update-notifier-download.service @@ -111,9 +115,17 @@ systemctl --quiet is-active update-notifier-download.service && systemctl stop u systemctl --quiet is-enabled apt-daily.timer && systemctl disable apt-daily.timer systemctl --quiet is-enabled apt-daily-upgrade.timer && systemctl disable apt-daily-upgrade.timer systemctl --quiet is-enabled update-notifier-download.timer && systemctl disable update-notifier-download.timer -systemctl --quiet is-enabled unattended-upgrades.service && systemctl disable unattended-upgrades.service + +systemctl --quiet is-enabled apt-news.service && systemctl mask apt-news.service systemctl --quiet is-enabled apt-daily.service && systemctl mask apt-daily.service systemctl --quiet is-enabled apt-daily-upgrade.service && systemctl mask apt-daily-upgrade.service + +systemctl --quiet is-enabled packagekit.service && systemctl mask packagekit.service +systemctl --quiet is-enabled packagekit-offline-update.service && systemctl mask packagekit-offline-update.service + +systemctl --quiet is-enabled snapd.service && systemctl mask snapd.service + +systemctl --quiet is-enabled unattended-upgrades.service && systemctl mask unattended-upgrades.service systemctl --quiet is-enabled update-notifier-download.service && systemctl mask update-notifier-download.service # Truncate the sources list in order to force a status purge. diff --git a/scripts/ubuntu2104/cleanup.sh b/scripts/ubuntu2104/cleanup.sh index 3d53d4889..775203f8b 100644 --- a/scripts/ubuntu2104/cleanup.sh +++ b/scripts/ubuntu2104/cleanup.sh @@ -11,16 +11,6 @@ error() { export DEBIAN_FRONTEND=noninteractive export DEBCONF_NONINTERACTIVE_SEEN=true -# Keep the daily apt updater from deadlocking our cleanup commands. -systemctl --quiet is-active snapd.service && systemctl stop snapd.service snapd.socket -systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service -systemctl --quiet is-active apt-daily.timer && systemctl stop apt-daily.timer -systemctl --quiet is-active apt-daily.service && systemctl stop apt-daily.service -systemctl --quiet is-active apt-daily-upgrade.timer && systemctl stop apt-daily-upgrade.timer -systemctl --quiet is-active apt-daily-upgrade.service && systemctl stop apt-daily-upgrade.service -systemctl --quiet is-active unattended-upgrades.service && systemctl stop unattended-upgrades.service -systemctl --quiet is-active update-notifier-donwload.service && systemctl stop update-notifier-donwload.service - # Remove cloud init packages. dpkg -l eatmydata &>/dev/null && apt-get --assume-yes purge eatmydata dpkg -l libeatmydata1 &>/dev/null && apt-get --assume-yes purge libeatmydata1 @@ -67,3 +57,12 @@ sed -i '/old-releases.ubuntu.com/d' /etc/hosts systemctl --quiet is-active systemd-random-seed.service && systemctl stop systemd-random-seed.service [ -f /var/lib/systemd/random-seed ] && rm --force /var/lib/systemd/random-seed +# *Unmask anything we might have masked in the apt module. +[ "$(systemctl is-enabled apt-news.service)" == "masked" ] && systemctl unmask apt-news.service +[ "$(systemctl is-enabled apt-daily.service)" == "masked" ] && systemctl unmask apt-daily.service +# [ "$(systemctl is-enabled apt-daily-upgrade.service)" == "masked" ] && systemctl unmask apt-daily-upgrade.service + +[ "$(systemctl is-enabled packagekit.service)" == "masked" ] && systemctl unmask packagekit.service +[ "$(systemctl is-enabled packagekit-offline-update.service)" == "masked" ] && systemctl unmask packagekit-offline-update.service + +[ "$(systemctl is-enabled snapd.service)" == "masked" ] && systemctl unmask snapd.service diff --git a/scripts/ubuntu2110/apt.sh b/scripts/ubuntu2110/apt.sh index 92ccdfbf2..888401d25 100644 --- a/scripts/ubuntu2110/apt.sh +++ b/scripts/ubuntu2110/apt.sh @@ -94,16 +94,20 @@ EOF fi -# Keep the daily apt updater from deadlocking our the upgrade/install commands we are about to run. -# systemctl --quiet is-active snapd.service && systemctl stop snapd.service snapd.socket - # Stop the active services/timers. systemctl --quiet is-active apt-daily.timer && systemctl stop apt-daily.timer systemctl --quiet is-active apt-daily-upgrade.timer && systemctl stop apt-daily-upgrade.timer systemctl --quiet is-active update-notifier-download.timer && systemctl stop update-notifier-download.timer + +systemctl --quiet is-active apt-news.service && systemctl stop apt-news.service systemctl --quiet is-active apt-daily.service && systemctl stop apt-daily.service -systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service systemctl --quiet is-active apt-daily-upgrade.service && systemctl stop apt-daily-upgrade.service + +systemctl --quiet is-active snapd.service && systemctl stop snapd.service + +systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service +systemctl --quiet is-active packagekit-offline-update.service && systemctl stop packagekit.service + systemctl --quiet is-active unattended-upgrades.service && systemctl stop unattended-upgrades.service systemctl --quiet is-active update-notifier-download.service && systemctl stop update-notifier-download.service @@ -111,11 +115,20 @@ systemctl --quiet is-active update-notifier-download.service && systemctl stop u systemctl --quiet is-enabled apt-daily.timer && systemctl disable apt-daily.timer systemctl --quiet is-enabled apt-daily-upgrade.timer && systemctl disable apt-daily-upgrade.timer systemctl --quiet is-enabled update-notifier-download.timer && systemctl disable update-notifier-download.timer -systemctl --quiet is-enabled unattended-upgrades.service && systemctl disable unattended-upgrades.service + +systemctl --quiet is-enabled apt-news.service && systemctl mask apt-news.service systemctl --quiet is-enabled apt-daily.service && systemctl mask apt-daily.service systemctl --quiet is-enabled apt-daily-upgrade.service && systemctl mask apt-daily-upgrade.service + +systemctl --quiet is-enabled packagekit.service && systemctl mask packagekit.service +systemctl --quiet is-enabled packagekit-offline-update.service && systemctl mask packagekit-offline-update.service + +systemctl --quiet is-enabled snapd.service && systemctl mask snapd.service + +systemctl --quiet is-enabled unattended-upgrades.service && systemctl mask unattended-upgrades.service systemctl --quiet is-enabled update-notifier-download.service && systemctl mask update-notifier-download.service + # Truncate the sources list in order to force a status purge. # truncate --size=0 /etc/apt/sources.list diff --git a/scripts/ubuntu2110/cleanup.sh b/scripts/ubuntu2110/cleanup.sh index bb775ff26..d18c21583 100644 --- a/scripts/ubuntu2110/cleanup.sh +++ b/scripts/ubuntu2110/cleanup.sh @@ -11,16 +11,6 @@ error() { export DEBIAN_FRONTEND=noninteractive export DEBCONF_NONINTERACTIVE_SEEN=true -# Keep the daily apt updater from deadlocking our cleanup commands. -systemctl --quiet is-active snapd.service && systemctl stop snapd.service snapd.socket -systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service -systemctl --quiet is-active apt-daily.timer && systemctl stop apt-daily.timer -systemctl --quiet is-active apt-daily.service && systemctl stop apt-daily.service -systemctl --quiet is-active apt-daily-upgrade.timer && systemctl stop apt-daily-upgrade.timer -systemctl --quiet is-active apt-daily-upgrade.service && systemctl stop apt-daily-upgrade.service -systemctl --quiet is-active unattended-upgrades.service && systemctl stop unattended-upgrades.service -systemctl --quiet is-active update-notifier-donwload.service && systemctl stop update-notifier-donwload.service - # Remove cloud init packages. dpkg -l eatmydata &>/dev/null && apt-get --assume-yes purge eatmydata dpkg -l libeatmydata1 &>/dev/null && apt-get --assume-yes purge libeatmydata1 @@ -67,3 +57,12 @@ sed -i '/old-releases.ubuntu.com/d' /etc/hosts systemctl --quiet is-active systemd-random-seed.service && systemctl stop systemd-random-seed.service [ -f /var/lib/systemd/random-seed ] && rm --force /var/lib/systemd/random-seed +# *Unmask anything we might have masked in the apt module. +[ "$(systemctl is-enabled apt-news.service)" == "masked" ] && systemctl unmask apt-news.service +[ "$(systemctl is-enabled apt-daily.service)" == "masked" ] && systemctl unmask apt-daily.service +# [ "$(systemctl is-enabled apt-daily-upgrade.service)" == "masked" ] && systemctl unmask apt-daily-upgrade.service + +[ "$(systemctl is-enabled packagekit.service)" == "masked" ] && systemctl unmask packagekit.service +[ "$(systemctl is-enabled packagekit-offline-update.service)" == "masked" ] && systemctl unmask packagekit-offline-update.service + +[ "$(systemctl is-enabled snapd.service)" == "masked" ] && systemctl unmask snapd.service diff --git a/scripts/ubuntu2204/apt.sh b/scripts/ubuntu2204/apt.sh index d9bcc4837..5d6a39c15 100644 --- a/scripts/ubuntu2204/apt.sh +++ b/scripts/ubuntu2204/apt.sh @@ -94,16 +94,20 @@ EOF fi -# Keep the daily apt updater from deadlocking our the upgrade/install commands we are about to run. -# systemctl --quiet is-active snapd.service && systemctl stop snapd.service snapd.socket - # Stop the active services/timers. systemctl --quiet is-active apt-daily.timer && systemctl stop apt-daily.timer systemctl --quiet is-active apt-daily-upgrade.timer && systemctl stop apt-daily-upgrade.timer systemctl --quiet is-active update-notifier-download.timer && systemctl stop update-notifier-download.timer + +systemctl --quiet is-active apt-news.service && systemctl stop apt-news.service systemctl --quiet is-active apt-daily.service && systemctl stop apt-daily.service -systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service systemctl --quiet is-active apt-daily-upgrade.service && systemctl stop apt-daily-upgrade.service + +systemctl --quiet is-active snapd.service && systemctl stop snapd.service + +systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service +systemctl --quiet is-active packagekit-offline-update.service && systemctl stop packagekit.service + systemctl --quiet is-active unattended-upgrades.service && systemctl stop unattended-upgrades.service systemctl --quiet is-active update-notifier-download.service && systemctl stop update-notifier-download.service @@ -111,9 +115,17 @@ systemctl --quiet is-active update-notifier-download.service && systemctl stop u systemctl --quiet is-enabled apt-daily.timer && systemctl disable apt-daily.timer systemctl --quiet is-enabled apt-daily-upgrade.timer && systemctl disable apt-daily-upgrade.timer systemctl --quiet is-enabled update-notifier-download.timer && systemctl disable update-notifier-download.timer -systemctl --quiet is-enabled unattended-upgrades.service && systemctl disable unattended-upgrades.service + +systemctl --quiet is-enabled apt-news.service && systemctl mask apt-news.service systemctl --quiet is-enabled apt-daily.service && systemctl mask apt-daily.service systemctl --quiet is-enabled apt-daily-upgrade.service && systemctl mask apt-daily-upgrade.service + +systemctl --quiet is-enabled packagekit.service && systemctl mask packagekit.service +systemctl --quiet is-enabled packagekit-offline-update.service && systemctl mask packagekit-offline-update.service + +systemctl --quiet is-enabled snapd.service && systemctl mask snapd.service + +systemctl --quiet is-enabled unattended-upgrades.service && systemctl mask unattended-upgrades.service systemctl --quiet is-enabled update-notifier-download.service && systemctl mask update-notifier-download.service # Truncate the sources list in order to force a status purge. diff --git a/scripts/ubuntu2204/cleanup.sh b/scripts/ubuntu2204/cleanup.sh index 3d53d4889..775203f8b 100644 --- a/scripts/ubuntu2204/cleanup.sh +++ b/scripts/ubuntu2204/cleanup.sh @@ -11,16 +11,6 @@ error() { export DEBIAN_FRONTEND=noninteractive export DEBCONF_NONINTERACTIVE_SEEN=true -# Keep the daily apt updater from deadlocking our cleanup commands. -systemctl --quiet is-active snapd.service && systemctl stop snapd.service snapd.socket -systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service -systemctl --quiet is-active apt-daily.timer && systemctl stop apt-daily.timer -systemctl --quiet is-active apt-daily.service && systemctl stop apt-daily.service -systemctl --quiet is-active apt-daily-upgrade.timer && systemctl stop apt-daily-upgrade.timer -systemctl --quiet is-active apt-daily-upgrade.service && systemctl stop apt-daily-upgrade.service -systemctl --quiet is-active unattended-upgrades.service && systemctl stop unattended-upgrades.service -systemctl --quiet is-active update-notifier-donwload.service && systemctl stop update-notifier-donwload.service - # Remove cloud init packages. dpkg -l eatmydata &>/dev/null && apt-get --assume-yes purge eatmydata dpkg -l libeatmydata1 &>/dev/null && apt-get --assume-yes purge libeatmydata1 @@ -67,3 +57,12 @@ sed -i '/old-releases.ubuntu.com/d' /etc/hosts systemctl --quiet is-active systemd-random-seed.service && systemctl stop systemd-random-seed.service [ -f /var/lib/systemd/random-seed ] && rm --force /var/lib/systemd/random-seed +# *Unmask anything we might have masked in the apt module. +[ "$(systemctl is-enabled apt-news.service)" == "masked" ] && systemctl unmask apt-news.service +[ "$(systemctl is-enabled apt-daily.service)" == "masked" ] && systemctl unmask apt-daily.service +# [ "$(systemctl is-enabled apt-daily-upgrade.service)" == "masked" ] && systemctl unmask apt-daily-upgrade.service + +[ "$(systemctl is-enabled packagekit.service)" == "masked" ] && systemctl unmask packagekit.service +[ "$(systemctl is-enabled packagekit-offline-update.service)" == "masked" ] && systemctl unmask packagekit-offline-update.service + +[ "$(systemctl is-enabled snapd.service)" == "masked" ] && systemctl unmask snapd.service diff --git a/scripts/ubuntu2210/apt.sh b/scripts/ubuntu2210/apt.sh index cceed16bd..9f1db0fb2 100644 --- a/scripts/ubuntu2210/apt.sh +++ b/scripts/ubuntu2210/apt.sh @@ -94,16 +94,20 @@ EOF fi -# Keep the daily apt updater from deadlocking our the upgrade/install commands we are about to run. -# systemctl --quiet is-active snapd.service && systemctl stop snapd.service snapd.socket - # Stop the active services/timers. systemctl --quiet is-active apt-daily.timer && systemctl stop apt-daily.timer systemctl --quiet is-active apt-daily-upgrade.timer && systemctl stop apt-daily-upgrade.timer systemctl --quiet is-active update-notifier-download.timer && systemctl stop update-notifier-download.timer + +systemctl --quiet is-active apt-news.service && systemctl stop apt-news.service systemctl --quiet is-active apt-daily.service && systemctl stop apt-daily.service -systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service systemctl --quiet is-active apt-daily-upgrade.service && systemctl stop apt-daily-upgrade.service + +systemctl --quiet is-active snapd.service && systemctl stop snapd.service + +systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service +systemctl --quiet is-active packagekit-offline-update.service && systemctl stop packagekit.service + systemctl --quiet is-active unattended-upgrades.service && systemctl stop unattended-upgrades.service systemctl --quiet is-active update-notifier-download.service && systemctl stop update-notifier-download.service @@ -111,9 +115,17 @@ systemctl --quiet is-active update-notifier-download.service && systemctl stop u systemctl --quiet is-enabled apt-daily.timer && systemctl disable apt-daily.timer systemctl --quiet is-enabled apt-daily-upgrade.timer && systemctl disable apt-daily-upgrade.timer systemctl --quiet is-enabled update-notifier-download.timer && systemctl disable update-notifier-download.timer -systemctl --quiet is-enabled unattended-upgrades.service && systemctl disable unattended-upgrades.service + +systemctl --quiet is-enabled apt-news.service && systemctl mask apt-news.service systemctl --quiet is-enabled apt-daily.service && systemctl mask apt-daily.service systemctl --quiet is-enabled apt-daily-upgrade.service && systemctl mask apt-daily-upgrade.service + +systemctl --quiet is-enabled packagekit.service && systemctl mask packagekit.service +systemctl --quiet is-enabled packagekit-offline-update.service && systemctl mask packagekit-offline-update.service + +systemctl --quiet is-enabled snapd.service && systemctl mask snapd.service + +systemctl --quiet is-enabled unattended-upgrades.service && systemctl mask unattended-upgrades.service systemctl --quiet is-enabled update-notifier-download.service && systemctl mask update-notifier-download.service # Truncate the sources list in order to force a status purge. diff --git a/scripts/ubuntu2210/cleanup.sh b/scripts/ubuntu2210/cleanup.sh index 3d53d4889..775203f8b 100644 --- a/scripts/ubuntu2210/cleanup.sh +++ b/scripts/ubuntu2210/cleanup.sh @@ -11,16 +11,6 @@ error() { export DEBIAN_FRONTEND=noninteractive export DEBCONF_NONINTERACTIVE_SEEN=true -# Keep the daily apt updater from deadlocking our cleanup commands. -systemctl --quiet is-active snapd.service && systemctl stop snapd.service snapd.socket -systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service -systemctl --quiet is-active apt-daily.timer && systemctl stop apt-daily.timer -systemctl --quiet is-active apt-daily.service && systemctl stop apt-daily.service -systemctl --quiet is-active apt-daily-upgrade.timer && systemctl stop apt-daily-upgrade.timer -systemctl --quiet is-active apt-daily-upgrade.service && systemctl stop apt-daily-upgrade.service -systemctl --quiet is-active unattended-upgrades.service && systemctl stop unattended-upgrades.service -systemctl --quiet is-active update-notifier-donwload.service && systemctl stop update-notifier-donwload.service - # Remove cloud init packages. dpkg -l eatmydata &>/dev/null && apt-get --assume-yes purge eatmydata dpkg -l libeatmydata1 &>/dev/null && apt-get --assume-yes purge libeatmydata1 @@ -67,3 +57,12 @@ sed -i '/old-releases.ubuntu.com/d' /etc/hosts systemctl --quiet is-active systemd-random-seed.service && systemctl stop systemd-random-seed.service [ -f /var/lib/systemd/random-seed ] && rm --force /var/lib/systemd/random-seed +# *Unmask anything we might have masked in the apt module. +[ "$(systemctl is-enabled apt-news.service)" == "masked" ] && systemctl unmask apt-news.service +[ "$(systemctl is-enabled apt-daily.service)" == "masked" ] && systemctl unmask apt-daily.service +# [ "$(systemctl is-enabled apt-daily-upgrade.service)" == "masked" ] && systemctl unmask apt-daily-upgrade.service + +[ "$(systemctl is-enabled packagekit.service)" == "masked" ] && systemctl unmask packagekit.service +[ "$(systemctl is-enabled packagekit-offline-update.service)" == "masked" ] && systemctl unmask packagekit-offline-update.service + +[ "$(systemctl is-enabled snapd.service)" == "masked" ] && systemctl unmask snapd.service diff --git a/scripts/ubuntu2304/apt.sh b/scripts/ubuntu2304/apt.sh index b03c9e0ef..df001208f 100644 --- a/scripts/ubuntu2304/apt.sh +++ b/scripts/ubuntu2304/apt.sh @@ -94,16 +94,20 @@ EOF fi -# Keep the daily apt updater from deadlocking our the upgrade/install commands we are about to run. -# systemctl --quiet is-active snapd.service && systemctl stop snapd.service snapd.socket - # Stop the active services/timers. systemctl --quiet is-active apt-daily.timer && systemctl stop apt-daily.timer systemctl --quiet is-active apt-daily-upgrade.timer && systemctl stop apt-daily-upgrade.timer systemctl --quiet is-active update-notifier-download.timer && systemctl stop update-notifier-download.timer + +systemctl --quiet is-active apt-news.service && systemctl stop apt-news.service systemctl --quiet is-active apt-daily.service && systemctl stop apt-daily.service -systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service systemctl --quiet is-active apt-daily-upgrade.service && systemctl stop apt-daily-upgrade.service + +systemctl --quiet is-active snapd.service && systemctl stop snapd.service + +systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service +systemctl --quiet is-active packagekit-offline-update.service && systemctl stop packagekit.service + systemctl --quiet is-active unattended-upgrades.service && systemctl stop unattended-upgrades.service systemctl --quiet is-active update-notifier-download.service && systemctl stop update-notifier-download.service @@ -111,9 +115,17 @@ systemctl --quiet is-active update-notifier-download.service && systemctl stop u systemctl --quiet is-enabled apt-daily.timer && systemctl disable apt-daily.timer systemctl --quiet is-enabled apt-daily-upgrade.timer && systemctl disable apt-daily-upgrade.timer systemctl --quiet is-enabled update-notifier-download.timer && systemctl disable update-notifier-download.timer -systemctl --quiet is-enabled unattended-upgrades.service && systemctl disable unattended-upgrades.service + +systemctl --quiet is-enabled apt-news.service && systemctl mask apt-news.service systemctl --quiet is-enabled apt-daily.service && systemctl mask apt-daily.service systemctl --quiet is-enabled apt-daily-upgrade.service && systemctl mask apt-daily-upgrade.service + +systemctl --quiet is-enabled packagekit.service && systemctl mask packagekit.service +systemctl --quiet is-enabled packagekit-offline-update.service && systemctl mask packagekit-offline-update.service + +systemctl --quiet is-enabled snapd.service && systemctl mask snapd.service + +systemctl --quiet is-enabled unattended-upgrades.service && systemctl mask unattended-upgrades.service systemctl --quiet is-enabled update-notifier-download.service && systemctl mask update-notifier-download.service # Truncate the sources list in order to force a status purge. diff --git a/scripts/ubuntu2304/cleanup.sh b/scripts/ubuntu2304/cleanup.sh index 3d53d4889..775203f8b 100644 --- a/scripts/ubuntu2304/cleanup.sh +++ b/scripts/ubuntu2304/cleanup.sh @@ -11,16 +11,6 @@ error() { export DEBIAN_FRONTEND=noninteractive export DEBCONF_NONINTERACTIVE_SEEN=true -# Keep the daily apt updater from deadlocking our cleanup commands. -systemctl --quiet is-active snapd.service && systemctl stop snapd.service snapd.socket -systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service -systemctl --quiet is-active apt-daily.timer && systemctl stop apt-daily.timer -systemctl --quiet is-active apt-daily.service && systemctl stop apt-daily.service -systemctl --quiet is-active apt-daily-upgrade.timer && systemctl stop apt-daily-upgrade.timer -systemctl --quiet is-active apt-daily-upgrade.service && systemctl stop apt-daily-upgrade.service -systemctl --quiet is-active unattended-upgrades.service && systemctl stop unattended-upgrades.service -systemctl --quiet is-active update-notifier-donwload.service && systemctl stop update-notifier-donwload.service - # Remove cloud init packages. dpkg -l eatmydata &>/dev/null && apt-get --assume-yes purge eatmydata dpkg -l libeatmydata1 &>/dev/null && apt-get --assume-yes purge libeatmydata1 @@ -67,3 +57,12 @@ sed -i '/old-releases.ubuntu.com/d' /etc/hosts systemctl --quiet is-active systemd-random-seed.service && systemctl stop systemd-random-seed.service [ -f /var/lib/systemd/random-seed ] && rm --force /var/lib/systemd/random-seed +# *Unmask anything we might have masked in the apt module. +[ "$(systemctl is-enabled apt-news.service)" == "masked" ] && systemctl unmask apt-news.service +[ "$(systemctl is-enabled apt-daily.service)" == "masked" ] && systemctl unmask apt-daily.service +# [ "$(systemctl is-enabled apt-daily-upgrade.service)" == "masked" ] && systemctl unmask apt-daily-upgrade.service + +[ "$(systemctl is-enabled packagekit.service)" == "masked" ] && systemctl unmask packagekit.service +[ "$(systemctl is-enabled packagekit-offline-update.service)" == "masked" ] && systemctl unmask packagekit-offline-update.service + +[ "$(systemctl is-enabled snapd.service)" == "masked" ] && systemctl unmask snapd.service diff --git a/scripts/ubuntu2310/apt.sh b/scripts/ubuntu2310/apt.sh index e8b92bc85..c4211460b 100644 --- a/scripts/ubuntu2310/apt.sh +++ b/scripts/ubuntu2310/apt.sh @@ -94,16 +94,20 @@ EOF fi -# Keep the daily apt updater from deadlocking our the upgrade/install commands we are about to run. -# systemctl --quiet is-active snapd.service && systemctl stop snapd.service snapd.socket - # Stop the active services/timers. systemctl --quiet is-active apt-daily.timer && systemctl stop apt-daily.timer systemctl --quiet is-active apt-daily-upgrade.timer && systemctl stop apt-daily-upgrade.timer systemctl --quiet is-active update-notifier-download.timer && systemctl stop update-notifier-download.timer + +systemctl --quiet is-active apt-news.service && systemctl stop apt-news.service systemctl --quiet is-active apt-daily.service && systemctl stop apt-daily.service -systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service systemctl --quiet is-active apt-daily-upgrade.service && systemctl stop apt-daily-upgrade.service + +systemctl --quiet is-active snapd.service && systemctl stop snapd.service + +systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service +systemctl --quiet is-active packagekit-offline-update.service && systemctl stop packagekit.service + systemctl --quiet is-active unattended-upgrades.service && systemctl stop unattended-upgrades.service systemctl --quiet is-active update-notifier-download.service && systemctl stop update-notifier-download.service @@ -111,9 +115,17 @@ systemctl --quiet is-active update-notifier-download.service && systemctl stop u systemctl --quiet is-enabled apt-daily.timer && systemctl disable apt-daily.timer systemctl --quiet is-enabled apt-daily-upgrade.timer && systemctl disable apt-daily-upgrade.timer systemctl --quiet is-enabled update-notifier-download.timer && systemctl disable update-notifier-download.timer -systemctl --quiet is-enabled unattended-upgrades.service && systemctl disable unattended-upgrades.service + +systemctl --quiet is-enabled apt-news.service && systemctl mask apt-news.service systemctl --quiet is-enabled apt-daily.service && systemctl mask apt-daily.service systemctl --quiet is-enabled apt-daily-upgrade.service && systemctl mask apt-daily-upgrade.service + +systemctl --quiet is-enabled packagekit.service && systemctl mask packagekit.service +systemctl --quiet is-enabled packagekit-offline-update.service && systemctl mask packagekit-offline-update.service + +systemctl --quiet is-enabled snapd.service && systemctl mask snapd.service + +systemctl --quiet is-enabled unattended-upgrades.service && systemctl mask unattended-upgrades.service systemctl --quiet is-enabled update-notifier-download.service && systemctl mask update-notifier-download.service # Truncate the sources list in order to force a status purge. diff --git a/scripts/ubuntu2310/cleanup.sh b/scripts/ubuntu2310/cleanup.sh index 3d53d4889..775203f8b 100644 --- a/scripts/ubuntu2310/cleanup.sh +++ b/scripts/ubuntu2310/cleanup.sh @@ -11,16 +11,6 @@ error() { export DEBIAN_FRONTEND=noninteractive export DEBCONF_NONINTERACTIVE_SEEN=true -# Keep the daily apt updater from deadlocking our cleanup commands. -systemctl --quiet is-active snapd.service && systemctl stop snapd.service snapd.socket -systemctl --quiet is-active packagekit.service && systemctl stop packagekit.service -systemctl --quiet is-active apt-daily.timer && systemctl stop apt-daily.timer -systemctl --quiet is-active apt-daily.service && systemctl stop apt-daily.service -systemctl --quiet is-active apt-daily-upgrade.timer && systemctl stop apt-daily-upgrade.timer -systemctl --quiet is-active apt-daily-upgrade.service && systemctl stop apt-daily-upgrade.service -systemctl --quiet is-active unattended-upgrades.service && systemctl stop unattended-upgrades.service -systemctl --quiet is-active update-notifier-donwload.service && systemctl stop update-notifier-donwload.service - # Remove cloud init packages. dpkg -l eatmydata &>/dev/null && apt-get --assume-yes purge eatmydata dpkg -l libeatmydata1 &>/dev/null && apt-get --assume-yes purge libeatmydata1 @@ -67,3 +57,12 @@ sed -i '/old-releases.ubuntu.com/d' /etc/hosts systemctl --quiet is-active systemd-random-seed.service && systemctl stop systemd-random-seed.service [ -f /var/lib/systemd/random-seed ] && rm --force /var/lib/systemd/random-seed +# *Unmask anything we might have masked in the apt module. +[ "$(systemctl is-enabled apt-news.service)" == "masked" ] && systemctl unmask apt-news.service +[ "$(systemctl is-enabled apt-daily.service)" == "masked" ] && systemctl unmask apt-daily.service +# [ "$(systemctl is-enabled apt-daily-upgrade.service)" == "masked" ] && systemctl unmask apt-daily-upgrade.service + +[ "$(systemctl is-enabled packagekit.service)" == "masked" ] && systemctl unmask packagekit.service +[ "$(systemctl is-enabled packagekit-offline-update.service)" == "masked" ] && systemctl unmask packagekit-offline-update.service + +[ "$(systemctl is-enabled snapd.service)" == "masked" ] && systemctl unmask snapd.service