Bug 1056187

Summary: yum update to java-1.7.0-openjdk-1.7.0.60-2.4.4.0 breaks links in /etc/alternatives
Product: [Fedora] Fedora Reporter: Timothy St. Clair <tstclair>
Component: java-1.7.0-openjdkAssignee: jiri vanek <jvanek>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: 20CC: ahughes, christoph, dbhole, dpierce, draco91, fhornain, jerboaa, jones.peter.busi, jvanek, lzachar, mailingdotlist, marianne, mgoldman, misc, omajid, palazzotti, thomas.mey, tstclair, ufospoke
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-12 07:58:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
ls /etc/alternatives none

Description Timothy St. Clair 2014-01-21 16:25:38 UTC
Description of problem:
Pulled a yum update and java no longer worked.  Upon investigation found that the softlinks in /etc/alternatives were not updated.  Causing java to be inoperable. 

Version-Release number of selected component (if applicable):
java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20

How reproducible:
Unknown - yum reinstall fails on my machine.  

Steps to Reproduce:
1. yum update 
2. java -version

Actual results:
bash: java: command not found...

Expected results:
java version "1.7.0_51"
OpenJDK Runtime Environment (fedora-2.4.4.1.fc20-x86_64 u51-b02)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)

Additional info:
$ ls -la java
lrwxrwxrwx. 1 root root 73 Jan 17 08:24 java -> /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64/jre/bin/java

^ Pointing to the old version ?  (no fail on reinstall) 

$ ls -la javac

lrwxrwxrwx. 1 root root 70 Jan 21 10:14 javac -> /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64/bin/javac

Comment 1 Timothy St. Clair 2014-01-21 16:40:21 UTC
related: https://bugzilla.redhat.com/show_bug.cgi?id=1054350

Comment 2 Timothy St. Clair 2014-01-21 17:21:53 UTC
Notes: yum downgrade is almost impossible, it was easier for me to simply update the broken soft-links.  

FWIW not all soft-links we broken, and I updated the following: 

sudo ln -sf /usr/share/man/man1/java-java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64.1.gz 
sudo ln -sf /usr/share/man/man1/java-java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64.1.gz java.1.gz 
sudo ln -sf /usr/share/javadoc/java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20/api javadocdir
sudo ln -sf /usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64 java_sdk_1.7.0_openjdk_exports
sudo ln -sf /usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64 jre_1.7.0_exports
sudo ln -sf  /usr/lib/jvm/jre-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64 jre_1.7.0_openjdk
sudo ln -sf /usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64 jre_1.7.0_openjdk_exports
sudo ln -sf /usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64 jre_exports
sudo ln -sf /usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64 jre_openjdk_exports
sudo ln -sf /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64/jre/bin/keytool .
sudo ln -sf /usr/share/man/man1/keytool-java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64.1.gz keytool.1.gz
sudo ln -sf /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64/jre/bin/orbd
sudo ln -sf /usr/share/man/man1/orbd-java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64.1.gz orbd.1.gz
sudo ln -sf /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64/jre/bin/pack200 .
sudo ln -sf /usr/share/man/man1/pack200-java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64.1.gz pack200.1.gz
sudo ln -sf /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64/jre/bin/rmid .
sudo ln -sf /usr/share/man/man1/rmid-java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64.1.gz rmid.1.gz
sudo ln -sf /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64/jre/bin/rmiregistry .
sudo ln -sf /usr/share/man/man1/rmiregistry-java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64.1.gz rmiregistry.1.gz
sudo ln -sf /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64/jre/bin/servertool
sudo ln -sf /usr/share/man/man1/servertool-java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64.1.gz servertool.1.gz
sudo ln -sf /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64/jre/bin/tnameserv .
sudo ln -sf /usr/share/man/man1/tnameserv-java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64.1.gz tnameserv.1.gz
sudo ln -sf /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64/jre/bin/unpack200 .
sudo ln -sf /usr/share/man/man1/unpack200-java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64.1.gz unpack200.1.gz
sudo ln -sf /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.1.fc20.x86_64/jre/bin/rmiregistry .

Comment 3 Frédéric 2014-01-25 07:54:07 UTC
I have the same issue. Should I apply all this links? I would prefer to you "alternatives" but how to say

Comment 4 Michael Schwendt 2014-01-25 09:45:40 UTC
Somebody at fedoraforum.org has run into it too due to the recent selinux-policy bug, which has broken the package scriptlets.

But even without being affected by that bug, there's something odd in the java-1.7.0-openjdk packaging:

  # rpm -qf /usr/lib/jvm/java-1.7.0-openjdk*
  file /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64 is not owned by any package
  java-1.7.0-openjdk-headless-1.7.0.60-2.4.4.1.fc20.x86_64

  # find /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64
  /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64
  /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64/jre
  /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64/jre/lib
  /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64/jre/lib/amd64
  /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64/jre/lib/amd64/xawt

Are those normal "unowned directories" ( https://fedoraproject.org/wiki/Packaging:UnownedDirectories ) or the result of some bug in a scriptlet?

Comment 5 Thomas Meyer 2014-01-25 14:00:46 UTC
why did java stop working?

Comment 6 Ludovic 2014-01-25 14:44:43 UTC
It looks very much like the same bug, but I'm having a similar issue with the update I've done this morning (to openjdk 1.7.0.60-2.4.4.1, from 1.7.0.60-2.4.4.0).

Similarly to what is suggested in comment #2, I found that doing the following fixed the issue for me:

cd /etc/alternatives
oldversion="java-1.7.0-openjdk-1.7.0.60-2.4.4.0"
newversion="java-1.7.0-openjdk-1.7.0.60-2.4.4.1"
ls -l | sed -n "s/.*[0-9][0-9]:[0-9][0-9] \(.*\) -> \(.*$oldversion.*\)/sudo rm \1 \&\& sudo ln -s \2 \1/p" | sed "s/$oldversion/$newversion/p" | /bin/bash -e

eclipse and azureus are now working fine again.

Hope it helps someone else.

Comment 7 Michael S. 2014-01-27 12:42:49 UTC
The unowned directory are not the result of a bug in the scriptlet, I was not affected by the selinux issue and I see that as well

Comment 8 marianne@tuxette.fr 2014-01-27 13:28:45 UTC
yum reinstall java-1.7.0-openjdk-headless follow by 

alternatives --config java (and choosing the new one as default)

and

alternatives --remove java /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64/jre/bin/java

is solving the issue

Comment 11 Timothy St. Clair 2014-01-27 14:57:08 UTC
I'm almost certain it's a result of SELinux policy update. (https://bugzilla.redhat.com/show_bug.cgi?id=1054350)  

However, post policy update, a reinstall should work, and it does not.

Comment 12 Frédéric 2014-01-27 20:32:38 UTC
> yum reinstall java-1.7.0-openjdk-headless follow by 
> alternatives --config java (and choosing the new one as default)
> alternatives --remove java
> /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64/jre/bin/java
> is solving the issue

thanks a lot; I confirm this works nicely.

Comment 13 Frédéric 2014-02-09 06:50:35 UTC
Created attachment 860929 [details]
ls /etc/alternatives

In fact I still have plenty of links pointing to java-1.7.0-openjdk-1.7.0.60-2.4.4.0 in /etc/alternatives (see attached file). Should I remove them or make them point to another location?

Comment 14 jiri vanek 2014-02-10 07:49:49 UTC
Hm. Odd. Those should be gone with 2.4.4.0 removal.

May you please copy just master links here?
(== output of alternatives --config java)/javac

Comment 15 Frédéric 2014-02-10 18:35:25 UTC
$ LC_ALL=C alternatives --config java

There are 3 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
   1           /usr/java/jdk1.7.0_17/jre/bin/java
   2           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
*+ 3           /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.5.1.fc20.x86_64/jre/bin/java

$ LC_ALL=C alternatives --config javac

There are 2 programs which provide 'javac'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64/bin/javac
   2           /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.5.1.fc20.x86_64/bin/javac

I see, I have to also change javac.

Comment 16 Frédéric 2014-02-10 18:42:24 UTC
So this what I did:
$ alternatives --config javac
then chose /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.5.1.fc20.x86_64/bin/javac
then remove the old one:
$ alternatives --remove javac /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64/bin/javac

But I still have some 2.4.4 links:
java_sdk_1.7.0 -> /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64
java_sdk_1.7.0_exports -> /usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64
java_sdk_1.7.0_openjdk -> /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64
java_sdk_1.7.0_openjdk_exports -> /usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64
java_sdk_openjdk -> /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64
java_sdk_openjdk_exports -> /usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64
jre_1.7.0 -> /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64/jre
jre_1.7.0_exports -> /usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64
jre_1.7.0_openjdk_exports -> /usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64
jre_openjdk -> /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64/jre
jre_openjdk_exports -> /usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc20.x86_64

Comment 17 jiri vanek 2014-02-12 07:48:57 UTC
*** Bug 1057706 has been marked as a duplicate of this bug. ***

Comment 18 jiri vanek 2014-02-12 07:58:17 UTC
Yes there are also this keys:
 alternatives  --config jre_1.7.0
 alternatives  --config jre_openjdk
 alternatives  --config jre_1.7.0_openjdk
 alternatives  --config java_sdk_1.7.0_openjdk
 alternatives  --config java_sdk_openjdk
 alternatives  --config java_sdk_1.7.0

You may try to setup them manually to.

I belive your issue was cause dbe selinux bug during update, which have left original alternatives records. And the new one were not set, because you had alternatives in manual mode. f20 rpms do not force to set alternatives if tey are in manual mode.

Comment 19 Frédéric 2014-02-14 22:19:25 UTC
thanks, it worked and /etc/alternatives is now clean.

Comment 20 jiri vanek 2014-03-05 09:47:27 UTC
*** Bug 1072295 has been marked as a duplicate of this bug. ***