DEV Community

logix2
logix2

Posted on

How To Stop Automatic Updates On Ubuntu Or Debian

Ubuntu installs some updates automatically, and so does Debian 9+ with GNOME. This is due to unattended-upgrades being installed and enabled by default.

When enabled, unattended upgrades automatically downloads and installs some important updates, and that's ok in many cases except:

  • if you need to quickly shut down or reboot the system

  • when you need to install some package ASAP and you notice you can't, because an upgrade is in process

What's more, I've noticed on multiple systems that this can cause quite frequent errors like: "Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable)", which are not easy to fix, especially for new users (by the way, see Linux Uprising Blog for a how-to on recovering from such dpkg lock errors). Sometimes this error never goes away without user intervention (probably because some upgrade failed) which is quite bad since because of this error you're not able to install or upgrade packages until you fix it.

For this reason, I personally prefer to disable unattended upgrades, and just perform the upgrades myself when time permits it. To stop automatic updates on Ubuntu or Debian, you have two options:

1) Reconfigure unattended-upgrades to stop installing updates automatically

disable unattended upgrades on Ubuntu

Use this command:

    sudo dpkg-reconfigure unattended-upgrades

This will ask you if you want to automatically download and install stable updates or not. Choose No and you're done, Debian / Ubuntu should stop installing automatic updates.

2) Remove the unattended-upgrades package

You also have the option of removing the unattended-upgrades package. This will stop future automatic upgrades, but do note that unattended-upgrades may be pulled in as a dependency (e.g. if it's a "recommended" dependency for some other package - Ubuntu installs these automatically) in the future. So while this will stop automatic upgrades, it may come back in the future.

If you want to go this route, remove unattended-upgrades using:

    sudo apt remove unattended-upgrades

Top comments (0)