Downgrade Package in Ubuntu and Debian

Sometimes you may need to downgrade a package, because you have some problems with the like the last version of the package. On Ubuntu, Debian, Linux Mint, Knoppix or other dpkg Linux distro, this is how you should do it:

Method 1:

The step 0 is to find out the exact version of the package you want to install.

Next, you can use the command line package managers (apt or aptitude), like this:

$ sudo apt-get install package=version
OR:
$ sudo aptitude install package=version

Example:

$ sudo apt-get install ruby1.8=1.8.4-5ubuntu1.2

$ sudo aptitude install ruby1.8=1.8.4-5ubuntu1.2

Method 2:

If you can find the prefered version of the *.deb package on the internet, you can remove your package with apt-get remove or aptitude remove and install the prefered *.deb with dpkg.

Like this:

Remove the package, with one of the methods:

$ sudo apt-get remove package
OR:
$ sudo aptitude remove package

Install the new *.deb package:

$ sudo dpkg -i /path/to/*.deb

After you have installed the prefered version of the package (by using method 1 or method 2), do this to stop your system update your package, as root:

# echo “packagename hold” | dpkg --set-selections

Example: # echo “ruby1.8 hold” | dpkg --set-selections

Note: there are two minus characters (-) before set-selections.

Liked it? Take a second to support Geekster on Patreon!
Tagged with: , , , , , , ,
Posted in The Linux and Unix Articles!
2 comments on “Downgrade Package in Ubuntu and Debian
  1. Lemming says:

    When I do something like
    $ sudo apt-get install ruby1.8=1.8.4-5ubuntu1.2
    apt-get tells me, that the requested version is not available.
    Is there an archive for old package versions?
    Something that I can add to /etc/apt/sources.list?
    I have to revert an automated updated, that is, I have a long list of packages that I need to downgrade.

Leave a Reply to Geekster Cancel reply

Your email address will not be published. Required fields are marked *

*

Support LinuxG via Patreon
Support LinuxG.net on Patreon!
Subscribe

  

Subscribe to get the latest Linux news and how to guides directly on your e-mail!