Difference between revisions of "Downgrading packages"

From ArchWiki
Jump to: navigation, search
m (Arch Rollback Machine)
(simplification and beautification of wikilinks, fixing whitespace, capitalization and section fragments (https://github.com/lahwaacz/wiki-scripts/blob/master/link-checker.py (interactive)))
 
(93 intermediate revisions by 25 users not shown)
Line 1: Line 1:
 
[[Category:Package management]]
 
[[Category:Package management]]
[[cs:Downgrading Packages]]
+
[[cs:Downgrading packages]]
[[de:Ältere_Paketversion_installieren_(Downgrade)]]
+
[[de:Ältere Paketversion installieren (Downgrade)]]
[[es:Downgrading Packages]]
+
[[es:Downgrading packages]]
 
[[fa:دانگرید]]
 
[[fa:دانگرید]]
 
[[fr:Downgrade]]
 
[[fr:Downgrade]]
[[it:Downgrading Packages]]
+
[[it:Downgrading packages]]
[[ja:Downgrading Packages]]
+
[[ja:パッケージのダウングレード]]
[[ru:Downgrading Packages]]
+
[[ru:Downgrading packages]]
[[sk:Downgrading Packages]]
+
[[sk:Downgrading packages]]
[[tr:Paket_sürümünü_düşürmek]]
+
[[tr:Paket sürümünü düşürmek]]
[[uk:Downgrading Packages]]
+
[[uk:Downgrading packages]]
[[zh-CN:Downgrading Packages]]
+
[[zh-cn:Downgrading packages]]
{{Article summary start}}
+
{{Related articles start}}
{{Article summary text|Covers why and how to revert to older versions of packages.}}
+
{{Related|Arch Build System}}
{{Article summary heading|Related}}
+
{{Related|makepkg}}
{{Article summary wiki|Arch Build System}}
+
{{Related|pacman}}
{{Article summary wiki|pacman}}
+
{{Related|Arch Linux Archive}}
{{Article summary end}}
+
{{Related articles end}}
 +
{{Expansion|soname bumps, cf. [[Frequently_asked_questions#What_if_I_run_a_full_system_upgrade_and_there_will_be_an_update_for_a_shared_library.2C_but_not_for_the_apps_that_depend_on_it.3F]]}}
  
This guide will show you how to downgrade a package to a previous version. Downgrading a package is not normally recommended and is often only necessary when a bug is introduced in the current package.
+
Before downgrading a single or multiple packages, consider why you wish to do so. If it is due to a bug, search the [https://bugs.archlinux.org/ bug tracker] for existing tasks. If there is none, add a new task; it is better to correct bugs, or at least warn other users of possible issues.
  
Before downgrading, consider why you are doing so. If it is because of a bug, please help both Arch and upstream developers by spending a few minutes reporting the bug on the Arch [https://bugs.archlinux.org/ bug tracker] or to the upstream project itself. Because Arch is a rolling release distribution, you will likely be continuously working with new packages and will experience a bug from time to time.
+
{{Warning|
 +
* Downgrading one package may require that its dependencies be downgraded as well. When the number of packages to downgrade is large, consider using a snapshot. See [[Arch Linux Archive#How to restore all my packages at a specific date]].
 +
* 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.
 +
}}
  
Both we and the upstream developers would appreciate the effort. That extra bit of information could save hours of testing and debugging and may also help release more stable software.
+
== Return to an earlier package version ==
  
== Reason ==
+
=== Using the pacman cache ===
  
The process of downgrading is that of uninstalling the current package and installing a previous version. The previous version can be an immediate version (the package version directly before it) or to a number of versions prior.
+
If a package was installed at an earlier stage, and the [[Pacman#Cleaning_the_package_cache|pacman cache]] was not cleaned, install an earlier version from {{ic|/var/cache/pacman/pkg/}}.
  
The reasons for downgrading include (among others): that the current version has a bug, does not yet contain the desired functionality, or was done for experimental reasons. In any of these cases, the user has chosen that it would be less problematic to revert to a previous version than to wait for a new release.
+
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.
 +
 +
# cd /var/cache/pacman/pkg/
 +
# pacman -U <file_name_of_the_package>
  
Downgrading a package may mean that other packages may have to be downgraded with it. For those that have installed a good amount of experimental packages, and edited a good deal of configurations, it may be preferable to re-install the system rather than trying to downgrade.
+
Once the package is reverted, temporarily add it to the [[Pacman#Skip package from being upgraded|IgnorePkg section]] of {{ic|pacman.conf}}, until the difficulty with the updated package is resolved.
 
+
== The details ==
+
 
+
However, the user must keep in mind the following points:
+
* Consider the dependencies of each program. The required libraries often change with each version, and the functionality of associated files may be completely different from previous ones. The solution will require changing these to earlier versions as well.
+
* Consider if the necessary files have been removed from the system and are even going to be available from any source. Arch Linux's rolling release system of repositories are automatically upgraded without saving any older versions. See more about this problem below.
+
* Be careful with changes to configuration files and scripts. At this point in time, we will rely upon pacman to handle this for us, as long as we do not bypass any safeguards it contains.
+
 
+
The Arch Rollback Machine concept is being developed and awaiting useful incorporation into pacman. Once that occurs, this will become automated.
+
 
+
== How to downgrade a package ==
+
 
+
* Q: I just ran {{Ic|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 {{Ic|/var/cache/pacman/pkg}} on your system and seeing if the older version of the package is stored there. (If you have not run {{Ic|pacman -Scc}} recently, it should be there). If the package is there, you can install that version using {{Ic|pacman -U /var/cache/pacman/pkg/pkgname-olderpkgver.pkg.tar.gz}}.
+
 
+
This process will remove the current package, will carefully calculate all of the dependency changes, and will install the older version you have chosen with the proper dependencies down the line.
+
 
+
{{Note|If you change a fundamental part of the OS, you may end up with the need to take out literally dozens of packages and replace them with their older versions. Or they may just be gone and you will have to put them back in a manual, piece-meal fashion, while being careful that a particular upgrade does not want to re-install the undesirable package version you did not want in the first place.}}
+
 
+
There is also a package in the [[AUR]] called {{AUR|downgrade}}. This is a simple Bash script which will look in your cache for older versions of packages. It will also search the [[#ARM|A.R.M.]] if there is no package in your cache. You can then select a package to install. It basically just automates the processes outlined here. Check {{Ic|downgrade --help}} for usage information.
+
 
+
One more powerful tool is named {{AUR|downgrader}}, and it works with pacman's log also, can downgrade packages from ARM, local cache, and work with list of packages (if your system unstable after upgrade of some packages, and you unsure about package name)
+
  
 
=== Downgrading the kernel ===
 
=== 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. When it has booted, mount the partition with your system on (e.g. {{ic|/mnt}}) and if you have {{ic|/boot}} or {{ic|/var}} on separate partitions, mount them there, as well (e.g. {{ic|mount /dev/sdc3 /mnt/boot}}). Then mount {{ic|dev}}, {{ic|proc}}, etc:
+
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 {{ic|/mnt}}, and if you have {{ic|/boot}} or {{ic|/var}} on separate partitions, mount them there as well (e.g. {{ic|mount /dev/sdc3 /mnt/boot}}). Then [[chroot]] into the system:
  
  # mount -t proc proc /mnt/proc
+
  # arch-chroot /mnt /bin/bash
# mount -t sysfs sys /mnt/sys
+
# mount -o bind /dev /mnt/dev
+
  
And finally, [[chroot]] into the system {{ic|chroot /mnt /bin/bash}}. Here you can go to {{ic|/var/cache/pacman/pkg}} and downgrade the packages. At least downgrade {{Pkg|linux}}, {{Pkg|linux-headers}} and any kernel modules. For example:
+
Here you can go to {{ic|/var/cache/pacman/pkg}} and downgrade the packages. At least downgrade {{Pkg|linux}}, {{Pkg|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
 
  # 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
Line 69: Line 52:
 
Exit the chroot (with {{ic|exit}}), reboot and you should be done.
 
Exit the chroot (with {{ic|exit}}), reboot and you should be done.
  
If you have a more exotic setup (lvm, encryption, ...), see this post: http://sch1zo.github.com/blog/2012/05/08/downgrading-a-bad-kernel-on-arch-with-luks-and-lvm/
+
=== Arch Linux Archive ===
 
+
== 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 [https://www.archlinux.org/mirrors/status/ status of mirrors].
+
 
+
=== Arch Rollback Machine ===
+
 
+
The [http://arm.konnichi.com/ Arch Rollback Machine] (ARM) contains archived snapshots of all the repos going back to 1 November 2009. The site is in a state of flux as of this date (21 November 2009), and now has lost the items back thru 1 October 2008, as previously reported.
+
 
+
If you are interested in ARM, it would be best to view the introductory forum announcement and discussion, so as to stay abreast of the current progress of the project. The introductory forum thread is [https://bbs.archlinux.org/viewtopic.php?id=53665 here].
+
 
+
It is said that the goal was to construct the urls in such a way as to facilitate easy wget+pacman scripting to "roll back" your system to a particular date. The automation process is not yet explained. To just manually search for a particular package, one can use the search page which has been provided at [http://arm.konnichi.com/search/ ARM Search].
+
 
+
There is several tools available (via AUR) for automatically download old packages from ARM: {{AUR|armh}}, {{AUR|pkgman}} and {{AUR|downgrade}}.
+
 
+
=== 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 a PKGBUILD for the file; you could edit the existing PKGBUILD provided by ABS to use older sources, or 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.
+
The [[Arch Linux Archive]] is a daily snapshot of the [[official repositories]].
  
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).
+
The ''ALA'' can be used to install a previous package version, or restore the system to an earlier date.
  
== Change repositories ==
+
=== Rebuild the package ===
  
To change repository to ARM, remarks-out the old line and adds the appropriate directory location in the format:
+
If the package is unavailable, find the correct [[PKGBUILD]] and rebuild it with [[makepkg]].
  
[core]
+
For packages from the [[official repositories]], retrieve the PKGBUILD with [[ABS]] and change the software version. Alternatively, find the package on the [https://www.archlinux.org/packages Packages] website, click "View Changes", and navigate to the desired version. The files are available through a {{ic|.tar.gz}} snapshot, and via the ''Tree'' view.
#<nowiki>Server=http://mirrors.gigenet.com/archlinux/core/os/$arch</nowiki>
+
<nowiki>Server=http://arm.konnichi.com/2009/11/01/core/os/$arch</nowiki>
+
  
In this example, the date section is taking whatever packages are available as of the date of November 1st, 2009. Please note that all repositories are snapshots of the official repositories. You need only change the mirror in {{ic|/etc/pacman.d/mirrorlist}}, placing an ARM mirror at the top. For example, <nowiki>http://arm.konnichi.com/2009/11/01/$repo/os/i686</nowiki> to sync all official repositories listed in {{ic|/etc/pacman.conf}} to the chosen ARM mirror then update with:
+
See also [[Getting PKGBUILDs from SVN#Checkout an older revision of a package]].
  
# pacman -Syy  #Refresh the sync databases.
+
Old AUR packages can be obtained from [http://pkgbuild.com/git/aur-mirror.git/ aur-mirror]. See [[Arch User Repository#Git repositories for AUR3 packages]] for details.
# pacman -Suu  #Downgrade all packages with a lower version in the repos.
+
  
This alone does not guarantee a seamless rollback as there are sometimes package conflicts with regards to version numbers, etc. If you know the repository it may be easier to visit the global mirror. For example, <nowiki>http://arm.konnichi.com/core/os/$arch</nowiki> (note the omission of the date).
+
==== vABS - Versioned Arch Build System ====
  
More information, please see [[pacman]].
+
[https://vabs.archlinux-br.org vABS] is an addition to ABS that has as main goal to keep different versions of the official PKGBUILDs. In ABS you have the latest versions of PKGBUILDs, while in vABS you also have old versions (up to 2 years). Select the desired version and download the build files tgz package or individual files and easily build your package with pkgbuild. More information about the service can be found [https://www.archlinux-br.org/vabs_en here].
  
== FAQ ==
+
=== Automation ===
  
{{FAQ
+
{{AUR|downgrader}} is a tool which works with libalpm, supports the pacman log and downgrading packages using [[Arch Linux Archive]], local cache and [http://repo-arm.archlinuxcn.org ARM].
|question=I can not downgrade a package, because of dependencies.
+
|answer=You can ignore dependencies when upgrading or removing, using the {{ic|d}} flag. But this might break your system further.
+
{{bc|# pacman -Ud /path/to/''packagename-oldversion''.pkg.tar.gz}}}}
+
  
{{FAQ
+
The {{AUR|downgrade}} package is a Bash script to downgrade one (or multiple) packages, by using the pacman cache or the [[Arch Rollback Machine]]. See {{ic|man downgrade}} for details.
|question=How do I stop pacman from upgrading downgraded packages?
+
|answer=Uncomment {{ic|IgnorePkg}} from {{ic|/etc/pacman.conf}} and add them in sequence. For example:
+
  
{{hc|/etc/pacman.conf|2=
+
{{AUR|agetpkg-git}} quickly lists/gets/installs packages from the [[Arch Linux Archive]].
...
+
IgnorePkg = gimp libtorrent-rasterbar
+
...}}
+
  
This will instruct pacman to ignore any upgrades for selected packages when performing a system update.}}
+
== Return from [testing] ==
  
{{FAQ
+
See [[Official repositories#Disabling testing repositories]].
|question=I want to go back to how my system was yesterday.
+
|answer=It is easy if you have enabled periodic snapshots provided by [[LVM]].}}
+

Latest revision as of 21:15, 25 February 2016

Before downgrading a single or multiple packages, consider why you wish to do so. If it is due to a bug, search the bug tracker for existing tasks. If there is none, add a new task; it is better to correct bugs, or at least warn other users of possible issues.

Warning:
  • Downgrading one package may require that its dependencies be downgraded as well. When the number of packages to downgrade is large, consider using a snapshot. See Arch Linux Archive#How to restore all my packages at a specific date.
  • 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.

Return to an earlier package version

Using the pacman cache

If a package was installed at an earlier stage, and the pacman cache was not cleaned, install an earlier version from /var/cache/pacman/pkg/.

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.

# cd /var/cache/pacman/pkg/
# pacman -U <file_name_of_the_package>

Once the package is reverted, temporarily add it to the IgnorePkg section of pacman.conf, until the difficulty with the updated package is resolved.

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.

Arch Linux Archive

The Arch Linux Archive is a daily snapshot of the official repositories.

The ALA can be used to install a previous package version, or restore the system to an earlier date.

Rebuild the package

If the package is unavailable, find the correct PKGBUILD and rebuild it with makepkg.

For packages from the official repositories, retrieve the PKGBUILD with ABS and change the software version. Alternatively, find the package on the Packages website, click "View Changes", and navigate to the desired version. The files are available through a .tar.gz snapshot, and via the Tree view.

See also Getting PKGBUILDs from SVN#Checkout an older revision of a package.

Old AUR packages can be obtained from aur-mirror. See Arch User Repository#Git repositories for AUR3 packages for details.

vABS - Versioned Arch Build System

vABS is an addition to ABS that has as main goal to keep different versions of the official PKGBUILDs. In ABS you have the latest versions of PKGBUILDs, while in vABS you also have old versions (up to 2 years). Select the desired version and download the build files tgz package or individual files and easily build your package with pkgbuild. More information about the service can be found here.

Automation

downgraderAUR is a tool which works with libalpm, supports the pacman log and downgrading packages using Arch Linux Archive, local cache and ARM.

The downgradeAUR package is a Bash script to downgrade one (or multiple) packages, by using the pacman cache or the Arch Rollback Machine. See man downgrade for details.

agetpkg-gitAUR quickly lists/gets/installs packages from the Arch Linux Archive.

Return from [testing]

See Official repositories#Disabling testing repositories.