- Posted on
- • Administration
Blacklisting packages from updates in APT
- Author
-
-
- User
- Linux Bash
- Posts by this author
- Posts by this author
-
Keeping your Linux system up-to-date is critical for ensuring security and stability but sometimes, there are instances when you might not want to update certain packages. In this article, we'll explore how to blacklist or hold packages from being updated in various Linux package managers, including APT (used in Debian-based systems), DNF (utilized in Fedora and its derivatives), and Zypper (the command line interface of openSUSE).
Blacklisting Packages with APT (Advanced Package Tool)
APT is the package management system used by Debian and its derivatives like Ubuntu. To prevent a package from being updated, you can hold it using the apt-mark
command. This is particularly useful if updating that package would cause issues with your system or disrupt a service.
Step by Step Guide:
- Open your terminal.
- Check the current status of the package (optional):
bash sudo apt-mark showhold
Hold the package:
sudo apt-mark hold package-name
Replace
package-name
with the name of the package you wish to hold.To unhold if needed in the future:
sudo apt-mark unhold package-name
Using DNF (Dandified Yum) in Fedora-based systems
DNF replaces the older YUM package manager in Fedora systems. It manages packages by resolving dependencies and providing automatic updates for your software. To exclude a package from being updated in DNF, you need to add it to the exclude list in the DNF configuration.
Step by Step Guide:
- Open your terminal.
- Edit the DNF configuration file:
bash sudo nano /etc/dnf/dnf.conf
Add the exclude directive under the
[main]
section. For example, to excludenginx
from updates, add:exclude=nginx*
You can add multiple packages by separating them with a space.
Save and close the file. DNF will now ignore the packages specified when performing updates.
Blacklisting Packages with Zypper in openSUSE
Zypper is an advanced package management tool which makes use of the powerful zypp
library. To skip updates for a specific package in Zypper:
Step by Step Guide:
- Open your terminal.
Add a package to the lock list:
sudo zypper addlock package-name
Replace
package-name
with the name of the package you wish to exclude from updates.To view currently locked packages:
sudo zypper locks
To remove a lock from a package:
sudo zypper removelock package-name
Summary
Blacklisting or holding updates for certain packages can be crucial for maintaining custom setups or preventing incompatible updates from being applied. Each package manager in Linux offers a method to achieve this, safeguarding your system's stability while still receiving general updates. Whether you're running a Debian, Fedora, or openSUSE system, managing your software updates precisely is straightforward with these steps.
Remember to periodically review your list of held or excluded packages. Software is continuously evolving, and an update you previously needed to avoid may eventually become beneficial or necessary.
Further Reading
For further reading and to enhance your understanding of managing package updates and configurations in Linux systems, consider the following resources:
APT Configuration Detailed Guide - This article provides an in-depth look at configuring the APT package manager, including how to prevent specific packages from updating: APT Configuration Detailed Guide
Comprehensive DNF Documentation - Explore the official documentation for DNF to learn more about its features and how to exclude packages from updates comprehensively: DNF Documentation
Zypper Command Line Tool Guide - This is a detailed guide to using Zypper, including instructions on how to handle package locks and manage software repositories: Zypper Usage Guide
Linux Package Management Tips and Tricks - This article explores various tricks for managing packages in different Linux distributions, including package holding and blacklisting: Linux Package Management Tips
Understanding Linux Software Repositories - Gain insight into how Linux software repositories work and how they interact with package managers like APT, DNF, and Zypper: Understanding Linux Software Repositories
These resources should provide a broader context and more detailed instructions for managing package updates on your Linux system, allowing you to maintain a stable and secure environment.