Bug 1056187 - yum update to java-1.7.0-openjdk- breaks links in /etc/alternatives
Summary: yum update to java-1.7.0-openjdk- breaks links in /etc/altern...
Alias: None
Product: Fedora
Classification: Fedora
Component: java-1.7.0-openjdk
Version: 20
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: jiri vanek
QA Contact: Fedora Extras Quality Assurance
: 1057706 1072295 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2014-01-21 16:25 UTC by Timothy St. Clair
Modified: 2014-03-05 09:47 UTC (History)
19 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2014-02-12 07:58:17 UTC
Type: Bug

Attachments (Terms of Use)
ls /etc/alternatives (9.14 KB, text/x-log)
2014-02-09 06:50 UTC, Frédéric
no flags Details

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):

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- 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-

^ 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-

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- 
sudo ln -sf /usr/share/man/man1/java-java-1.7.0-openjdk- java.1.gz 
sudo ln -sf /usr/share/javadoc/java-1.7.0-openjdk- javadocdir
sudo ln -sf /usr/lib/jvm-exports/java-1.7.0-openjdk- java_sdk_1.7.0_openjdk_exports
sudo ln -sf /usr/lib/jvm-exports/java-1.7.0-openjdk- jre_1.7.0_exports
sudo ln -sf  /usr/lib/jvm/jre-1.7.0-openjdk- jre_1.7.0_openjdk
sudo ln -sf /usr/lib/jvm-exports/java-1.7.0-openjdk- jre_1.7.0_openjdk_exports
sudo ln -sf /usr/lib/jvm-exports/java-1.7.0-openjdk- jre_exports
sudo ln -sf /usr/lib/jvm-exports/java-1.7.0-openjdk- jre_openjdk_exports
sudo ln -sf /usr/lib/jvm/java-1.7.0-openjdk- .
sudo ln -sf /usr/share/man/man1/keytool-java-1.7.0-openjdk- keytool.1.gz
sudo ln -sf /usr/lib/jvm/java-1.7.0-openjdk-
sudo ln -sf /usr/share/man/man1/orbd-java-1.7.0-openjdk- orbd.1.gz
sudo ln -sf /usr/lib/jvm/java-1.7.0-openjdk- .
sudo ln -sf /usr/share/man/man1/pack200-java-1.7.0-openjdk- pack200.1.gz
sudo ln -sf /usr/lib/jvm/java-1.7.0-openjdk- .
sudo ln -sf /usr/share/man/man1/rmid-java-1.7.0-openjdk- rmid.1.gz
sudo ln -sf /usr/lib/jvm/java-1.7.0-openjdk- .
sudo ln -sf /usr/share/man/man1/rmiregistry-java-1.7.0-openjdk- rmiregistry.1.gz
sudo ln -sf /usr/lib/jvm/java-1.7.0-openjdk-
sudo ln -sf /usr/share/man/man1/servertool-java-1.7.0-openjdk- servertool.1.gz
sudo ln -sf /usr/lib/jvm/java-1.7.0-openjdk- .
sudo ln -sf /usr/share/man/man1/tnameserv-java-1.7.0-openjdk- tnameserv.1.gz
sudo ln -sf /usr/lib/jvm/java-1.7.0-openjdk- .
sudo ln -sf /usr/share/man/man1/unpack200-java-1.7.0-openjdk- unpack200.1.gz
sudo ln -sf /usr/lib/jvm/java-1.7.0-openjdk- .

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- is not owned by any package

  # find /usr/lib/jvm/java-1.7.0-openjdk-

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, from

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

cd /etc/alternatives
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)


alternatives --remove java /usr/lib/jvm/java-1.7.0-openjdk-

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-
> 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- 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 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-

$ LC_ALL=C alternatives --config javac

There are 2 programs which provide 'javac'.

  Selection    Command
*+ 1           /usr/lib/jvm/java-1.7.0-openjdk-
   2           /usr/lib/jvm/java-1.7.0-openjdk-

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-
then remove the old one:
$ alternatives --remove javac /usr/lib/jvm/java-1.7.0-openjdk-

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

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. ***

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