I used dpkg to force install some packages (openjdk) from a different Debian release (Sid) on to my current install (Stretch). It seems to work (can compile a "hello world") but trying to install anything afterwards complains about a libc6 version mismatch.

How can I get the issue ignored?

Alternatively is there another way to get a variety of openjdk versions available to the same base install? I am not willing to use Sid as my base.


You can’t ignore the issue...

There are however a couple of ways to fix it.

  1. You can upgrade to Debian 10: this currently has a version of OpenJDK close to that in unstable, and will soon have exactly the same.

  2. You can install OpenJDK (11) from Stretch backports; this is identical to the version in unstable, but built against Stretch’s packages.

The latter is probably the simpler:

echo deb http://deb.debian.org/debian stretch-backports main | sudo tee /etc/apt/sources.list.d/stretch-backports.list
sudo apt update
sudo apt install -t stretch-backports openjdk-11-jdk

You might still have to deal with some fallout from your libc discrepancies, but the details there depend on exactly what you upgraded along with OpenJDK.

You can have OpenJDK 8 and 11 installed in parallel in this fashion, and use whichever is appropriate by setting JAVA_HOME accordingly. The system-wide default version of Java can be set by running update-java-alternatives.

To install older versions of Java, you can try installing package sets from Debian snapshots; you’ll find OpenJDK 6 and OpenJDK 7. I wouldn’t try versions 9 and 10, because they were never released in a stable distribution; they shouldn’t be needed anyway.

Whatever you do, don’t try installing packages from newer releases of Debian, and don’t use dpkg’s --force options.

  • I need as far back as openjdk-6 . I am creating a vagrant box to serve as a base for have working environments for our offshore developers to have consistent environments while they work on maintenance projects. Some of our old projects require Java 6. Because of JigSaw I cannot just run the latest JDK and configure the source version. – Sled Aug 7 '19 at 16:00
  • Is your question about fixing your dependency problem, or about installing multiple versions of OpenJDK, going back to OpenJDK 6? – Stephen Kitt Aug 7 '19 at 16:06
  • Well it's sort of an XY Problem. I need the same base install with lots of different JDKs (from 6 onwards). I am trying to solve it using DPKG force, but it results in the question at hand. – Sled Aug 7 '19 at 17:28
  • 2
    that's because dpkg's --force* options are not for everyday use. they are "break glass in case of emergency" tools to help with fixing serious problems, by temporarily breaking some part(s) of the system to make it easier to fix the whole system. – cas Aug 8 '19 at 0:18
  • @ArtB OK, I’ve added links for OpenJDK 6 and 7. – Stephen Kitt Aug 8 '19 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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