How to downgrade a package
- Q: I just ran pacman -Syu and package XYZ was upgraded to version N from version M. This package is causing problems on my computer, how can I downgrade from version N to the older version M?
- A: You may be able to downgrade the package trivially by visiting /var/cache/pacman/pkg on your system and seeing if the older version of the package is stored there. (If you haven't run pacman -Scc recently, it should be there). If the package is there, you can install that version using pacman -U pkgname-olderpkgver.pkg.tar.gz. If pacman complains about file conflicts, you could force it to do the installation anyway with pacman -Uf pkgname-olderpkgver.pkg.tar.gz.
If you can't find older versions on your system, check if one of the mirrors is out of sync, and get it from there. Click here to see the status of mirrors.
You can also check one of these mirrors:
- http://ftp.tu-chemnitz.de/pub/linux/sunsite.unc-mirror/distributions/archlinux/ [Err. 404]
- http://ftp.icm.edu.pl/pub/Linux/sunsite/distributions/archlinux/ [Good]
- http://ftp.parrswood.manchester.sch.uk/Mirrors/ftp.archlinux.org/ [Err. 404]
- http://archlinux.alouche.net [Good, has advanced search] (Note that this cannot be used as an Arch mirror in your pacman.conf, you have to manually download any packages.)
- http://schlunix.org/archlinux/ [Good] (Stores old packages)
If the package is not located there, you will need to compile the older version yourself. To do this you will need a PKGBUILD for the file; you could edit the existing PKGBUILD provided by ABS to use older sources, or you can visit http://www.archlinux.org/packages/ and search for the package you wish to downgrade. Once you find it, click "View SVN entries" and select a diff with a previous revision (ie: for the revision you are interested in). If you use a "side by side" diff, you can copy and paste the entire PKGBUILD into a file and build it with makepkg.
The Arch Rollback Machine contains archived snapshots of all the repos going back to 1 October 2008. I've been using this site to manually locate and download older versions of packages. The urls are constructed in such a way to facility easy wget+pacman scripting to "roll back" your system to a particular date. The introductory forum thread is here.
What about dependencies?
- Q: I can't downgrade a package, because of dependencies.
- A: You can ignore dependencies when upgrading or removing with 'd'. e.g. pacman -Ud pkgpkgname-olderpkgver.pkg.tar.gz.
Stopping Pacman from updating certain packages
- Q: How do I stop Pacman from upgrading downgraded packages?
- A: With the 'IgnorePkg' variable in your pacman.conf.
'IgnorePkg = package1 package2 ...' in your pacman.conf instructs Pacman to ignore any upgrades for selected packages when performing a --sysupgrade.
Reverting to a Savepoint
- Q: I want to go back to how my system was yesterday.
- A: It's easy provided you enabled periodic snapshots.
You can rely on a logical volume manager (LVM) for creating and maintaining snapshots. These snapshots should not be confused with CVS snapshots. LVM snapshots are kernel-level filesystem snapshots that, unlike a full backup, use a COW (copy-on-write) scheme which means that it occupies very little disk space so long as no files were modified, and if files were modified, the snapshot occupies only a little more than the disk space needed to store the pre-modified files. This usually means that you can snapshot a 35GB system with only 2GB free space, considering that pacman -Sy will likely modify far less than 2GB of data. If the state of your system after the upgrade is undesirable, you can quickly rollback to previous snapshot images of your system.