How To Stop Installing Updates Automatically On Ubuntu Or Debian (Unattended Upgrades)

Debian and Ubuntu based Linux distributions can automatically install the latest security (and others) updates with the use of a package named unattended-upgrades.

This unattended-upgrades package is installed by default on Ubuntu (but not on Linux Mint for example) and Debian 9+ with Gnome, and while it's a nice feature to have, quite a few users complain about it and the Microsoft Windows-like behavior of installing updates with no input from the user. Especially when you want to shutdown or reboot your system while in a hurry, and you get this:

Ubuntu unattended-upgrade in progress

This is the case not only for Ubuntu with Gnome, but other Ubuntu flavors as well, including Kubuntu, Ubuntu MATE, and so on.

As a side note, if you force a shutdown / reboot while installing updates, your computer may fail to boot into Ubuntu / Debian, and apt will probably get broken, showing the E: Could not get lock /var/lib/dpkg/lock or E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem errors.

Those wanting to get rid of this behavior of automatically installing updates on Ubuntu or Debian 9+ with Gnome, have 2 options: remove the unattended-upgrades or configure it so it does not install updates automatically.

  • Remove unattended-upgrades from Ubuntu or Debian.

Removing the unattended-upgrades package does not remove any other packages on Ubuntu or Debian, so it's safe to remove.

It looks like the unattended-upgrades is installed by default on Ubuntu because it's a recommended dependency of python3-software-properties (a package that makes it easy to add PPA repositories, among others), and Ubuntu automatically installs recommended packages.

You can remove the unattended-upgrades package using:

sudo apt remove unattended-upgrades

  • Disable installing security (and other) updates automatically on Ubuntu or Debian.

You also have the option of disabling the installation of automatic updates. This can be done by issuing:

sudo dpkg-reconfigure unattended-upgrades

And choosing No when asked if you want to automatically download and install updates:

Disable unattended-upgrades Ubuntu

More information about unattended-upgrades, including blacklisting certain packages or changing the update schedule, is available in the Automatic Updates section of the Ubuntu Server Guide, and the UnattendedUpgrades Debian Wiki page.