Bug 31672

Summary: JDK 18: wrong alternatives
Product: Mageia Reporter: Marc Krämer <mageia>
Component: RPM PackagesAssignee: Java Stack Maintainers <java>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: Normal CC: mageia, nicolas.salguero
Version: Cauldron   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Source RPM: java-latest-openjdk-18.0.0.0.37-1.rolling.2.mga9.src.rpm CVE:
Status comment:

Description Marc Krämer 2023-03-14 11:49:47 CET
After update to cauldron some java apps don't start. The problem is, alternatives seems make the wrong decission upon the installed jre:

alternatives --display jre_openjdk
jre_openjdk - status is auto.
 link currently points to /usr/lib/jvm/java-17-openjdk-17.0.6.0.10-1.mga9.x86_64
/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-1.mga9.x86_64 - family java-17-openjdk.x86_64 priority 17000610
 follower jre_openjdk_exports: (null)
/usr/lib/jvm/java-18-openjdk-18.0.0.0.37-1.rolling.2.mga9.x86_64 - family java-latest-openjdk.x86_64 priority 1
 follower jre_openjdk_exports: (null)
/usr/lib/jvm/java-11-openjdk-11.0.18.0.10-1.mga9.x86_64 - family java-11-openjdk.x86_64 priority 1
 follower jre_openjdk_exports: (null)
Current `best' version is /usr/lib/jvm/java-17-openjdk-17.0.6.0.10-1.mga9.x86_64.

The installed packages are:
rpm -qa |grep jdk
java-17-openjdk-headless-17.0.6.0.10-1.mga9
copy-jdk-configs-4.1-2.mga9
java-latest-openjdk-headless-18.0.0.0.37-1.rolling.2.mga9
java-latest-openjdk-18.0.0.0.37-1.rolling.2.mga9
java-11-openjdk-headless-11.0.18.0.10-1.mga9
java-11-openjdk-11.0.18.0.10-1.mga9


As you can see, jdk-18 is complete, where 11 and 17 only have headless packages. Therefore external applications like netbeans complain
java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-17-openjdk-17.0.6.0.10-1.mga9.x86_64/lib/libawt_xawt.so

and this is because jre does not point to the full install:
ls -la /etc/alternatives/jre*_openjdk
lrwxrwxrwx 1 root root 54 Mar 13 17:26 /etc/alternatives/jre_11_openjdk -> /usr/lib/jvm/jre-11-openjdk-11.0.18.0.10-1.mga9.x86_64/
lrwxrwxrwx 1 root root 53 Mar 13 16:41 /etc/alternatives/jre_17_openjdk -> /usr/lib/jvm/jre-17-openjdk-17.0.6.0.10-1.mga9.x86_64/
lrwxrwxrwx 1 root root 63 Mar 13 16:43 /etc/alternatives/jre_18_openjdk -> /usr/lib/jvm/jre-18-openjdk-18.0.0.0.37-1.rolling.2.mga9.x86_64/
lrwxrwxrwx 1 root root 54 Mar 13 16:41 /etc/alternatives/jre_openjdk -> /usr/lib/jvm/java-17-openjdk-17.0.6.0.10-1.mga9.x86_64/
Comment 1 Marc Krämer 2023-03-14 12:15:31 CET
java was set to version 17 too
Comment 2 Lewis Smith 2023-03-14 21:21:14 CET
Thank you for the report.

> java-11-openjdk-headless-11.0.18.0.10-1.mga9
> java-11-openjdk-11.0.18.0.10-1.mga9
> java-17-openjdk-headless-17.0.6.0.10-1.mga9
> java-latest-openjdk-headless-18.0.0.0.37-1.rolling.2.mga9
> java-latest-openjdk-18.0.0.0.37-1.rolling.2.mga9
>
> As you can see, jdk-18 is complete, where 11 and 17 only have headless packages.
In fact both 11 & 18 are complete, just 17 has only headless. But that is the version sought.
Assigning to Java group, CC'ing NicolasL to be sure.
Perhaps it is 17 that is lacking something.

CC: (none) => mageia
Assignee: bugsquad => java

Comment 3 Marc Krämer 2023-03-14 21:58:14 CET
the priority of java 17 is 17000610 while the others just have "1" as priority.

In my opinion the priority should reflect the version, so it should be 11, 17 and 18.
Comment 4 Marc Krämer 2023-03-14 22:00:02 CET
and the alternative for jre should not be set by headless, as some jre files are missing.
Comment 5 Nicolas Salguero 2023-03-21 10:37:35 CET
Hi,

For me, the main problem is having java-latest-openjdk* in release.

We already maintain three LTS versions (java 8, 11 and 17) and we cannot afford supporting the non LTS version.

Java 17 is the default version for Cauldron and it is complete.

Best regards,

Nico.

CC: (none) => nicolas.salguero

Comment 6 Marc Krämer 2023-03-21 10:54:21 CET
@Nico: java-latest-openjdk works - just set the correct priority for the alternatives creation. 

It would be ok, if you set the priority on alternatives to the version number, as you did with the other releases.
Comment 7 Nicolas Salguero 2023-03-21 11:19:30 CET
The main problem is that non LTS versions of java are supported upstream for a very short period (six months).

Java 18 is already dead: there is no free public update since September 2022.

Java 19 will have no free public update after March 2023, so it can already be considered as dead.

Java 20 will not be supported after September 2023.

As I said in comment 5, java-latest-openjdk can be in Cauldron but it should not be in Mageia 9.
Comment 8 Marc Krämer 2023-03-21 11:26:10 CET
Sorry Nico, this was not clear to me from your comment. That is ok for me - I just test and use cauldron now, to get errors and problems out before final release.

Can you provide a -latest package which will keep track of the latest-LTS java? I don't care for a special java version and just want to keep the latest available release, like we do for e.g. kernel. So I installed the java-latest package. If this is simply an empty package requesting java-17.
Comment 9 Nicolas Salguero 2023-03-21 12:02:14 CET
Sadly, it is not possible: java is not packaged the same way as kernel are.

java-latest is for the latest, non LTS, version of java.  It is there to allow building the next LTS version of java because building a version of java requires at least the immediate previous version, or the same version.

For instance, the next LTS version (java 21), will require java 20 or java 21 to be built, but it is very uncertain that java 21 will be available in Mageia 9 (at least, when Mageia 9 will be out, java 21 will not be released yet), more probably only in Mageia 10.
Comment 10 Marc Krämer 2023-03-21 12:10:34 CET
Ok, sorry for the noise.
I guess it is only possible, if you create a meta-package which just requires the latest release, like it is done by the meta-task-xxx package.

But anyway thanks for your explanations - java really gets strange these days. I was actively using it as a developer until version 6.

Resolution: (none) => INVALID
Status: NEW => RESOLVED