Home Arch Linux How To Downgrade A Package In Arch Linux

How To Downgrade A Package In Arch Linux

Easily Rollback Packages to Previous Version in Arch Linux, EndeavourOS and Manjaro Linux.

By sk
Published: Updated: 53.1K views

As you may know, Arch Linux is a rolling release and DIY (do-it-yourself) distribution, requiring careful updates, particularly when installing or updating packages from third-party repositories like the AUR. Carelessness can lead to a broken system, making it your responsibility to maintain Arch Linux's stability. However, mistakes happen, and the desire to update to the most bleeding-edge software can occasionally result in broken packages. In such situations, don't panic! You can simply rollback to the previously stable packages. This brief tutorial explains how to downgrade a package in Arch Linux and its variants, such as EndeavourOS and Manjaro Linux.

The officially recommended method might help only if the pacman cache was not cleaned. If you already cleared the cache, you can still downgrade using the following method.

For Arch Linux and its variants, there is an utility called "downgrade" that helps you to downgrade an installed package to any available older version. This utility will check your local cache and the remote servers (Arch Linux repositories) for the old versions of a required package. You can pick any one of the old stable package from that list and install it.

Install downgrade Utility in Arch Linux

The 'downgrade' package is not available in the official repositories. You should either install it from AUR or from the unofficial archlinuxfr repository. First we will see how to install it from AUR.

Install downgrade from AUR

The downgrade package is available in AUR, so you can install it using any AUR helper programs such as Paru or Yay.

Using Paru:

$ paru -S downgrade

Using Yay:

$ yay -S downgrade

Install downgrade from archlinuxfr Repository

A word of caution: The official Arch Linux Developers and the Trusted Users do not perform tests of any sort to verify the contents of unofficial repositories. You must decide whether to trust their maintainers and you take full responsibility for any consequences of using any unofficial repository.

To add archlinuxfr repository, edit /etc/pacman.conf file:

$ sudo nano /etc/pacman.conf

Add the following lines:

[archlinuxfr]
Server = http://repo.archlinux.fr/$arch

Save and close the file.

Update the repositories with command:

$ sudo pacman -Syu

Then install "Downgrade" utility using the following command from your Terminal:

$ sudo pacman -S downgrade

Downgrade a package in Arch Linux

The typical usage of "downgrade" command is:

$ sudo downgrade [PACKAGE, ...] [-- [PACMAN OPTIONS]]

Let us say you want to downgrade opera web browser to any available old version.

To do so, run:

$ sudo downgrade opera

This command will list all available versions of opera package (both new and old) from your local cache and remote mirror.

Sample output:

Available packages:

 1) opera-37.0.2178.43-1-x86_64.pkg.tar.xz (local)
 2) opera-37.0.2178.43-1-x86_64.pkg.tar.xz (remote)
 3) opera-37.0.2178.32-1-x86_64.pkg.tar.xz (remote)
 4) opera-36.0.2130.65-2-x86_64.pkg.tar.xz (remote)
 5) opera-36.0.2130.65-1-x86_64.pkg.tar.xz (remote)
 6) opera-36.0.2130.46-2-x86_64.pkg.tar.xz (remote)
 7) opera-36.0.2130.46-1-x86_64.pkg.tar.xz (remote)
 8) opera-36.0.2130.32-2-x86_64.pkg.tar.xz (remote)
 9) opera-36.0.2130.32-1-x86_64.pkg.tar.xz (remote)
 10) opera-35.0.2066.92-1-x86_64.pkg.tar.xz (remote)
 11) opera-35.0.2066.82-1-x86_64.pkg.tar.xz (remote)
 12) opera-35.0.2066.68-1-x86_64.pkg.tar.xz (remote)
 13) opera-35.0.2066.37-2-x86_64.pkg.tar.xz (remote)
 14) opera-34.0.2036.50-1-x86_64.pkg.tar.xz (remote)
 15) opera-34.0.2036.47-1-x86_64.pkg.tar.xz (remote)
 16) opera-34.0.2036.25-1-x86_64.pkg.tar.xz (remote)
 17) opera-33.0.1990.115-2-x86_64.pkg.tar.xz (remote)
 18) opera-33.0.1990.115-1-x86_64.pkg.tar.xz (remote)
 19) opera-33.0.1990.58-1-x86_64.pkg.tar.xz (remote)
 20) opera-32.0.1948.69-1-x86_64.pkg.tar.xz (remote)
 21) opera-32.0.1948.25-1-x86_64.pkg.tar.xz (remote)
 22) opera-31.0.1889.174-1-x86_64.pkg.tar.xz (remote)
 23) opera-31.0.1889.99-1-x86_64.pkg.tar.xz (remote)
 24) opera-30.0.1835.125-1-x86_64.pkg.tar.xz (remote)
 25) opera-30.0.1835.88-1-x86_64.pkg.tar.xz (remote)
 26) opera-30.0.1835.59-1-x86_64.pkg.tar.xz (remote)
 27) opera-30.0.1835.52-1-x86_64.pkg.tar.xz (remote)
 28) opera-29.0.1795.60-1-x86_64.pkg.tar.xz (remote)
 29) opera-29.0.1795.47-1-x86_64.pkg.tar.xz (remote)
 30) opera-28.0.1750.51-1-x86_64.pkg.tar.xz (remote)
 31) opera-28.0.1750.48-1-x86_64.pkg.tar.xz (remote)
 32) opera-28.0.1750.40-1-x86_64.pkg.tar.xz (remote)
 33) opera-27.0.1689.76-1-x86_64.pkg.tar.xz (remote)
 34) opera-27.0.1689.69-1-x86_64.pkg.tar.xz (remote)
 35) opera-27.0.1689.66-1-x86_64.pkg.tar.xz (remote)
 36) opera-27.0.1689.54-2-x86_64.pkg.tar.xz (remote)
 37) opera-27.0.1689.54-1-x86_64.pkg.tar.xz (remote)
 38) opera-26.0.1656.60-1-x86_64.pkg.tar.xz (remote)
 39) opera-26.0.1656.32-1-x86_64.pkg.tar.xz (remote)
 40) opera-12.16.1860-2-x86_64.pkg.tar.xz (remote)
 41) opera-12.16.1860-1-x86_64.pkg.tar.xz (remote)

select a package by number:

Just type the package number of your choice, and hit enter to install it.

That's it. The current installed package will be downgraded to the old version.

So, how can avoid broken packages and make Arch Linux more stable?

Check Arch Linux news and forums before updating Arch Linux to find out if there have been any reported problems. I have been using Arch Linux as my main OS for the past few years. Here are some simple tips that I have learned over a period of time to avoid installing unstable packages in Arch Linux.

  1. Avoid partial upgrades. It means that never run "pacman -Sy <package-name>" or "pacman -Sy". This command will partially upgrade your system while installing a package. Instead, first use "pacman -Syu" to update the system and then use "package -S <package-name>" to a install package.
  2. Avoid using "pacman -Syu --force" command. The --force flag will ignore the package and file conflicts and you might end-up with broken packages or broken system.
  3. Do not skip dependency check. It means that do not use "pacman -Rdd <package-name>". This command will avoid dependency check while removing a package. If you run this command, a critical dependency which is needed by another important package could be removed too. Eventually, it will break your Arch Linux.
  4. It is always a good practice to make regular backup of important data and configuration files to avoid any data loss.
  5. Be careful while installing packages from third party and unofficial repositories like AUR or archlinuxfr. And do not install packages that are in heavy development.

For more details, check the Arch Linux maintenance guide.

I don't trust AUR and other unofficial repositories. What to do?

The 'downgrade' package is hosted in AUR. If you doubt the authenticity of the AUR packages and you do not prefer installing packages from AUR and unofficial repository (archlinuxfr), I suggest you to follow the officially recommended way to downgrade a package as explained in the Arch Wiki.

Resource:

Related Read:

You May Also Like

13 comments

Not an actual troll May 27, 2016 - 7:18 pm

Great utility. How did you install it with pacman? I could not find it in the package repository only in the AUR. A search in the package repository: https://www.archlinux.org/packages/?sort=&q=downgrade&maintainer=&flagged=

Reply
SK May 30, 2016 - 4:50 pm

You’re right. This package is not available in the official repositories. You need to add the unofficial archlinuxfr repository.

To do so, edit /etc/pacman.conf file:

sudo nano /etc/pacman.conf
Add the following lines:

[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch

I forgot to mention this in guide. Now, I updated the guide. Thanks.

Reply
Henrique Maia November 28, 2016 - 12:34 am

Thank you for this post. It helped me when I was stuck with a package with a bug. Great help.

Reply
Andreas Hallof May 29, 2018 - 3:25 pm

Thanks for the article and this program. It helped me to roll back my broken xorg-server installation and saved me a lot of time and headache.

Reply
bashM0nk3y June 14, 2018 - 7:28 am

Good article!

As a side note, the more arch-centric way of doing this would be to for go adding the third party repo (archlinux.fr) to /etc/pacman.conf, and instead do the following:

From your home directory, enter the following commands:

wget https://aur.archlinux.org/cgit/aur.git/snapshot/package-query.tar.gz
tar xzvf package-query.tar.gz
cd package-query
makepkg -si
cd ..
wget https://aur.archlinux.org/cgit/aur.git/snapshot/yaourt.tar.gz
tar xzvf yaourt.tar.gz
cd yaourt
makepkg -si
cd ..
wget https://aur.archlinux.org/cgit/aur.git/snapshot/downgrade.tar.gz
tar xzvf downgrade.tar.gz
cd downgrade
makepkg -si

… and then install downgrade with yaourt (never append `sudo` to yaourt!):

yaourt -S downgrade

All due respect to the author of this article, but it is NOT recommended to perfom `partial upgrades` as described in this tutorial.
For example:

sudo pacman -Sy

sudo pacman -S downgrade

This can, and probably eventually will, create an unstable system. The correct way to do this would be to:

sudo pacman -Syu

sudo pacman -S downgrade

Again, no disrespect at all to the author, I just wanted to help improve this article =)

Reply
sk June 14, 2018 - 1:39 pm

Thanks for letting me know. I will update the guide ASAP.

Reply
Anonymous June 14, 2018 - 4:25 pm

That’s not the more arch-centric way, that’s retarded. See the discussions here: https://www.reddit.com/r/archlinux/comments/8r0kxg/how_to_downgrade_a_package_in_arch_linux/

Reply
Afab June 14, 2018 - 4:28 pm

You should update the guide to just link to the article in the Arch.-Wiki: https://wiki.archlinux.org/index.php/downgrading_packages
Most of the ways you explained in the guide are either stupid, insecure or both.

Reply
sk June 14, 2018 - 5:58 pm

I am terribly sorry for being so stupid. I removed the method suggested in this comment and added the Arch wiki link.

Reply
High Spade June 14, 2018 - 3:46 pm

Don’t use yaourt. Also, don’t use an unofficial repo. Why don’t you just use the method described in the wiki? That’s the supported way to downgrade a package and the only way to do it that you will be able to get support for.

Reply
sk June 14, 2018 - 6:04 pm

Yeah, sorry for being ignorant. I added the official arch wiki link as everyone suggested.

Reply
elswerky January 1, 2019 - 7:10 pm

in your output of using downgrade to search for opere,,, there are 40 results ,,, when i tested it with say opera ,,chromium and others ,,, it gives me maximum 30 result,,,,, so is there any way to control number of results it gives ???

Reply
gcostanza August 28, 2019 - 11:53 pm

The methods mentioned in this article work great to downgrade a package. I used yay to install the downgrade package from AUR, and used that to downgrade NodeJS without issue.

The ArchWiki also references downgrade, since all it’s doing is automating the steps to retrieve a list of available packages from the pacman-cache. This is exactly what this article describes, so not sure why some people are so nasty to the author. The advice in this article is sound, and complies with steps described in the archwiki.

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More