Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to downgrade from OpenJDK Update 25 to OpenJDK Update 21.

If I look, for example, at or at, I can see that .deb files for Update 21 are still there, however, when I use apt-cache show or aptitude, I only see Update 25 and Update 3, and if I try:

aptitude -s install openjdk-7-jre-headless=7u21-2.3.9-0ubuntu0.12.04.1

I get:

Unable to find a version "7u21-2.3.9-0ubuntu0.12.04.1" for the package "openjdk-7-jre-headless"

Is there any way I can downgrade using apt tools? If the only option is dpkg, will this package be "visible" for aptitude, for example, when resolving dependencies?

share|improve this question
First check your rdepends. You'll have to blow those out to get the downgrade to work in a stable manner. Then remove the package. Then install the version you want. Then pin it. Then apt-get update. Then re-install known compatible versions that you removed because of rdepends. It's more steps than I want to make a copy paste-able answer for...but those are the steps. – RobotHumans Jul 18 '13 at 15:47
up vote 1 down vote accepted

I tried simplier way than in the comment to the question, and it seems working for me.

I downloaded .deb file for openjdk-7-jre-headless:


Then I tried:

dpkg -i openjdk-7-jre-headless_7u21-2.3.9-0ubuntu0.12.04.1_i386.deb

And got a message telling me about incompatible version of openjdk-7-jre-lib (forgot to copy the message itself, sorry)

I downloaded .deb file for openjdk-7-jre-lib:


Then I tried:

dpkg -i openjdk-7-jre-headless_7u21-2.3.9-0ubuntu0.12.04.1_i386.deb openjdk-7-jre-lib_7u21-2.3.9-0ubuntu0.12.04.1_all.deb

And it seemed to downgrade properly.

share|improve this answer
Thanks, this saved my day. – Gerald Schneider May 30 '14 at 7:29
Follow up: You can prevent future upgrades of the downgraded packages (there is a reason you did the downgrade) by running this command: sudo echo "<packagename> hold" | sudo dpkg --set-selections. – Gerald Schneider May 30 '14 at 7:32
to re-enable upgrades: sudo echo "<packagename> install" | sudo dpkg --set-selections – Gerald Schneider May 30 '14 at 8:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.