4

Is there a way to install a package using apt-get install without update-alternatives being invoked? Or at least being able to specify your own custom priority for the new links added by update-alternatives?

In my scenario I want to install multiple JDK versions. JDK 11 is (while writing this) LTS so I would prefer if all links used that.
However the issue is that apparently the update-alternatives priority for the JDK packages is based on the version:

  • openjdk-11-jdk-headless: 1111
  • openjdk-13-jdk-headless: 1311
  • openjdk-14-jdk-headless: 1411

So if I additionally install JDK 13 or 14 all links would use that as first choice instead.

While I could use update-alternatives --config to change to "manual mode", this seems tedious because it appears this has to be done for every link on its own (JDK 14 adds 33 links) and error-prone in case a new binary is added in a future version, but does not exist in an older one.

  • "this has to be done for every link on its own"; did you take a look at update-java-alternatives? – danzel Feb 22 '20 at 01:35
  • @danzel, no I was not aware that it exists, thanks for pointing that out. Do you want to add that as answer? Though doesn't the problem described in the question also affect other packages, and do they all have their own update-X-alternatives then? – Marcono1234 Feb 23 '20 at 15:11
  • If your question was how to switch between Java versions, it'd be a duplicate of the question I answered here. However, your question is more about preventing apt-get from configuring debian alternatives which I don't know how to do but hopefully someone else does. So even if your original problem is solved, I'd like to leave this question unanswered for people interested in an answer. – danzel Feb 24 '20 at 08:39
  • @danzel, yes that was my question. It would still be interesting to know whether there is a general solution (applying to all packages and not just Java) to this problem. But I guess this question here could be closed as duplicate. – Marcono1234 Feb 29 '20 at 18:18

0 Answers0