- Posted on
- • Administration
Downgrading a package in DNF
- Author
-
-
- User
- Linux Bash
- Posts by this author
- Posts by this author
-
How to Downgrade a Package in Linux Using DNF, APT, and Zypper
If you've upgraded a software package on your Linux system only to find out the new version has bugs or compatibility issues, reverting to a previous version can resolve the problem. Different Linux distributions use different package managers, and the methods to downgrade software vary accordingly. In this blog, we'll go over how to downgrade a package if you are using DNF, APT, or Zypper as your package manager.
DNF (Fedora, RHEL, CentOS)
DNF (Dandified YUM) is the next-generation version of YUM and is the default package manager for Fedora. If you need to downgrade a package in Fedora or any other system that uses DNF, you can use the following steps:
Find the Version Number: First, you'll need to find out which versions of the package are available. You can search the available versions of the package by:
dnf --showduplicates list <package-name>
Replace
<package-name>
with the actual name of the package.Downgrade the Package: Once you have identified the version to which you want to downgrade, use the downgrade command:
sudo dnf downgrade <package-name-version-release>
Ensure to replace
<package-name-version-release>
with the full version/release descriptor shown in the list (e.g.,httpd-2.4.37-16.fc30
).Check Installation: Verify that the downgrade was successful by checking the version of the installed package:
dnf info <package-name>
APT (Debian, Ubuntu)
APT (Advanced Package Tool) is commonly used in Debian-based systems like Ubuntu. Here’s how you can downgrade a package using APT:
Find the Version Number: Similar to DNF, start by finding the available versions of the package:
apt list -a <package-name>
Downgrade the Package: After deciding which version to revert to, use the
apt-get install
command followed by the package name and the version number:sudo apt-get install <package-name>=<version>
Replace
<package-name>
and<version>
accordingly.Hold the Package: To prevent the package from being updated again in a future update, hold the package:
sudo apt-mark hold <package-name>
Zypper (openSUSE, SUSE)
Zypper is the command line interface of ZYpp package manager for installing, removing, and managing packages in openSUSE and SUSE systems.
Find the Version Number: First, search for all available versions of the package:
zypper se -s <package-name>
Downgrade the Package: To downgrade to an earlier version, use:
sudo zypper install <package-name>=<older-version>
Make sure to specify the full package name and version.
Verify the Downgrade: Lastly, verify that the correct version has been installed:
zypper info <package-name>
Conclusion
Downgrading a package in Linux requires specific commands depending on the package manager your Linux distribution uses. Whether you're a Fedora, Debian, or openSUSE user, following the correct procedure will ensure that you successfully revert a package to a previous version without breaking dependencies or affecting other system components. Always make sure to check the compatibility of downgraded packages with your current system environment.
Further Reading
For further reading on package management and using specific tools like DNF, APT, and Zypper, consider exploring these resources:
DNF Command Reference: For a comprehensive look at DNF and its capabilities beyond downgrading, including installation, update, and removal of packages. DNF Command Reference
APT Package Management: This detailed guide covers usage of APT in Debian systems for beginners, including package searching, installation, and system updates. APT Package Management
Understanding Zypper: A great starting point to understand Zypper's wide array of commands and options in openSUSE. Zypper Command Line Interface
Fedora System Administration Guide: Dive into Fedora’s system administration using DNF for managing packages. Fedora System Administration
Ubuntu Package Management with APT: Learn more about managing packages on Ubuntu systems, focusing on APT’s features and typical use cases. Ubuntu Package Management
These resources will enhance your understanding of package managers and improve your system administration skills across different Linux distributions.