Fedora 36 - Recent Java update conflicts with Java 17

I’m having a problem updating my Fedora 36. I need Java 17 installed for compatibility reasons, and I haven’t had any issue with this until now. The error I receive is:

Error: Transaction test error:
  file /usr/lib/.build-id/a8/5d273e920106a68e86541b187062d7dbef328a conflicts between attempted installs of java-latest-openjdk-headless-1:20.0.1.0.9-3.rolling.fc36.x86_64 and java-17-openjdk-headless-1:17.0.7.0.7-1.fc36.x86_64

I never had any issue with these two packages co-existing at the same time before. Why is this a problem now?

1 Like

You do realize I hope that F36 is now EOL.

  1. what repos are those coming from?
  2. I just tried installing the F36 versions for myself and got no conflicts.

It seems possible there might have been a glitch in the mirror sync that triggered the error. For both F37 and F38 those packages both install nicely with no conflicts., and the F36 versions I can access also have no conflicts.

I’m pulling from whatever the default repositories are. The only additional repositories I have are for ZFS.

Here is a log of trying to update first (all packages are up to date) and then trying to install Java 17:

[fedora@localhost ~]$ sudo yum update -y
[sudo] password for fedora:
Last metadata expiration check: 1:23:01 ago on Sat 20 May 2023 09:00:58 PM EDT.
Dependencies resolved.
Nothing to do.
Complete!
[fedora@localhost ~]$ sudo yum install java-17-openjdk
Last metadata expiration check: 1:23:20 ago on Sat 20 May 2023 09:00:58 PM EDT.
Dependencies resolved.
========================================================================================================================
 Package                               Architecture        Version                           Repository            Size
========================================================================================================================
Installing:
 java-17-openjdk                       x86_64              1:17.0.7.0.7-1.fc36               updates              428 k
Installing dependencies:
 java-17-openjdk-headless              x86_64              1:17.0.7.0.7-1.fc36               updates               42 M

Transaction Summary
========================================================================================================================
Install  2 Packages

Total size: 42 M
Installed size: 208 M
Is this ok [y/N]: y
Downloading Packages:
[SKIPPED] java-17-openjdk-17.0.7.0.7-1.fc36.x86_64.rpm: Already downloaded
[SKIPPED] java-17-openjdk-headless-17.0.7.0.7-1.fc36.x86_64.rpm: Already downloaded
Running transaction check
Transaction check succeeded.
Running transaction test
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'yum clean packages'.
Error: Transaction test error:
  file /usr/lib/.build-id/a8/5d273e920106a68e86541b187062d7dbef328a from install of java-17-openjdk-headless-1:17.0.7.0.7-1.fc36.x86_64 conflicts with file from package java-latest-openjdk-headless-1:20.0.1.0.9-3.rolling.fc36.x86_64

Ok, I see the error in that output.
Please, in the future post the text into your post since pastebin only keeps the data for a default 24 hour period and it will be gone tomorrow unless actually part of your post.

It is complaining about the java-latest-openjdk-headless package which conflicts.
Have you tried adding the options --best --allowerasing to your command line to see if an option is suggested by dnf. That looks like it is actually the same package with a different build number as is used for all the recent versions of fedora.

I just did this

# dnf install java-17-openjdk-headless java-latest-openjdk-headless --releasever 36 --best --allowerasing
Last metadata expiration check: 0:42:46 ago on Sat 20 May 2023 09:12:05 PM CDT.
Package java-17-openjdk-headless-1:17.0.7.0.7-5.fc38.x86_64 is already installed.
Dependencies resolved.
====================================================================================================================================
 Package                                   Architecture        Version                                   Repository            Size
====================================================================================================================================
Installing:
 java-latest-openjdk-headless              x86_64              1:20.0.1.0.9-3.rolling.fc36               updates               44 M

Transaction Summary
====================================================================================================================================
Install  1 Package

Total download size: 44 M
Installed size: 220 M
Is this ok [y/N]: y
Downloading Packages:
java-latest-openjdk-headless-20.0.1.0.9-3.rolling.fc36.x86_64.rpm                                   3.6 MB/s |  44 MB     00:12    
------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                               3.6 MB/s |  44 MB     00:12     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Running scriptlet: java-latest-openjdk-headless-1:20.0.1.0.9-3.rolling.fc36.x86_64                                            1/1 
  Preparing        :                                                                                                            1/1 
  Installing       : java-latest-openjdk-headless-1:20.0.1.0.9-3.rolling.fc36.x86_64                                            1/1 
  Running scriptlet: java-latest-openjdk-headless-1:20.0.1.0.9-3.rolling.fc36.x86_64                                            1/1 
  Verifying        : java-latest-openjdk-headless-1:20.0.1.0.9-3.rolling.fc36.x86_64                                            1/1 

Installed:
  java-latest-openjdk-headless-1:20.0.1.0.9-3.rolling.fc36.x86_64                                                                   

Complete!

I suspect that using those 2 options will solve the problem.

Thank you for the suggestion. I tried this option without success.

I also updated my previous post to remove the pastebin.

$sudo dnf install java-17-openjdk-headless java-latest-openjdk-headless --releasever 36 --best --allowerasing
[sudo] password for fedora:
Last metadata expiration check: 2:53:03 ago on Sat 20 May 2023 09:00:58 PM EDT.
Package java-latest-openjdk-headless-1:20.0.1.0.9-3.rolling.fc36.x86_64 is already installed.
Dependencies resolved.
========================================================================================================================
 Package                               Architecture        Version                           Repository            Size
========================================================================================================================
Installing:
 java-17-openjdk-headless              x86_64              1:17.0.7.0.7-1.fc36               updates               42 M

Transaction Summary
========================================================================================================================
Install  1 Package

Total size: 42 M
Installed size: 206 M
Is this ok [y/N]: y
Downloading Packages:
[SKIPPED] java-17-openjdk-headless-17.0.7.0.7-1.fc36.x86_64.rpm: Already downloaded
Running transaction check
Transaction check succeeded.
Running transaction test
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: Transaction test error:
  file /usr/lib/.build-id/a8/5d273e920106a68e86541b187062d7dbef328a from install of java-17-openjdk-headless-1:17.0.7.0.7-1.fc36.x86_64 conflicts with file from package java-latest-openjdk-headless-1:20.0.1.0.9-3.rolling.fc36.x86_64

Reported here: 2203320 – When I try to update java-17 packages, I get a file conflict with java-20

It’s fixed in java-17-openjdk-17.0.7.0.7-5 (note the -5; the version you are installing is -1). But since F36 is EOL, the last update did not make it to stable repos. You can manually install it from koji like this:

sudo dnf in https://kojipkgs.fedoraproject.org//packages/java-17-openjdk/17.0.7.0.7/5.fc36/x86_64/java-17-openjdk{,-headless}-17.0.7.0.7-5.fc36.x86_64.rpm https://kojipkgs.fedoraproject.org//packages/java-latest-openjdk/20.0.1.0.9/8.rolling.fc36/x86_64/java-latest-openjdk{,-headless}-20.0.1.0.9-8.rolling.fc36.x86_64.rpm

But you really should upgrade to a currently supported Fedora release. F37 will be supported for ~6 more months while F38 will be supported for ~1 year.

Explanation

There’s a conflict in a specific file mentioned. These build IDs are supposed to be unique to identify the exact builds of files. Somehow, both the Java 20 and Java 17 packages have identical versions of a file libjsvml.so, which produced the same build ID:

$ rpm -qplv java-{17,latest}-openjdk-headless-*.rpm | grep 5d273e920106a68e86541b187062d7dbef328a
lrwxrwxrwx    1 root     root                       80 Apr 29 00:40 /usr/lib/.build-id/a8/5d273e920106a68e86541b187062d7dbef328a -> ../../../../usr/lib/jvm/java-17-openjdk-17.0.7.0.7-1.fc36.x86_64/lib/libjsvml.so
lrwxrwxrwx    1 root     root                       88 Apr 28 23:33 /usr/lib/.build-id/a8/5d273e920106a68e86541b187062d7dbef328a -> ../../../../usr/lib/jvm/java-20-openjdk-20.0.1.0.9-3.rolling.fc36.x86_64/lib/libjsvml.so

Since the file /usr/lib/.build-id/a8/5d273e920106a68e86541b187062d7dbef328a has the same name, but different “contents” (in this case the file is a symlink to a different target), dnf won’t allow the transaction (otherwise the package installed earlier would have a file overwritten by the package installed later).

java-latest* tracks the latest Java version (which is Java 20 on F36+), while java-17* is Java 17. They are not merely the “same package with a different build number”.

2 Likes

The suggested fix using dnf to directly install the newer Java packages from kojipkgs.fedoraproject.org triggers the same error for me and also blocks upgrading to Fedora 37 since you can’t complete a “sudo dnf upgrade --refresh” run.

Uninstalling java-latest-openjdk-headless and then running dnf upgrade adds it back without the error. Hopefully that will be good enough to avoid a failure during the upgrade process to Fedora 37 or 38.

Your error sounds like there may have been a version mismatch and the fix you used by uninstalling the latest package then running the upgrade reinstalled it without the version problem.

:+1:

Sorry, I missed out on the headless packages in the command to install from koji. I’ve corrected it now.

Even then, it’s not possible for the previous command to produce the same error as the original issue (file conflict in /usr/lib/.build-id/...). The files are definitely different. It might’ve failed with a different error (nothing provides …headless).