How to disable automatic upgrades on Ubuntu 20.04

Home


To disable automatic upgrades on Ubuntu 20.04 from the command line, you need to modify the configuration file /etc/apt/apt.conf.d/20auto-upgrades. You can do this by using a text editor like nano or by directly echoing the new configuration into the file. Here's how to do it:

First, open the terminal.

Check the current settings of the 20auto-upgrades file:

cat /etc/apt/apt.conf.d/20auto-upgrades

You may see something like this:

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

The Update-Package-Lists setting controls the automatic updates check, while the Unattended-Upgrade setting controls the automatic installation of security updates.

To disable automatic updates, set both values to "0":
You can either edit the file using a text editor like nano:

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

Change the values to "0":

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

Save the file and exit the editor (Ctrl + X, then press Y, and then Enter).

Or, you can directly echo the new configuration into the file:

echo 'APT::Periodic::Update-Package-Lists "0";' | sudo tee /etc/apt/apt.conf.d/20auto-upgrades
echo 'APT::Periodic::Unattended-Upgrade "0";' | sudo tee -a /etc/apt/apt.conf.d/20auto-upgrades

Now, the automatic updates should be disabled. To verify the new settings, run:

cat /etc/apt/apt.conf.d/20auto-upgrades

You should see both values set to "0".

Author: Sebastian Emilio Narvaez

Created: 2023-05-23 Tue 00:46

Validate