How do I revert to an alternate version of a package on Ubuntu?

I upgraded to an alpha version of a package in a PPA and would now like to revert back to the official version in the Ubuntu universe. What steps do I need to take?

Edit: The question originally read "How do I revert to a previous version of a package on Ubuntu?". I've changed it to more accurately reflect the contents.


Solution 1:

Command-line:

sudo apt-get remove package_name

sudo gedit /etc/apt/sources.list -> comment out the ppa providing the new package

sudo apt-get update

sudo apt-get install package_name

GUI:

  • start Synaptic Package Manager
  • search for your package, click on it and select mark for removal
  • click apply
  • go to Settings > Repositories > Third Party Software and uncheck the PPA providing the new packge
  • Click Close, and then Reload
  • search for the package and reinstall it.

Optionally, you can re-enable the PPA after reverting to the Ubuntu default package

Solution 2:

Christian's solution works fine when you want to get rid of the PPA.

I found another way to do this that leaves the PPA versions available as options for the future.

  1. Use apt-cache showpkg to list the candidate versions available:

    sudo apt-cache showpkg mpd

  2. Explicitly install the version you want, in the format "package=version"

    sudo apt-get install mpd=0.14.2-3ubuntu2

Solution 3:

Use ppa-purge. It disables the PPA and reverts your system back to the official Ubuntu packages.

sudo ppa-purge ppa_name

And you're done !

Installation : sudo apt-get install ppa-purge (or apturl install)
If you're not using Ubuntu 10.10 you may need to install it from a ppa, webup8 for example :

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install ppa-purge

The package is also included in the xorg-edgers repository and I successfully used it after testing the latest Xorg packages.

There is a blog post on Webupd8.