Changing Mailman Python Scripts for Virtual Host Support
ENUMs, User Preferences, and the MySQL SET Datatype
Getting Set up with Ogre 3D on Ubuntu
Scrollable Tables with Floating Header using CSS
Enforce Coding Standards with PHP_CodeSniffer and Eclipse IDE on Ubuntu Linux
Visualising Website Performance with Flame Graphs

How to Rollback a System Update on Arch Linux

Friday, 6 April 18, 3:24 pm
After updating my system recently (with pacman -Syu), Wine games stopped recognising my gamepad. Native games had no problem,so my first thought was the Wine version bump from 3.4 to 3.5. However, the gamepad still didn't work after downgrading to Wine 3.4, so it seemed that one of the other packages in the upgrade must be the culprit.

There had been a total of 94 packages updated, including the Linux kernel. I didn't relish the idea of manually downgrading each likely package one by one, so I did a bit of Googling, and found out about the Arch archives. All older versions of Arch packages are stored here - a total of over 100,000 packages.

The archives make it easy to roll back your system to any date in the past. All you need to do is point pacman at the archive specifying the date you want to roll back to in the URL, refresh your local package database and upgrade your system.

So to roll back your entire system to a specific past date, run the following:
# back up mirrorlist first sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.old   # point mirrorlist to the archive specifying date to rollback to e.g. to return to 5th April: echo 'Server=https://archive.archlinux.org/repos/2018/04/05/$repo/os/$arch' | sudo tee /etc/pacman.d/mirrorlist   # do a full system upgrade (double 'y' refreshes your package database, double 'u' allows pacman to downgrade packages) sudo pacman -Syyuu
Don't forget to reboot if this downgrades the kernel or graphics drivers. Once you've finished living in the past and reminiscing about how good things used to be, restore your original mirrorlist and run pacman -Syu to return to the land of mortals.

Issues with Revoked Package Keys

You may encounter issues if you are rolling back any packages to versions which are signed using a signature that has since been removed from the pacman-key gpg database. In such cases, you will see this error message and the downgrade will fail:

error: package-name: signature from "packager" is unknown trust

To get around this, you can do one of the following:
  • Uninstall the affected package(s): sudo pacman -R package-name
  • Manually sign the untrusted key locally (not recommended)
  • Edit /etc/pacman.conf and temporarily set SigLevel to TrustAll (even less recommended – be sure to set it back to TrustedOnly once you're done)

Rollback Only Specific Packages

There are a couple of ways to do this. If you're rolling back to a version you previously had installed, you will have the older package in your own local pacman cache at /var/cache/pacman/pkg, and you can install that one directly:
# go to the pacman cache directory cd /var/cache/pacman/pkg   # find the package you want ls *wine*   # attempt to install it sudo pacman -U wine-3.4-2-x86_64.pkg.tar.xz
Alternatively, if you want to install a specific package version that you didn't previously have, you can access it from the Arch archives:
sudo pacman -U https://archive.archlinux.org/packages/.all/wine-3.4-2-x86_64.pkg.tar.xz
Note the format of the package version in the package name - <major version>.<minor verson>-<Arch release number>-<architecture>.pkg.tar.xz - in particular remember that it's a hyphen between the minor version number and Arch release number, and the Arch release number does *not* correspond to the software minor minor version number (3.4.x).

Depending on the package and how far back you're going, both these approaches will often fail due to dependencies. You could also downgrade those older dependencies in a similar fashion, but at the risk of breaking other software that depends on them.

Lastly, if you just know the date you want to roll back to, you can change your mirrorlist so it points to the date of interest in the archives, refresh pacman's package database and then reinstall the packages in question:
# back up mirrorlist first sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.old   # point mirrorlist to the archive specifying date to rollback to e.g. to return to 5th April: echo 'Server=https://archive.archlinux.org/repos/2018/04/05/$repo/os/$arch' | sudo tee /etc/pacman.d/mirrorlist   # refresh your local package database sudo pacman -Syy   # reinstall the package(s) in question sudo pacman -S wine

Cleaning Up

Once you've finished messing with older packages, restore your original mirrorlist and run pacman -Syu to get back up to date. If you want to keep using an older package when upgrading the rest of the system, add IgnorePkg=<package name> to /etc/pacman.conf.

Please enter your comment in the box below. Comments will be moderated before going live. Thanks for your feedback!

Cancel Post

/xkcd/ Wells