How to disable auto-update on Ubuntu 18

Sometimes on some servers it is extremely necessary to turn off automatic system updates, since services compiled from the source code for a specific kernel may not start after updating it, so I decided to write this article.

To disable or enable automatic updates, you can use the command:

sudo dpkg-reconfigure -plow unattended-upgrades

You can also open the following file in a text editor:

sudo nano /etc/apt/apt.conf.d/20auto-upgrades

And specify 0 to disable automatic updates:

APT::Periodic::Update-Package-Lists "0";
APT::Periodic::Unattended-Upgrade "0";

In the future, if necessary, the update can be performed manually:

sudo apt update
sudo apt upgrade

If you have automatic updating enabled and you want to receive email notifications every time you update or in case of errors, then open the following file in a text editor:

sudo nano /etc/apt/apt.conf.d/50unattended-upgrades

And specify the parameters:

Unattended-Upgrade::Mail "";
//Unattended-Upgrade::MailOnlyOnError "true";

You can also prohibit the updating of certain packages in this file:

Unattended-Upgrade::Package-Blacklist {
//      "vim";
//      "libc6";
//      "libc6-dev";
//      "libc6-i686";

If you have enabled auto-update and want to check if it works, then you can run the command:

sudo unattended-upgrades --dry-run --debug

Auto-update logs are written to the file /var/log/unattended-upgrades/unattended-upgrades.log

See also my article:
How to roll back the kernel version on Ubuntu

Leave a comment

Leave a Reply