Bug 2001567 - update of JDK/JRE is removing its manually selected alterantives and select (as auto) system JDK/JRE
Summary: update of JDK/JRE is removing its manually selected alterantives and select (...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: java-openjdk
Version: 34
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
Assignee: jiri vanek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2007270 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-09-06 12:27 UTC by Harald Reindl
Modified: 2022-06-10 23:34 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-03-04 16:43:40 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
possible solution 1 (2.86 KB, application/octet-stream)
2021-11-19 16:10 UTC, jiri vanek
no flags Details
possible solution 2 (1.04 KB, application/octet-stream)
2021-11-26 16:42 UTC, jiri vanek
no flags Details
possible solution 3 (2.88 KB, application/x-xz)
2021-12-02 11:54 UTC, jiri vanek
no flags Details

Description Harald Reindl 2021-09-06 12:27:00 UTC
the java-11-openjdk-headless-1:11.0.12.0.7-0.fc33.x86_64 obviosuly changed my default java version to 11.0 instead leave it at 1.8 - today a 1.8 update, after that my "ZendStudio" which don't work with newer versions (yes i am aware that it's EOL) stopped working

the application was running for weeks and i first thought the new 1.8 build broke it, no it's because you fiddle with alternatives

in a perfect world libre-office won't pull openjdk-11 at all, but it does for no good reason in 99% of usecases

"MESSAGE Resource '/www' does not exist" is a nonsense-error BTW


----------------------------------------

2021-09-03T14:40:14+0200 SUBDEBUG Upgraded: java-11-openjdk-headless-1:11.0.12.0.7-0.fc33.x86_64
2021-09-03T14:40:14+0200 INFO failed to link /usr/lib/jvm-exports/jre-openjdk -> /etc/alternatives/jre_openjdk_exports: Datei oder Verzeichnis nicht gefunden

----------------------------------------

[root@srv-rhsoft:~]$ java -version
openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment 18.9 (build 11.0.12+7)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7, mixed mode, sharing)
[root@srv-rhsoft:~]$ update-alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.12.0.7-4.fc33.x86_64/bin/java)
   2           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.302.b08-2.fc33.x86_64/jre/bin/java)

Enter to keep the current selection[+], or type selection number: 2
[root@srv-rhsoft:~]$ java -version
openjdk version "1.8.0_302"
OpenJDK Runtime Environment (build 1.8.0_302-b08)
OpenJDK 64-Bit Server VM (build 25.302-b08, mixed mode)

----------------------------------------


[harry@srv-rhsoft:/downl[harry@srv-rhsoft:/downloads]$ rpm -qa | grep java | grep 1.8
java-1.8.0-openjdk-headless-1.8.0.302.b08-2.fc33.x86_64
java-1.8.0-openjdk-1.8.0.302.b08-2.fc33.x86_64oads]$ rpm -qa | grep java | grep 1.8
java-1.8.0-openjdk-headless-1.8.0.302.b08-2.fc33.x86_64
java-1.8.0-openjdk-1.8.0.302.b08-2.fc33.x86_64

[harry@srv-rhsoft:/downloads]$ stat /www
  File: /www -> /mnt/data/www
  Size: 13              Blocks: 0          IO Block: 4096   symbolic link
Device: 901h/2305d      Inode: 17          Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2021-09-05 16:45:37.207685848 +0200
Modify: 2011-06-08 14:00:05.908436001 +0200
Change: 2011-06-08 14:00:05.908436001 +0200
 Birth: 2011-06-08 14:00:05.908436001 +0200


!SESSION 2021-05-03 05:25:00.938 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_292
java.vendor=Red Hat, Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=de_DE
Framework arguments:  -showlocation
Command-line arguments:  -os linux -ws gtk -arch x86_64 -showlocation

This is a continuation of log file /home/harry/Zend/workspaces/DefaultWorkspace/.metadata/.bak_0.log
Created Time: 2021-05-03 14:10:20.724

!ENTRY org.eclipse.a.wst.html.webresources.core 4 0 2021-05-03 14:10:20.724
!MESSAGE Resource '/www' does not exist.
!STACK 1
org.eclipse.core.internal.resources.ResourceException: Resource '/www' does not exist.
	at org.eclipse.core.internal.resources.Resource.checkExists(Resource.java:335)
	at org.eclipse.core.internal.resources.Resource.checkAccessible(Resource.java:209)
	at org.eclipse.core.internal.resources.Project.checkAccessible(Project.java:141)
	at org.eclipse.core.internal.resources.Resource.checkAccessibleAndLocal(Resource.java:215)
	at org.eclipse.core.internal.resources.Resource.getPersistentProperty(Resource.java:1151)
	at org.eclipse.wst.html.webresources.core.WebRootFolders.getWebRootFolders(WebRootFolders.java:33)
	at org.eclipse.wst.html.webresources.core.providers.DefaultURIResolver.exists(DefaultURIResolver.java:36)
	at org.eclipse.wst.html.webresources.core.providers.WebResourcesProvidersManager.exists(WebResourcesProvidersManager.java:145)
	at org.eclipse.wst.html.webresources.internal.core.providers.WebResourcesProviderType.exists(WebResourcesProviderType.java:144)
	at org.eclipse.wst.html.webresources.core.providers.WebResourcesProvidersManager.exists(WebResourcesProvidersManager.java:48)
	at org.eclipse.wst.html.webresources.core.validation.WebResourcesValidator.validateFile(WebResourcesValidator.java:506)
	at org.eclipse.wst.html.webresources.core.validation.WebResourcesValidator.validateImage(WebResourcesValidator.java:468)
	at org.eclipse.wst.html.webresources.core.validation.WebResourcesValidator.validate(WebResourcesValidator.java:381)
	at org.eclipse.wst.html.webresources.core.validation.WebResourcesValidator.validateRegions(WebResourcesValidator.java:347)
	at org.eclipse.wst.html.webresources.ui.validation.WebResourcesSourceValidator.validate(WebResourcesSourceValidator.java:87)
	at org.eclipse.wst.sse.ui.internal.reconcile.validator.ReconcileStepForValidator.validate(ReconcileStepForValidator.java:331)
	at org.eclipse.wst.sse.ui.internal.reconcile.validator.ReconcileStepForValidator.reconcileModel(ReconcileStepForValidator.java:205)
	at org.eclipse.jface.text.reconciler.AbstractReconcileStep.reconcile(AbstractReconcileStep.java:89)
	at org.eclipse.wst.sse.ui.internal.reconcile.validator.ValidatorStrategy.reconcile(ValidatorStrategy.java:269)
	at org.eclipse.wst.sse.ui.internal.reconcile.DocumentRegionProcessor.process(DocumentRegionProcessor.java:321)
	at org.eclipse.wst.sse.ui.internal.reconcile.StructuredRegionProcessor.process(StructuredRegionProcessor.java:258)
	at org.eclipse.wst.sse.ui.internal.reconcile.DirtyRegionProcessor$BackgroundThread.run(DirtyRegionProcessor.java:691)
!SUBENTRY 1 org.eclipse.core.resources 4 368 2021-05-03 14:10:20.725
!MESSAGE Resource '/www' does not exist.

Comment 1 Harald Reindl 2021-11-04 19:00:02 UTC Comment hidden (abuse)
Comment 2 Harald Reindl 2021-11-11 12:17:08 UTC Comment hidden (abuse)
Comment 3 jiri vanek 2021-11-18 15:00:53 UTC
Hi. Thanx for report.

This is very unexpected but obvious consequence of https://src.fedoraproject.org/rpms/java-latest-openjdk/c/e16ee29c24b7c3fd46e4b2dec01a57bb13b99c18?branch=rawhide (alternatives creation moved to posttrans)
Before this commit, there existed two alternatives in same family, and then when the older one was removed, the link remained in family. Now, the removal happens first, and thus the family is gone, and alternatives fall-back to "recomended" and reset to auto.

The workaround have to be added, that in posun, the family and auto/manual is stored, and after install, if the family matches isnstalled JDK, and was manual mode (to allow system jdk bump) it gets sllected again. Hopefully that will also restore manual.

thoughts?

Comment 4 jiri vanek 2021-11-19 16:10:59 UTC
Created attachment 1842748 [details]
possible solution 1

three testing packages included.
if update, then in postun it saves manual, own, selected masters
in posttrans, if above saved, the link is set

The postrans can not be moved to function same as postun, because of --slave enumeration.

hints welcomed. More testing ahead.

Comment 5 jiri vanek 2021-11-21 10:36:10 UTC
*** Bug 2007270 has been marked as a duplicate of this bug. ***

Comment 6 Harald Reindl 2021-11-22 06:20:21 UTC
what about not touching it at all in case of update versus new install when the alternatives links are there?

Comment 7 jiri vanek 2021-11-22 08:24:48 UTC
(In reply to Harald Reindl from comment #6)
> what about not touching it at all in case of update versus new install when
> the alternatives links are there?

It would be awesome, but how would you do that? The links points to NVRA directory.  So unluckily the old have to be removed, and the new created.

Comment 8 Harald Reindl 2021-11-22 08:39:49 UTC
i forgot the java version mess where i recently deleted a dozens of old and orphaned version folders below /usr/lib/jvm/

Comment 9 jiri vanek 2021-11-22 15:17:36 UTC
(In reply to Harald Reindl from comment #8)
> i forgot the java version mess where i recently deleted a dozens of old and
> orphaned version folders below /usr/lib/jvm/

That should no longer be truth. If you hit it again, please drop the bug.

Comment 10 jiri vanek 2021-11-23 13:03:08 UTC
btw, 1.8 is not eol. RH maintains it, and is as secure and as maintained as 11 an 17. including focus on jdk8 compatibility.

Comment 11 Harald Reindl 2021-11-23 13:06:04 UTC
i talked about ZendStudio in context of EOL

Comment 12 jiri vanek 2021-11-26 16:42:02 UTC
Created attachment 1843717 [details]
possible solution 2

A bit improved version.
I made quite a few testing, and will now port it to the jdks.

Comment 13 jiri vanek 2021-12-02 11:54:34 UTC
Created attachment 1844459 [details]
possible solution 3

Minor improvement.  Jdk have two groups of families So made it parameter.
Am it now emebdeing in jdk latest.

Comment 14 Harald Reindl 2022-02-22 14:39:23 UTC
which one is supposed to fix that issue?
these two packages updated a few days ago changed the default again to 11

java-1.8.0-openjdk-headless-1.8.0.322.b06-2.fc34.x86_64
java-1.8.0-openjdk-1.8.0.322.b06-2.fc34.x86_64

shouldn't we close bugreports when it's really fixced and confirmed?

Comment 15 jiri vanek 2022-03-01 09:05:31 UTC
Hi! My rush action. I fall sick jsut before I backported to 8. And the changeset  had to be backport to all jdks in fedora. I will do update fo 8 today

Comment 16 Fedora Update System 2022-03-01 12:44:49 UTC
FEDORA-2022-cc11e95290 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2022-cc11e95290

Comment 17 Fedora Update System 2022-03-01 12:45:24 UTC
FEDORA-2022-ef6f35c74d has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2022-ef6f35c74d

Comment 18 Fedora Update System 2022-03-01 12:45:45 UTC
FEDORA-2022-54b06abc5d has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-54b06abc5d

Comment 19 Fedora Update System 2022-03-01 14:25:56 UTC
FEDORA-2022-809b238f89 has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2022-809b238f89

Comment 20 Fedora Update System 2022-03-01 14:26:19 UTC
FEDORA-2022-06f4afbe06 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2022-06f4afbe06

Comment 21 Fedora Update System 2022-03-01 16:32:13 UTC
FEDORA-2022-54b06abc5d has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-54b06abc5d`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-54b06abc5d

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 22 Fedora Update System 2022-03-01 18:27:14 UTC
FEDORA-2022-ef6f35c74d has been pushed to the Fedora 35 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-ef6f35c74d`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-ef6f35c74d

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 23 Fedora Update System 2022-03-01 18:28:00 UTC
FEDORA-2022-809b238f89 has been pushed to the Fedora 35 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-809b238f89`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-809b238f89

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 24 Fedora Update System 2022-03-01 19:36:45 UTC
FEDORA-2022-cc11e95290 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-cc11e95290`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-cc11e95290

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 25 Fedora Update System 2022-03-01 19:36:50 UTC
FEDORA-2022-06f4afbe06 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-06f4afbe06`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-06f4afbe06

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 26 Fedora Update System 2022-03-04 16:43:40 UTC
FEDORA-2022-809b238f89 has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 27 Fedora Update System 2022-03-08 21:22:39 UTC
FEDORA-2022-ef6f35c74d has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 28 Fedora Update System 2022-03-08 21:32:42 UTC
FEDORA-2022-cc11e95290 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 29 Fedora Update System 2022-03-14 22:25:31 UTC
FEDORA-2022-06f4afbe06 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 30 Fedora Update System 2022-03-26 15:05:27 UTC
FEDORA-2022-54b06abc5d has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 31 Paul Donohue 2022-06-10 23:23:42 UTC
I just ran into this on RHEL8.  For reference, for others who run into this and manage to find this bug, you can avoid losing the alternatives during the upgrade by running the following shell script fragment before the upgrade:
ALTS="$(LANG=en_US.UTF-8 alternatives --list)"
for VER in 8 11 ; do
  for NAME in \
   java jre_openjdk "jre_${VER}" "jre_${VER}_openjdk" \
   javac java_sdk_openjdk "java_sdk_$VER" "java_sdk_${VER}_openjdk"
  do
    if ALT="$(echo "$ALTS" | grep "^$NAME[[:space:]]\+manual[[:space:]].*java-$VER-openjdk")" ; then
      ARCH="$(echo "$ALT" | perl -n -e 'print $1 if m!java-'"$VER"'-openjdk[^/]*\.([^/]+)/!')"
      touch "/var/lib/rpm-state/${NAME}_java-$VER-openjdk.$ARCH"
    fi
  done
  for NAME in javadocdir javadoczip ; do
    if ALT="$(echo "$ALTS" | grep "^$NAME[[:space:]]\+manual[[:space:]].*java-$VER-openjdk")" ; then
      touch "/var/lib/rpm-state/${NAME}_java-$VER-openjdk"
    fi
  done
done

Unfortunately, if you do not run the above before the upgrade then your alternatives will be lost and you will need to manually reconfigure them after the upgrade.

Comment 32 Paul Donohue 2022-06-10 23:34:54 UTC
For jiri vanek:
While looking into this issue and developing the above shell script fragment, I noticed that the save_alternatives script fragment in the spec file does not check the arch of the current alternative before saving the state file, although the set_if_needed_alternatives script fragment does check the arch (indirectly via $FAMILY) when reading the state file.

I know that RHEL8 does not currently support multiarch Java so this is currently irrelevant.  However, if support for multiarch Java is brought back at some point, then this spec file will not properly preserve the correct arch on the java alternatives.  For example, if the alternative is currently using the i686 arch, and java is upgraded, and the %posttrans for the x86_64 version of java runs after the %posttrans for the i686 version of java, then the alternative will be switched from i686 to x86_64.

You might want to adjust save_alternatives() to also grep for the relevant arch in the alternatives config before writing the state file, to ensure that the correct arch is preserved if multiarch Java is installed.


Note You need to log in before you can comment on or make changes to this bug.