Bug 22981 - Latest java-devel breaks /etc/alternatives - java unusable
Summary: Latest java-devel breaks /etc/alternatives - java unusable
Status: RESOLVED INVALID
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal major
Target Milestone: ---
Assignee: Java Stack Maintainers
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-02 21:23 CEST by Frank Griffin
Modified: 2018-05-04 18:08 CEST (History)
3 users (show)

See Also:
Source RPM: java-1.8.0-openjdk-1.8.0.171-1.b10.1.mga7
CVE:
Status comment:


Attachments

Description Frank Griffin 2018-05-02 21:23:28 CEST
With the latest updates today, the java links for /etc/alternatives are broken:

[ftg@ftgme2 ~]$ java -version
-bash: java: command not found
[ftg@ftgme2 ~]$ 

Attempting to reinstall java-openjdk with --replacepkgs works fine, but doing the same for java-openjdk-devel gives:

[root@ftgme2 ~]# urpmi --replacepkgs java-1.8.0-openjdk-devel


installing java-1.8.0-openjdk-devel-1.8.0.171-1.b10.1.mga7.x86_64.rpm from /mnt/cauldron/x86_64/media/core/release
Preparing...                     ###################################################
      1/1: java-1.8.0-openjdk-devel
                                 ###################################################
admindir /var/lib/alternatives invalid
admindir /var/lib/alternatives invalid
admindir /var/lib/alternatives invalid
admindir /var/lib/alternatives invalid
[root@ftgme2 ~]# 

and this is apparently what breaks the links.  

Until this is fixed, nothing using the MGA JVM will work.
Comment 1 Marja Van Waes 2018-05-03 07:15:29 CEST
If java-1.8.0-openjdk-1.8.0.171-1.b10.1.mga7.src.rpm is the culprit: the same version is in Mageia 6 and 5 updates_testing

Source RPM: java-devel => java-1.8.0-openjdk-1.8.0.171-1.b10.1.mga7
Assignee: bugsquad => java
CC: (none) => luigiwalser, marja11, nicolas.salguero

Comment 2 David Walser 2018-05-03 07:40:08 CEST
Not sure why it took until yesterday for Frank to hit it though, as it's been built longer than that.  copy-jdk-configs was pushed yesterday, so maybe it triggered a problem.
Comment 3 Frank Griffin 2018-05-03 13:46:46 CEST
This relates to a unique situation for Java in MGA.  For most (if not all) other languages, the "devel" package contains headers and such needed for actual development.  

Java has a JRE (Java Runtime Environment) which is basically the JVM used to run Java bytecode programs.  But it also has a JDK (Java Development Kit) which includes not only headers but an assortment of other tool executables (javac, jar, etc.) as well as other stuff (for years the codepage support for EBCDIC was only in the JDK).  Sun, for some reason, kept the JRE and JDK separate and had different rules for freely distributing them.

Problem is, the JDK moves all of the executables to a different part of the Java directory structure (java/bin as opposed to java/jre/bin).  The situation here is that because the java-devel alternatives failed we have JDK executable placement with JRE alternatives, and they don't match.

So only those with java-devel installed will see this problem.  Of course, that includes anyone who even wants to compile a Java app, which is why I opened bug#15799 .
Comment 4 David Walser 2018-05-03 14:55:22 CEST
The problem is, there's nothing unique to Mageia.  The package comes from Fedora.  If an issue affects us, it would affect them too.  If you can confirm the issue in, say, Fedora 26, and report it to them, then it might get fixed.
Comment 5 Frank Griffin 2018-05-03 16:33:46 CEST
I'm not so sure.  The same type of breakage has occurred previously in Fedora but with slightly different symptoms:

https://forums.fedoraforum.org/showthread.php?302640-Yum-Update-and-Java-is-Dead-Again-*sigh*

In their case, "alternatives --config java" works correctly but shows that the devel package isn't installed.  But here:

[root@ftgme2 ~]# alternatives --config java
admindir /var/lib/alternatives invalid
[root@ftgme2 ~]# 

This looks to me like a local bug in relocating alternatives from /etc to /var. 

Googling "F
Comment 6 Frank Griffin 2018-05-03 16:35:14 CEST
Googling "Fedora 26 java devel" doesn't get any hits, and this would definitely be noticed immediately.
Comment 7 Frank Griffin 2018-05-03 17:05:53 CEST
Further, on a current cauldron system updated a few days earlier than the system with the problem:

[root@jaglap ~]# alternatives --config java

There is 1 program that provides 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-1.b10.1.mga7.x86_64/jre/bin/java)

Enter to keep the current selection[+], or type selection number: 

[root@jaglap ~]# urpmi java-devel
Package java-1.8.0-openjdk-devel-1.8.0.171-1.b10.1.mga7.x86_64 is already installed
[root@jaglap ~]#
Comment 8 David Walser 2018-05-03 19:04:14 CEST
Our java-1.8.0-openjdk, copy-jdk-configs, and chkconfig (which provides update-alternatives) are all synced with Fedora.
Comment 9 Frank Griffin 2018-05-04 00:00:58 CEST
Well, here's the problem.

In /var/lib/, alternatives is a symlink to rpm/alternatives.  On the working system, rpm/alternatives exists and is heavily populated (including java stuff).  On the failing system, rpm exists but rpm/alternatives does not.  The implication is that something during urpmi processing removed this directory and didn't recreate it, which is going to affect a lot more than java. 

Whether this stays a java issue or gets promoted to urpmi (or rpm itself) depends on whether the deletion of the directory was part of the java packages or something urpmi/rpm did as part of some other activity that involves alternatives.

Failing system:
[root@ftgme2 ~]# cd /var/lib
[root@ftgme2 lib]# ls -l alternatives
lrwxrwxrwx 1 root root 16 Oct 14  2017 alternatives -> rpm/alternatives ***broken link***
[root@ftgme2 lib]# ls -l
total 348
drwxr-xr-x  4 root     root     4096 Jan 18 12:29 AccountsService/
drwxr-xr-x  2 root     root     4096 May  2 15:02 alsa/
lrwxrwxrwx  1 root     root       16 Oct 14  2017 alternatives -> rpm/alternatives ***broken link***
drwxr-xr-x  3 root     root     4096 Apr  9 18:22 bluetooth/
drwxr-xr-x  3 root     root     4096 Aug  2  2017 color/
drwxr-xr-x  4 colord   colord   4096 Oct 28  2017 colord/
drwxr-xr-x  2 apache   apache   4096 Mar 27 03:59 dav/
drwxr-xr-x  2 root     root     4096 Apr 16 18:59 dbus/
drwxr-xr-x  2 derby    derby    4096 Oct  4  2017 derby/
drwxr-xr-x  2 root     root     4096 Mar 15 20:08 dhclient/
drwxr-xr-x  4 root     root     4096 Aug  2  2017 dkms/
drwxr-xr-x  4 root     root     4096 Aug  2  2017 dkms-binary/
drwxr-xr-x  2 root     root     4096 Aug  2  2017 dnf/
drwxr-xr-x  3 root     root     4096 Jan  9 14:12 dracut/
drwx------  2 root     root     4096 May  2 14:56 ebtables/
drwxr-xr-x  2 root     root     4096 Apr 13 11:31 flash-player-plugin/
drwxr-xr-x  3 root     root     4096 Feb 11 20:25 flatpak/
drwxr-xr-x  2 root     root     4096 Jan  6 00:36 fprint/
drwxr-xr-x  3 root     root     4096 Aug  2  2017 games/
drwxrwx--T  3 gdm      gdm      4096 Mar 13 10:10 gdm/
drwxr-xr-x  3 root     root     4096 May  1 03:31 gnome/
drwxr-xr-x  4 root     root     4096 May  2 14:55 gssproxy/
drwxr-xr-x  2 hdfs     hadoop   4096 Oct  7  2017 hadoop-hdfs/
drwxr-xr-x  3 root     root     4096 Apr 16 18:21 hardware/
drwxr-xr-x  2 root     root     4096 May  2 10:13 hp/
drwxr-xr-x  4 root     root     4096 Feb 15 09:59 hsqldb/
drwxr-xr-x  3 root     root     4096 Aug 15  2017 jetty/
drwxr-xr-x  3 root     root     4096 Feb 24 11:34 krb5/
drwxr-x---  3 ldap     ldap     4096 Apr  6 08:28 ldap/
drwxr-xr-x 13 root     root     4096 May  2 14:52 libvirt/
drwx------  2 lightdm  lightdm  4096 Mar 24 07:22 lightdm/
drwx------  2 lightdm  lightdm  4096 Mar 24 07:22 lightdm-data/
drwxr-xr-x  3 root     root     4096 Aug  2  2017 lock/
-rw-r--r--  1 root     root     3802 May  3 04:43 logrotate.status
drwx------  2 root     root     4096 Aug  2  2017 machines/
drwxr-xr-x  4 root     root     4096 Aug  2  2017 mageia/
drwxr-xr-x  3 root     root     4096 Mar 19 04:50 mate/
drwxr-xr-x  3 root     root     4096 Aug  2  2017 menu/
drwxr-xr-x  2 root     root     4096 Feb 11  2016 misc/
drwxr-x---  2 root     mlocate  4096 May  3 00:00 mlocate/
drwxr-x---  2 lp       sys      4096 Feb  8  2016 mtink/
drwxr-xr-x  5 mysql    mysql    4096 Apr  2 03:29 mysql/
drwx------  3 root     root     4096 Aug  8  2017 net-snmp/
drwxr-xr-x  2 root     root     4096 May  3 17:10 NetworkManager/
drwxr-xr-x  6 root     root     4096 May  2 15:25 nfs/
drwxr-xr-x  2 ntp      ntp      4096 May  2 15:55 ntp/
drwxr-xr-x  2 root     root     4096 Oct  1  2017 openvpn/
drwxr-xr-x  2 root     root     4096 May  2 14:07 os-prober/
drwxr-xr-x  2 root     root     4096 Aug  2  2017 PackageKit/
drwxr-xr-x  7 root     root     4096 Aug  2  2017 partimage/
drwxr-xr-x  2 root     root     4096 Mar  5 09:21 pear/
drwx------  4 postgres postgres 4096 Feb 15 09:59 pgsql/
drwx-wx-wt  2 apache   apache   4096 May  1 17:16 php/
drwxr-xr-x  3 root     root     4096 Aug  2  2017 plasma5-profiles/
drwxr-xr-x  2 root     root     4096 Apr 26 02:38 plymouth/
drwx--x--x  2 root     root     4096 Feb  8  2016 portreserve/
drwx------  2 postfix  root     4096 Feb 23 09:55 postfix/
drwxr-xr-x  2 root     root     4096 May  3 16:56 preload/
drwxr-xr-x  2 root     root     4096 Feb 12  2016 rarian/
drwxr-xr-x  2 root     root     4096 Aug  2  2017 readahead/
drwxr-xr-x  2 rpm      rpm      4096 Apr 25 18:26 rpm/
drwxr-xr-x  3 root     root     4096 Aug  2  2017 rpm-helper/
drwxr-xr-x  4 rpm      rpm      4096 Apr 13 15:01 rpmold.7498/
drwxr-xr-x  2 root     root     4096 May  2 14:01 rpm-state/
drwxr-xr-x  3 root     root     4096 Aug  2  2017 run/
drwxr-xr-x  8 root     root     4096 May  2 15:02 samba/
drwxr-xr-x  2 root     root     4096 Feb  4 09:03 sasl2/
drwx------  6 sddm     sddm     4096 Jan 19 10:30 sddm/
drwxr-xr-x  2 root     root     4096 Sep  1  2017 sectool/
drwxr-xr-x  2 root     root     4096 Apr 22 18:01 shorewall/
drwxr-xr-x  2 root     root     4096 Apr 22 18:01 shorewall6/
drwxr-xr-x  2 root     root     4096 Sep  5  2017 spamassassin/
drwxr-xr-x  4 root     root     4096 Jan  3 23:00 stateless/
drwxr-xr-x  7 root     root     4096 Aug  2  2017 systemd/
drwxr-xr-x  4 root     root     4096 Apr 15 18:04 texmf/
drwxr-xr-x  2 root     root     4096 Jan  2 11:40 tftpboot/
drwxr-xr-x  3 root     tomcat   4096 Feb 24 18:38 tomcat/
drwxr-xr-x  3 root     root     4096 Feb 24 18:38 tomcats/
drwx------  2 root     root     4096 Dec 10  2016 udisks/
drwx------  2 root     root     4096 Feb  6  2017 udisks2/
drwxr-xr-x  2 root     root     4096 Dec 12 05:27 upower/
drwxr-xr-x 47 root     root     4096 May  3 12:02 urpmi/
drwxr-xr-x  5 vdr      vdr      4096 Aug 30  2017 vdr/
drwxr-xr-x  4 root     root     4096 Sep 22  2017 virtuoso/
drwxr-xr-x  2 root     root     4096 May 17  2017 vnstat/
drwxr-xr-x  2 root     root     4096 Feb 12  2016 vpnc/
drwxr-xr-x  2 root     root     4096 May  6  2017 xdm/
drwxrwxrwt  2 root     root     4096 May  2 14:56 xkb/
[root@ftgme2 lib]# cd rpm
[root@ftgme2 rpm]# ls
Basenames     Dirnames                     Name           Sha1header
Conflictname  Enhancename                  Obsoletename   Sigmd5
__db.000      Filetriggername              Packages       Suggestname
__db.001      Group                        Providename    Supplementname
__db.002      installed-through-deps.list  Recommendname  Transfiletriggername
__db.003      Installtid                   Requirename    Triggername
[root@ftgme2 rpm]# 

In the working system:

root@jaglap ~]# cd /var/lib
[root@jaglap lib]# ls -l alternatives
lrwxrwxrwx 1 root root 16 Oct 14  2017 alternatives -> rpm/alternatives/
[root@jaglap lib]# ls -l rpm/alternatives 
total 244
-rw-r--r-- 1 root root   53 Apr  8 19:49 bsetroot
-rw-r--r-- 1 root root  151 Apr  9 06:58 bssh-askpass
-rw-r--r-- 1 root root  123 Apr  8 20:05 cdda2wav
-rw-r--r-- 1 root root  121 Apr  8 16:42 cdrecord
-rw-r--r-- 1 root root   81 Apr  8 16:45 cpp
-rw-r--r-- 1 root root   45 Apr  9 07:06 cpphs
-rw-r--r-- 1 root root  132 Apr  8 16:39 ctags
-rw-r--r-- 1 root root   63 Apr  8 16:36 cups_backend_smb
-rw-r--r-- 1 root root   77 Apr  8 19:51 elspec
-rw-r--r-- 1 root root   44 Apr 11 09:52 emacs
-rw-r--r-- 1 root root  138 Apr  8 16:48 enlightenment-default-theme.edj
-rw-r--r-- 1 root root   81 Apr  8 17:01 g++
-rw-r--r-- 1 root root   45 Apr  8 16:45 gcc
-rw-r--r-- 1 root root   51 Apr  8 16:45 gcc-ar
-rw-r--r-- 1 root root   51 Apr  8 16:45 gcc-nm
-rw-r--r-- 1 root root   59 Apr  8 16:45 gcc-ranlib
-rw-r--r-- 1 root root 2210 Apr  9 07:08 gl_conf
-rw-r--r-- 1 root root   35 Apr 22 09:19 gs
-rw-r--r-- 1 root root   83 Apr  9 07:07 gst-install-plugins-helper
-rw-r--r-- 1 root root   47 Apr  9 07:06 hsc2hs
-rw-r--r-- 1 root root  309 Apr  8 16:55 icewm
-rw-r--r-- 1 root root 2778 May  3 11:03 java
-rw-r--r-- 1 root root 6682 May  1 23:29 javac
-rw-r--r-- 1 root root  252 May  1 23:29 java_sdk_1.8.0
-rw-r--r-- 1 root root  276 May  1 23:29 java_sdk_1.8.0_openjdk
-rw-r--r-- 1 root root  258 May  1 23:29 java_sdk_openjdk
-rw-r--r-- 1 root root   68 Apr  8 19:40 jmxri
-rw-r--r-- 1 root root  245 May  1 23:29 jre_1.8.0
-rw-r--r-- 1 root root  260 May  1 23:29 jre_1.8.0_openjdk
-rw-r--r-- 1 root root  251 May  1 23:29 jre_openjdk
-rw-r--r-- 1 root root   75 Apr  8 19:51 jsp
-rw-r--r-- 1 root root   64 Apr  8 19:31 kde4-config
-rw-r--r-- 1 root root   47 Apr  8 17:20 kdesu
-rw-r--r-- 1 root root  211 Apr  8 16:45 libjavaplugin.so.x86_64
-rw-r--r-- 1 root root  104 Apr 15 11:48 lightdm-greeter
-rw-r--r-- 1 root root  110 Apr  8 20:53 lua
-rw-r--r-- 1 root root   97 Apr  8 16:43 lxde-config
-rw-r--r-- 1 root root   79 Apr  8 17:11 matemenu
-rw-r--r-- 1 root root  133 Apr  8 16:39 mkhybrid
-rw-r--r-- 1 root root  130 Apr  8 16:39 mkisofs
-rw-r--r-- 1 root root   66 Apr  9 07:03 mutt
-rw-r--r-- 1 root root  958 Apr  8 19:46 print
-rw-r--r-- 1 root root   49 Apr 21 14:12 qmake
-rw-r--r-- 1 root root   53 Apr  8 16:56 qtconfig
-rw-r--r-- 1 root root  117 Apr  8 16:42 readcd
-rw-r--r-- 1 root root   47 Apr  9 07:06 runhaskell
-rw-r--r-- 1 root root   99 Apr  8 20:21 scanner.gnome.dynamic
-rw-r--r-- 1 root root   97 Apr  8 20:21 scanner.kde.dynamic
-rw-r--r-- 1 root root  127 Apr  8 16:55 sendmail-command
-rw-r--r-- 1 root root   83 Apr  8 19:51 servlet
-rw-r--r-- 1 root root   91 Apr  8 16:24 soundprofile
-rw-r--r-- 1 root root  163 Apr  9 06:58 ssh-askpass
-rw-r--r-- 1 root root  109 Apr  9 06:58 timidity.cfg
-rw-r--r-- 1 root root  271 Apr  8 16:52 vi
-rw-r--r-- 1 root root  114 Apr  8 16:52 vim
-rw-r--r-- 1 root root  145 Apr  8 17:27 webcam.gnome.dynamic
-rw-r--r-- 1 root root  143 Apr  8 17:27 webcam.kde.dynamic
-rw-r--r-- 1 root root  228 Apr  8 17:04 x11-intel-so
-rw-r--r-- 1 root root   37 Apr  9 06:58 xvt
-rw-r--r-- 1 root root   61 Apr  8 19:58 yacc
[root@jaglap lib]#
Comment 10 David Walser 2018-05-04 00:03:50 CEST
So in other words, something is wrong with your system.  If you can give us a reproducible test case, we can set this back to NEW.

Ever confirmed: 1 => 0
Status: NEW => UNCONFIRMED

Comment 11 Frank Griffin 2018-05-04 17:10:39 CEST
To test, I upgraded the working system to current cauldron, and it was fine, so  it's not the java packaging.

I copied /var/lib/rpm/alternatives from the working system to the broken one, and now "urpmi --replacepkgs java-devel" completes without error and correctly restores all of the alternatives symlinks.

Going through my notes for the broken system, I noted that a while back a power failure during "urpmi --auto-update" required an "rpm --rebuilddb", so I tried that, and sure enough /var/lib/rpm/alternatives disappeared again.  Recopying alternatives from a backup set things right again.

Should rebuilddb leave alternatives in place ?  Or was there something else I needed to do in addition to rebuilddb ?  If the deletion of alternatives is incorrect, is it a local modification to rpm or are we running an unchanged upstream version ?
Comment 12 David Walser 2018-05-04 17:28:54 CEST
I recommend closing this bug and filing a new one for the rpm issue.
Comment 13 Frank Griffin 2018-05-04 18:08:04 CEST
Closing as INVALID.  The rpm problem is now reported in bug#22993 .

Status: UNCONFIRMED => RESOLVED
Resolution: (none) => INVALID


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