Arch linux – Error during update of packages: jdk-openjdk and jre-openjdk are in conflict
When I try to update my system I get
jdk-openjdk and jre-openjdk are in conflict error:
This is log of the update attempt:
:: Synchronizing package databases... core is up to date extra is up to date community is up to date multilib is up to date :: Searching AUR for updates... :: Searching databases for updates... -> Packages not in AUR: bunjs-bin flite1-patched jellyfin-server-bin jellyfin-web-bin js78 libgweather libopenaptx libvterm01 nodejs-lts-gallium progsreiserfs python-backcall -> Orphan (unmaintained) AUR Packages: anki-official-binary-bundle jdk-jetbrains jetbrains-clion-pj python-gymnasium-notices python-hijri-converter python-jax-jumpy python-pep517 -> Flagged Out Of Date AUR Packages: anki-official-binary-bundle blades-bin logseq-desktop-wayland-bin marp-cli python-mypy-protobuf steamcmd vrms-arch -> gcc10: local (1:10.3.0-2) is newer than AUR (10.5.0-1) -> gcc10-libs: local (1:10.3.0-2) is newer than AUR (10.5.0-1) :: 8 packages to upgrade/install. 8 extra/jdk-openjdk 21.u35-3 -> 21.u35-7 7 extra/jdk11-openjdk 11.0.21.u9-2 -> 11.0.21.u9-3 6 extra/jre-openjdk 21.u35-3 -> 21.u35-7 5 extra/jre-openjdk-headless 21.u35-3 -> 21.u35-7 4 extra/jre11-openjdk 11.0.21.u9-2 -> 11.0.21.u9-3 3 extra/jre11-openjdk-headless 11.0.21.u9-2 -> 11.0.21.u9-3 2 extra/jre17-openjdk 17.0.9.u8-1 -> 17.0.9.u8-2 1 extra/jre17-openjdk-headless 17.0.9.u8-1 -> 17.0.9.u8-2 ==> Packages to exclude: (eg: "1 2 3", "1-3", "^4" or repo name) -> Excluding packages may cause partial upgrades and break systems ==> Sync Dependency (4): jre11-openjdk-headless-11.0.21.u9-3, jre17-openjdk-headless-17.0.9.u8-2, jre-openjdk-headless-21.u35-7, jre11-openjdk-11.0.21.u9-3 Sync Explicit (4): jre17-openjdk-17.0.9.u8-2, jdk-openjdk-21.u35-7, jdk11-openjdk-11.0.21.u9-3, jre-openjdk-21.u35-7 :: Synchronizing package databases... core is up to date extra is up to date community is up to date multilib is up to date :: Starting full system upgrade... resolving dependencies... looking for conflicting packages... error: unresolvable package conflicts detected error: failed to prepare transaction (conflicting dependencies) :: jdk-openjdk and jre-openjdk are in conflict -> error installing repo packages
What is optimal way to resolve this conflict ?
Thank you for help
sudo pacman -R jre-openjdk but I got this error:
checking dependencies... error: failed to prepare transaction (could not satisfy dependencies) :: removing jre-openjdk breaks dependency 'jre21-openjdk=21.u35-3' required by jdk-openjdk
For this sort of thing, always check out Arch Linux News. In this case, we want Incoming changes in JDK / JRE 21 packages may require manual intervention:
Incoming changes in JDK / JRE 21 packages may require manual intervention
2023-11-02 – Frederik Schwan
We are introducing a change in JDK/JRE packages of our distro. This is triggered from the way a JRE is build in modern versions of Java (>9). We are introducing this change in Java 21.
To sum it up instead of having JDK and JRE packages coexist in the same system we will be making them conflict. The JDK variant package includes the runtime environment to execute Java applications so if one needs compilation and runtime of Java they need only the JDK package in the future. If, on the other hand, they need just runtime of Java then JRE (or jre-headless) will work.
This will (potentially) require a manual user action during upgrade:
If you have both JDK and JRE installed you can manually install the JDK with
pacman -Syu jdk-openjdkand this removes the JRE related packages.
If you have both JRE and JRE-headless you will need to choose one of them and install it manually since they would conflict each other now.
If you only have one of the JDK/JRE/JRE-headless pacman should resolve dependencies normally and no action is needed.
At the moment this is only valid for the upcoming JDK 21 release.
In my particular case, I fixed this yesterday with:
sudo pacman -R jre-openjdk sudo pacman -Suy
But the specifics will depend on what you have installed and what you need as explained in the quoted article.
jdk-openjdk, this will suggest to remove
jre-openjdk as stated in Incoming changes in JDK / JRE 21 packages may require manual intervention.
manually install the JDK … this removes the JRE related packages.
Then do the full upgrade afterwards.
sudo pacman -S jdk-openjdk sudo pacman -Syu