Arch Linux and all the distributions based upon it, such as ArcoLinux, Manjaro, and Endeavour OS, are rolling release distributions. This is why they are updated on a daily basis and usually don’t remain stuck to the old version for too long. This acts as a clear advantage for the users as they get to use the latest and the greatest software programs all the time.
However, what is given as a boon can also act as a curse in this case. The latest software packages could have a lot of problems and bugs and hence sometimes performs abnormally or show some glitches. In that case, it is recommended that you should downgrade the packages to their previous versions. You can also hold that specific program from updating for some time when you perform the full system upgrade.
In this tutorial, I will show you how to downgrade the packages as well as we will learn how to hold them while upgrading our system.
Warning and considerations before downgrading packages:
It is important to understand the potential risks associated with downgrading a package in Arch Linux-based distributions. Downgrading can lead to dependency conflicts, version inconsistencies, and possible configuration file changes that might affect system stability.
Before attempting to downgrade a package, it wouldn’t hurt to ponder if it’s truly necessary and search the ArchWiki and package-specific forums for known issues and workarounds. If it is due to a bug, please report it to the package founder/maintainer so that they can work on a fix. Proceed with caution, and remember that it is your responsibility to ensure your system remains stable and functional.
Downgrade packages with Pacman Cache
First of all, try and downgrading the packages to the previous or old versions of themselves directly from the pacman cache. This may not work because it relies on the pacman cache being set for more than one version of the package. Let’s give it a try, nonetheless. Open a terminal and type the following commands :
sudo pacman -U /var/cache/pacman/pkg/NAME_OF_PROGRAM
You don’t have to type out the full name of the program you are trying to downgrade, simply type the first full letters and then press the TAB key on your keyboard, and Bash will autocomplete it for you.
As you can see, I don’t have any other version of the file manager ‘Nemo’, so I will try to downgrade it using the second Method.
Downgrade packages using the Arch Linux Archive
Visit the official Arch Linux Archive and look for the package you want to downgrade. And download the version which you like.
Once the download finishes, open the Terminal and type the following command :
sudo pacman -U /Path/to/dowloaded/package
After the Installation finishes, you can check the version of the installed package using the following command :
Exclude package from upgrading while updates
You can also exclude the package from upgrading while you upgrade your whole system by modifying the Pacman’s config file. You can do this by modifying the file in your favorite text editors, such as vim or nano.
# Using vim editor sudo vim /etc/pacman.conf # Using nano editor sudo nano /etc/pacman.conf
Now, add the following lines to the file :
IgnorePkg = pacage-name
If you want to prevent updates of multiple packages, then simply separate their names with a comma (,).
Save the file by pressing Ctrl+O and exit by pressing Ctrl+X if you are using the nano editor. If you are using the vim editor, then press the Escape key and type :wq.
Arch Linux Archive to restore the system to an earlier date:
You can restore your system to an earlier date using the Arch Linux Archive. First, visit the Arch Linux Archive website and choose a specific date to downgrade your packages. Find the package in question and download it. Then edit the `/etc/pacman.conf` file to temporarily include the chosen Arch Linux Archive repository. Finally, update the package with the new mirror and downgrade it.
Rebuilding the package using PKGBUILD and makepkg:
The process of downgrading an older package version often involves rebuilding it using the PKGBUILD file and makepkg command. For packages from the official repositories, you will need to go back to the correct version on the Arch Linux package list, which can still be found on the Arch Linux website.
Follow these steps to rebuild the package:
1. Retrieve the appropriate PKGBUILD file using the Arch Build System (ABS). If you’re working with an older package, we may need to search for it in the Arch User Repository(AUR). Be extremely cautious when it comes to choosing the correct package version.
2. Open the PKGBUILD file in your favorite text editor, and modify the ‘pkg name’, ‘pkgver’, and other necessary fields to reflect the target version of the package. Check if any other changes, such as checksum updates or patches, are needed to build the package successfully.
3. Save the modified PKGBUILD file and then build the package by running the `makepkg` command in the terminal:
This command will compile the package and install it on your system. Keep in mind that downgrading a package may require its dependencies to be downgraded or rebuilt as well. If the number of packages to be downgraded is large, other methods, like using a snapshot or the Arch Linux Archive, might be more suitable.
Automation with the ‘downgrade’ Bash script:
The ‘downgrade’ Bash script is a useful tool for automating the package downgrading process in Arch-based distributions. It simplifies the task by allowing you to select and downgrade a package interactively. To install and use the ‘downgrade’ script, follow these steps:
1. Install the ‘downgrade’ package from the AUR:
yay -S downgrade
If you do not have `yay` installed, you can use any other AUR helper or install it manually.
2. Run the ‘downgrade’ command followed by the package name you want to downgrade:
3. The script will present you with a list of available versions for the specified package. Choose the version you want to downgrade to by entering the corresponding number in the script prompt.
4. Confirm the downgrade and the script will handle the whole process of downloading, verifying, and installing the package.
It is important that you upgrade the package once in a while. Because they come with a lot of security and bug fixes, holding a package can also lead to dependency errors, so be careful with that. And because Arch-based distributions are updated frequently, chances are high that any bugs discovered might get fixed very soon.