- Posted on
- • Operating Systems
Downgrading Packages in Each Distro
- Author
-
-
- User
- Linux Bash
- Posts by this author
- Posts by this author
-
Downgrading Packages in Linux: A Distro-Specific Guide
In the Linux world, the flexibility to manage packages precisely how you want is one of the system's greatest strengths. While upgrading packages is a common practice to ensure software functionality and security, sometimes you may encounter situations where a newer version of a software introduces a bug, removes a needed feature, or simply does not work as expected with your configuration. In such cases, downgrading packages to a previous version can be as crucial as updates. This guide aims at providing step-by-step instructions on how to downgrade packages in some of the most popular Linux distributions.
Downgrading Packages in Ubuntu and Debian
APT – Advanced Package Tool is the go-to package management system in Debian-based distributions like Ubuntu. To downgrade a package in Ubuntu or Debian, follow these steps:
Find the available versions of the package: First, you need to know which versions of the package are available in the repository. Use the command:
apt show <packageName> -a
This command will list all available versions of the package in the repositories.
Force the installation of a specific version: Once you've identified the version you wish to revert to, you can install it by specifying the version number:
sudo apt install <packageName>=<versionNumber>
Replace
<packageName>
with the name of the package and<versionNumber>
with the exact version you wish to install.Hold the package version: To prevent the package from being updated unintentionally during a future system upgrade, hold the package using:
sudo apt-mark hold <packageName>
Downgrading Packages in Fedora and CentOS
DNF – Dandified YUM is the package manager used in Fedora and newer versions of CentOS. Here’s how to downgrade packages using DNF:
Check the history of transactions: DNF keeps a history of all transactions, which can be useful to find when a particular package was updated:
dnf history
Undo the last transaction or downgrade directly: If the package was part of the recent transaction, you can use:
dnf history undo last
Alternatively, to downgrade a package directly, use:
dnf downgrade <packageName>
This command will automatically select the previous version of the package for installation.
Downgrading Packages in Arch Linux
Pacman is the package manager used in Arch Linux. Downgrading a package in Arch is slightly more direct:
Leverage the cache: Pacman stores a cache of all installed packages, which includes older versions unless cleaned. To downgrade a package, simply reinstall it from the cache:
sudo pacman -U /var/cache/pacman/pkg/<packageName>-<oldVersion>-x86_64.pkg.tar.xz
Be sure to replace
<packageName>
and<oldVersion>
with the actual name and version.The Arch Linux Archive: If the package isn't in the cache, the Arch Linux Archive (ALA) holds snapshots of previous package states. Access these via:
wget https://archive.archlinux.org/packages/<PackageNameFirstLetter>/<packageName>/<packageName>-<version>.pkg.tar.xz sudo pacman -U <packageName>-<version>.pkg.tar.xz
Each Linux distribution has its own specific tools and methods for package management, and knowing how to effectively downgrade packages is a valuable skill for any system administrator or enthusiast. It provides greater control over the environment and helps ensure stability—even when newer software versions aren’t cooperating.
Always remember to backup critical data before making significant changes like downgrades, as they can sometimes lead to system instability or other unexpected issues. Following the steps outlined for each distribution will allow you to confidently manage and maintain your Linux system in the state you prefer.