- Posted on
- • Administration
Disabling automatic package upgrades
- Author
-
-
- User
- Linux Bash
- Posts by this author
- Posts by this author
-
Title: How to Disable Automatic Package Upgrades in Linux
Introduction: Keeping your Linux system’s packages up to date is generally a recommended practice for security and stability. However, in certain scenarios such as environments that require extensive testing or precise control over when upgrades occur, you might find it necessary to disable automatic updates. This ensures that updates do not interfere with ongoing work, introduce unexpected behaviors, or affect software dependencies unpredictably. Today, we will guide you on how to disable automatic package upgrades for some of the most common package managers in Linux: APT (used by Debian-based distributions), DNF (used by Fedora and its derivatives), and Zypper (used by openSUSE).
1. Disabling Automatic Upgrades in APT (Debian, Ubuntu, and derivatives):
APT (Advanced Package Tool) is the package manager used by Debian and its derivatives, such as Ubuntu. Automatic updates are usually managed by the unattended-upgrades
package.
To disable this feature:
Open a terminal.
First, check if the
unattended-upgrades
package is installed:dpkg -l | grep unattended-upgrades
If installed, you can disable it by editing its configuration file:
sudo nano /etc/apt/apt.conf.d/20auto-upgrades
Change the settings in the file to:
APT::Periodic::Update-Package-Lists "0"; APT::Periodic::Unattended-Upgrade "0";
Save and close the editor.
This change will prevent APT from automatically downloading and installing package updates.
2. Disabling Automatic Upgrades in DNF (Fedora, CentOS, and derivatives):
DNF is the next-generation version of YUM, used primarily by Fedora, CentOS, and related Linux distributions. DNF does not usually configure automatic updates by default, but if you or your administrator has set this up via dnf-automatic
, you can disable it.
Open a terminal.
To stop and disable the
dnf-automatic
service, type:sudo systemctl disable --now dnf-automatic.timer
This command stops the timer and prevents it from starting automatically at boot.
3. Disabling Automatic Upgrades in Zypper (openSUSE and SUSE Linux Enterprise):
Zypper is a command-line package manager for openSUSE and SUSE Linux Enterprise systems. Automatic updates in Zypper are managed through a service called zypper-updater
.
Open a terminal.
To find out if the automatic updater is active, use:
systemctl status zypper-refresh.timer
To disable it, type:
sudo systemctl disable --now zypper-refresh.timer
This command not only stops the timer but also prevents it from being activated on system startup.
Conclusion: While automatic updates are beneficial for most users, certain cases require control over when and how updates are applied. Disabling automatic updates should be done with caution, particularly in environments exposed to security threats. Always ensure that you periodically check for and apply updates manually to maintain the security and stability of your systems. Remember that while this guide covers how to stop automatic updates, the responsibility to keep your system updated shifts entirely to you once automatic updating is disabled.