Long Term Surprise

2019/02/22

Ubuntu 18.04 has a surprise for you if you use Java

Abstract: Ubuntu 18.04 astonishingly installs Open JDK 10 instead of Open JDK 11 for package openjdk-11-jdk. I explain why and that I think that was bad choice.

Update: This package was finally updated to contain Open JDK 11 on 16th April 2019, so we did get there eventually.

Surprise!

Currently if you’re a Java developer, an Ubuntu user, and prefer Long Term Support (LTS) versions of your operating system, there’s a nasty surprise in store when you try to install Open JDK (open source version of the Java Development Kit) on the current 18.04 LTS version of Ubuntu.

If you want the latest and greatest available Open JDK for the platform you would, typically, apt search for Open JDK, see that the latest version is 11, and install it with something like…

sudo apt install openjdk-11-jdk

…or you might alternatively take a shortcut to…

sudo apt install default-jdk

…which amounts to the same thing because that has openjdk-11-jdk as a dependency.

Unfortunately this doesn’t install Open JDK 11 as you would expect. It installs Open JDK 10 instead!

$ java --version
openjdk 10.0.2 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)

See that 10.0.2 ? You might reasonably enquire: WTF‽

Now how did that happen?

The immediate cause is that the release date for version 18.04 of Ubuntu and the release date for Java 11 were a few months apart. At the target release date for Ubuntu 18.04 the long term supported version of Java would be Java 8, but the latest and greatest would be Java 10 with the long term supported Java 11 just around the corner. Things changed quite a bit in Java between versions 8 and 10 - notably the inclusion of modules (JSR-376) in Java 9. So making some kind of allowance for Java 11 as a preferred platform does seem reasonable.

Now my expectation would have been that Java 10 would be included directly into Ubuntu 18.04 with special provision to include Java 11 as soon as may be, and possibly in the process to change default-jdk to depend upon Java 11. That last change would strike me as risky, but perhaps justifiable in the interests of having a long term supported JDK in the long term supported Ubuntu release.

Did this happen? Nope. Instead something that I find unfathomable happened. It was decided to package Open JDK 10 with a name indicating that it was Open JDK 11, and then replace its contents with Open JDK 11 as soon as they actually became available.

Here’s the announcement that an exception to Ubuntu’s release process had requested been requested for this on 2nd February 2018: https://lists.ubuntu.com/archives/ubuntu-release/2018-February/004275.html

I think that’s very weird and that it profoundly fails the principle of least astonishment. Also, with respect to the plan to replace it as soon as possible, “The best laid schemes o’ mice an’ men gang aft a-gley” as Robert Burns opined.

Ubuntu 18.04 LTS was duly released on 26th April 2018: https://wiki.ubuntu.com/BionicBeaver/ReleaseSchedule

Java 11 reached GA (General Availability - i.e. release) on 25th September 2018: https://openjdk.java.net/projects/jdk/11/

The offical bug to update the version of Open JDK in the misnamed package was raised on 4th October 2018: https://bugs.launchpad.net/ubuntu/+source/openjdk-lts/+bug/1796027

…and that is getting on for six months ago. According to a comment on the bug this is being worked on, but no timescale is given and it’s requested that calls for an ETA not be given in the bug tracker - which would be eminently reasonable if there was any indication of where one should look for updates, timelines, or other visibility into progress. Note that the bug database entry itself doesn’t indicate that it’s assigned to anyone.

Jeremy Bicha (jbicha) wrote on 2018-11-24: #23

Please don’t ask for an ETA. That sends out an email to everyone subscribed to this bug and does not help fix the bug.

This bug is being worked on. openjdk 11.0.1 was updated in 18.10 and there was a security update that needed to be handled quickly in 18.04 LTS. 11.0.1 will come to 18.04 LTS when it’s ready but it is a major change that needs careful coordination.

At the same time the next release of Ubuntu (18.10) which is not a long term support release has Java 11 support with no problems. So it’s hard to see just what the hold up could be - other than compatibility risks created by this peculiar choice of packaging strategy.

Hmmm

Now, I do not pretend to be an expert on Debian/Ubuntu packaging so I would love to hear from an expert on why this seemed like a good idea at the time - and whether it still does. If you’re such an expert drop me a line and I’ll update this post accordingly. But for now it has rattled my confidence in Ubuntu’s approach to packaging.

As we’re now nearly a year on from the release of Ubuntu, and thus nearly half way a quarter of the way to the next LTS release Ubuntu 19.04 in April 2020(Ubuntu 20.04 in April 2022), it’s likely that the change to swap in Java 11 for Java 10 is going to create at least as much astonishment in someone with a dependency (possibly unknowingly) on Java 10 as it did to me when I tried to work out why the version of Java I had installed was not the one I thought I’d issued the commands for. Note: A reddit commenter points out that I had the wrong version for the next LTS version of Ubuntu, weakening the point I make here considerably

It’s also worth noting that some of the logic behind this bizarre choice seems to have been that Java 10, not being a long term support release, shouldn’t be made the default version in the Ubuntu LTS release. However the fix has been so long coming that we’re still in fact using Java 10 as the default, it is now unsupported, and with the confusing package name we’re worse off than if Java 10 has been directly embraced as the default version in the first place. To no obvious benefit.

The lesson, I would say, is avoid making design compromises in the short term if they’ll become progressively harder to unwind in the future if there are any delays. Because there are always delays.

Update

Returning home after a week at The Balboa Experiment I find that the version of Open JDK on my personal laptop is now at the considerably less surprising 11.0.2 - so we’re finally there!

At some point the original bug ticket 1796027 was marked invalid (some issue marking it as a dupe) and ticket 1814133 indicated as the ‘live’ one against which work was being tracked.

I hope that a less surprising approach can be figured out next time this mis-match arises.

Notes and footnotes

The following two threads were most enlightening when I first encountered the issue while upgrading my personal laptop to a shiny new LTS release:

Before creating this write-up I raised this issue in a comment to the following thread where it produced several interesting responses:

Additional comments on a Reddit subtopic where I posted this article: