If you just try to install an older version of a package that you already have installed you most likely will be unable to do so without having to make some tweaks. In this case, normally aptitude will complain with a message that you already have the latest version of the package.

There is a way to get around this problem. To do so, create a file called preferences in /etc/apt. The file should contain 3 lines per each package that you want to revet to an older version. These 3 lines need to specify the package name, the version that you would like to “pin” and the priority. For example, if I wanted to revert the package libbz2-1.0_1.0.5-0.1_i386.deb to libbz2-1.0_1.0.4-2ubuntu4_i386.deb, I would put the following in the preferences file:

Package: libbz2
Pin: version 1.0_1.0.4-2
Pin-Priority: 1001

Note, that the Pin-Priority has to be over 1000 if you are going back to an older version of a package.

After I am done with this, all I have to do is execute sudo apt-get install libbz2 and I will get the older version installed.

Keep in mind that this package version will be “pinned” and no future updates to that package will be picked up by the update manager. For further information on this subject look at the man pages for apt_preferences.

Ubuntu – revert to an older version of a package

13 thoughts on “Ubuntu – revert to an older version of a package

Leave a Reply

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

*