Disable ubuntu automatic upgrades (**all**)

Disable ubuntu automatic upgrades (all)

ubuntu 24.04

Trust me, upgrades MUST*1 be attended.

* The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.

Disable automatic upgrades


# list of systemd services/timers to disable
declare -a svc=(
  "unattended-upgrades.service"
  "apt-daily-upgrade.service"
  "apt-daily-upgrade.timer"
  "apt-daily.service"
  "apt-daily.timer"
  "apt-news.service"
  "fwupd-offline-update.service"
  "fwupd-refresh.service"
  "fwupd-refresh.timer"
  "fwupd.service"
)

for i in "${svc[@]}"
do
   sudo systemctl disable "$i"
   sudo systemctl stop "$i"
   sudo systemctl mask "$i"
done

# disable snap updates
sudo snap refresh --hold=forever

# disable update-notifier (so it won't trigger when we do a manual update)
sudo sed -i 's/DPkg::Post-Invoke/#DPkg::Post-Invoke/' /etc/apt/apt.conf.d/99update-notifier

# disable periodic apt updates
sudo sed -i 's/APT::Periodic::Update-Package-Lists "1"/APT::Periodic::Update-Package-Lists "0"/' /etc/apt/apt.conf.d/10periodic


# forget new packages in aptitude
echo 'Aptitude::Forget-New-On-Update "true";' | sudo tee /etc/apt/apt.conf.d/99aptitude-forget-new

~~~

Question, remark, bug? Don't hesitate to contact me or report a bug.