Going back to an older version of a package
Every package pacman installs is kept as a file under /var/cache/pacman/pkg. That cache is not only a download saver: it is the reason an upgrade that went badly can be stepped back from without a network.
sudo pacman -U /var/cache/pacman/pkg/<file>
-U- --upgrade — install a package from a local package file rather than from a repository
Needs root.
What it does. Install a package from a file on disk, which is how an older version comes back without a download.
Watch out. The older version stays only until the next upgrade moves it forward again, unless it is held back, and holding it back has its own cost.
Finding the version you want
The cache holds one file per version downloaded, named for the package, the version and the architecture. Listing it is a shell job rather than a pacman one:
ls /var/cache/pacman/pkg | grep '^firefox-'<package>-<version>-<release>-<arch>.pkg.tar.zstThe shape of the file name. The release number after the version is the part that moves when a package is rebuilt without its source changing.
If the version you want is not there, it was cleaned out. The cache page covers which command took it and the paccache page covers keeping a set number of versions so that this does not happen again.
Putting it back
An older version goes back on with the upgrade-from-file operation, which is
the same -U used for any package file on disk:
sudo pacman -U /var/cache/pacman/pkg/firefox-1.0-1-x86_64.pkg.tar.zstThe file name here is a shape, not a real release. Take the one the listing above gave you.
pacman prints the downgrade it is about to do and waits, as it does for an install. Read that line: it is the moment to notice that the version you picked is older than you meant.
| Situation | What to do | Level |
|---|---|---|
| One package misbehaves after an upgrade | Install the previous file from the cache with -U | routine |
| The package has dependencies that also moved | Going back on one alone can leave it against newer libraries, which is the same mismatch described on the partial upgrade page | routine |
| The repositories themselves carry an older version than the machine | That is what a doubled u is for, and it moves more than one package | risky |
Making it stay, and what that costs
The next -Syu will move the package forward again, because the repository
version is newer. Keeping it where it is means holding it back, which is the
subject of the holding a package back page and
which leaves the machine in a state the partial
upgrade page describes.
A package pinned to an older version while everything around it moves on is linked against libraries that have since been replaced. That is a partial upgrade narrowed to one name, and it gets worse the longer it is left, so a downgrade is best treated as a stop on the way to a fix rather than as a resting place.
The other direction: -Syuu
There is a case where the machine is ahead of the repositories rather than
behind: a package came from a repository that has since been disabled, or from
somewhere that is not a repository at all. An ordinary upgrade prints a line
saying the installed version is newer and skips it. A doubled u tells pacman to
move it back to what the repositories carry:
sudo pacman -SyuuThis can move more than the package you were thinking of, so read the list pacman prints before answering.
Common questions
How do I downgrade a package on Arch Linux?
Install the older file from /var/cache/pacman/pkg with sudo pacman -U followed by the path to it. The cache holds one file per version that was downloaded, so the previous version is usually still there.
Why is the old version missing from the cache?
A cleaning command took it. pacman -Scc empties the cache completely, and paccache with a low keep count trims old versions of packages that are still installed.
Will an upgrade undo my downgrade?
Yes. The repository version is newer, so the next sudo pacman -Syu moves the package forward again unless it is held back in pacman.conf, and holding it back leaves the machine in a partial state.
What does pacman -Syuu do?
The doubled u lets pacman replace an installed package with an older version from the repository. It is for the case where the machine is ahead of the repositories, and it can move more than one package.