Skip to content

Instantly share code, notes, and snippets.

@posilva
Last active November 21, 2023 18:15
Show Gist options
  • Save posilva/1cefb5bf1eeccf9382920e5d57a4b3fe to your computer and use it in GitHub Desktop.
Save posilva/1cefb5bf1eeccf9382920e5d57a4b3fe to your computer and use it in GitHub Desktop.
Remove/Disable Ubuntu SystemD Daily.Timers
# References:
#
# https://cinhtau.net/2016/12/09/disable-apt-auto-update-and-upgrade/
# https://unix.stackexchange.com/questions/315502/how-to-disable-apt-daily-service-on-ubuntu-cloud-vm-image
# https://askubuntu.com/questions/824718/ubuntu-16-04-unattended-upgrades-runs-at-random-times/831206
apt-get -y purge update-notifier-common ubuntu-release-upgrader-core landscape-common unattended-upgrades
systemctl kill --kill-who=all apt-daily.service
systemctl kill --kill-who=all apt-daily-upgrade.service
systemctl stop apt-daily.timer
systemctl disable apt-daily.timer
systemctl stop apt-daily.service
systemctl disable apt-daily.service
systemctl stop apt-daily-upgrade.timer
systemctl disable apt-daily-upgrade.timer
systemctl stop apt-daily-upgrade.service
systemctl disable apt-daily-upgrade.service
systemctl daemon-reload
systemctl reset-failed
rm /etc/systemd/system/timers.target.wants/apt-daily.timer
rm /etc/systemd/system/timers.target.wants/apt-daily-upgrade.timer
mv /usr/lib/apt/apt.systemd.daily /usr/lib/apt/apt.systemd.daily.DISABLED
mv /lib/systemd/system/apt-daily.service /lib/systemd/system/apt-daily.service.DISABLED
mv /lib/systemd/system/apt-daily.timer /lib/systemd/system/apt-daily.timer.DISABLED
mv /lib/systemd/system/apt-daily-upgrade.service /lib/systemd/system/apt-daily-upgrade.service.DISABLED
mv /lib/systemd/system/apt-daily-upgrade.timer /lib/systemd/system/apt-daily-upgrade.timer.DISABLED
# Usefull commands
# systemctl is-enabled apt-daily.service
# systemctl enable apt-daily.service
# systemctl list-units --all apt-daily.service
@nqb
Copy link

nqb commented May 31, 2022

Thanks @posilva, I think systemctl list-timers is an helpful command too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment