How to downgrade a package via apt-get?

If you have the version number, or the target release, apt-get supports choosing a particular version or target release. More details can be found on manual page of apt-get. It can also be accessed from terminal by typing man apt-get

sudo apt-get install <package-name>=<package-version-number> OR

sudo apt-get -t=<target release> install <package-name>

is the command to be run. This can be used to down-grade a package to a specific version.

Remark that when using a target release (option -t), the release priority must greater than 1000 to allow downgrades (see man 5 apt_preferences) otherwise the currently installed version will be kept.

It has been helpfully pointed out in the comments that

  • apt-cache showpkg <package-name> lists all available versions. (h/t Sparhawk)
  • apt-mark hold <package-name> "holds" the package at the current version, preventing automatic upgrades. (h/t Luís de Sousa )

USE

apt-get install «pkg»=«version»

OR

sudo aptitude install «pkg»=«version»

Where «pkg» is the name of the package, and «version» is the version number.


If you have upgraded software using ppa you can downgrade it by using ppa-purge. First you have to install ppa-purge using this code:

sudo apt-get install ppa-purge

Then you can remove the ppa using command

sudo ppa-purge ppa:user/ppa-name

this will automatically downgrade the software to its original version which shipped with Ubuntu.