Downgrading packages
Related articles
This guide explains how to downgrade a package to a previous version. While downgrading is not normally recommended, Arch is a rolling release distribution, so you can expect to encounter bugs occasionally in a new release and you may prefer to downgrade a buggy package to a stabler version rather than wait for an update. If you do find a bug, please help by reporting it on the Arch bug tracker or to the upstream project itself.
The Arch Rollback Machine is in development and awaiting useful incorporation into pacman to automate the downgrade process.
Warnings
- Downgrading one package may require that its dependencies be downgraded as well. When the number of packages to downgrade is large, it may be simpler to re-install the system, especially for fundamental OS components.
- The previous version you wish to downgrade to may have been removed from your system. Arch's repositories are automatically upgraded so it may be difficult to obtain older package versions. See more about this problem below.
- Be careful with changes to configuration files and scripts. For now pacman will handle this for us, as long as we do not bypass its safeguards.
How to downgrade a package
Official packages
You may be able to downgrade the package trivially if an older version is stored at /var/cache/pacman/pkg
on your system. (If you have not run pacman -Scc
recently, it should be there.) If so, you can install that version using pacman -U /var/cache/pacman/pkg/pkgname-olderpkgver.pkg.tar.gz
.
This process will remove the current package and install the older version. Dependency changes will be handled, but pacman will not handle version conflicts. If a library or other package needs to be downgraded with the packages, please be aware that you will have to downgrade this package yourself as well.
Alternatively, the AUR package downgradeAUR is a simple Bash script that automates this process by checking your cache for older package versions. If necessary, it will also search the Arch Rollback Machine. You can then select a package to install. Check downgrade --help
for usage.
Another tool is downgraderAUR, which also works with pacman's log, can downgrade packages from ARM and local cache, and handles lists of packages. This tool is especially useful if your system is unstable after an update but you aren't sure which package is the culprit.
Downgrading the kernel
If you are unable to boot after a kernel update, then you can downgrade the kernel via a live CD. Use a fairly recent Arch Linux installation medium. Once it has booted, mount the partition where your system is installed to /mnt
, and if you have /boot
or /var
on separate partitions, mount them there as well (e.g. mount /dev/sdc3 /mnt/boot
). Then chroot into the system:
# arch-chroot /mnt /bin/bash
Here you can go to /var/cache/pacman/pkg
and downgrade the packages. At least downgrade linux, linux-headers and any kernel modules. For example:
# pacman -U linux-3.5.6-1-x86_64.pkg.tar.xz linux-headers-3.5.6-1-x86_64.pkg.tar.xz virtualbox-host-modules-4.2.0-5-x86_64.pkg.tar.xz
Exit the chroot (with exit
), reboot and you should be done.
Downgrading the kernel on a system using LVM on LUKS
Boot the Arch Linux installation ISO, and run the following commands to unlock the LUKS container and chroot into the system.
Load the necessary kernel modules:
# modprobe dm_crypt # modprobe dm_mod
Unlock the LUKS container:
# cryptsetup luksOpen /dev/sdxY crypt
Scan for and activate LVM volumes:
# vgscan # vgchange -ay
Create a folder for mounting and mount the partitions. Adapt this as necessary for the given system.
# mkdir /mnt # mount /dev/mapper/LVM-partition /mnt
Mount the boot partition.
# mount /dev/sdxZ /mnt/boot
Chroot into the mounted filesystem.
# arch-chroot /mnt /bin/bash
At this point, follow the instructions in the previous section #Downgrading the kernel.
Source: http://sch1zo.github.com/blog/2012/05/08/downgrading-a-bad-kernel-on-arch-with-luks-and-lvm/
AUR packages
For AUR packages, currently the only way to get the older PKGBUILDs is at http://pkgbuild.com/git/aur-mirror.git/ or check the Unofficial user repositories for precompiled binaries (they are sometimes out of date). If you want to use AUR-mirror, follow these steps:
- Navigate to http://pkgbuild.com/git/aur-mirror.git/log/PACKAGENAME .
- Click on the particular commit or date.
- Download the AUR snapshot (aur-mirror-COMMIT.tar.xz) for that commit (~100MB).
- Unpack it with
tar xvJf aur-mirror-COMMIT.tar.xz
And finally, browse to the package folder and use the procedure described in Arch User Repository#Installing packages.
Finding your older version
There are three ways to do this.
Out-of-sync mirrors
If you can not 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.
Arch Rollback Machine
The Arch Rollback Machine is an everyday snapshot of official Archlinux mirror. For more information, please see Arch Rollback Machine.
Recompile the package
In worst-case scenario, if the package is not located anywhere else, you will need to compile the older version yourself. To do this you will need an older revision of the PKGBUILD for the package, which can be obtained in multiple ways:
- You could edit the existing PKGBUILD provided by ABS to use older sources.
- You can visit https://www.archlinux.org/packages/ and search for the package you wish to downgrade. Once you find it, click "View Changes" and select "log". Locate the version you need and click on the path. Then just download the files located in that directory and build it with makepkg.
- You can checkout an older revision of a package from the SVN repository.
FAQ
I cannot downgrade a package, because of dependencies
You can ignore dependencies when upgrading or removing, using the d
flag. But this might break your system further.
# pacman -Ud /path/to/packagename-oldversion.pkg.tar.gz
How do I stop pacman from upgrading downgraded packages?
Uncomment IgnorePkg
from /etc/pacman.conf
and add them in sequence. For example:
/etc/pacman.conf
... IgnorePkg = gimp libtorrent-rasterbar ...
This will instruct pacman to ignore any upgrades for selected packages when performing a system update.
I want to go back to how my system was yesterday
It is easy if you have enabled periodic snapshots provided by LVM.