Bug 1311715

Summary: bad mode on line 1 of /var/lib/alternatives/jre_1.8.0
Product: [Fedora] Fedora Reporter: Norman Smith <nls1729>
Component: java-1.8.0-openjdkAssignee: jiri vanek <jvanek>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 23CC: ahughes, dbhole, jerboaa, jvanek, msrb, omajid
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-02-27 12:27:21 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
/var/lib/alternatives/jre_1.8.0 none

Description Norman Smith 2016-02-24 19:47:50 UTC
Description of problem:

I ran a dnf update today and noticed the following during the update.

Upgrading   : java-1.8.0-openjdk-headless-1:1.8.0.72-4.b15.fc23.x86_64
bad mode on line 1 of /var/lib/alternatives/jre_1.8.0

Version-Release number of selected component (if applicable):

How reproducible:

Always

Steps to Reproduce:

1. I re-installed java-1.8.0-openjdk-headless-1:1.8.0.72-4.b15.fc23.x86_64 and
received the following:

Actual results:

Running transaction
Reinstalling: java-1.8.0-openjdk-headless-1:1.8.0.72-4.b15.fc23.x86_64                                               1/2 
bad mode on line 1 of /var/lib/alternatives/jre_1.8.0
Erasing     : java-1.8.0-openjdkheadless1:1.8.0.72-4.b15.fc23.x86_64                                2/2
bad mode on line 1 of /var/lib/alternatives/jre_1.8.0
Verifying   : java-1.8.0-openjdk-  headless1:1.8.0.72-4.b15.fc23.x86_64                                       1/2 
Verifying   : java-1.8.0-openjdk-
headless-1:1.8.0.72-4.b15.fc23.x86_64                                      2/2

Expected results:

I think I should not see bad mode on line 1 of /var/lib/alternatives/jre_1.8.0.

Additional info:

I did a dnf provides /var/lib/alternatives/jre_1.8.0 and got no results.

[bogwan@valkyrie3 ~]$ ls -l /var/lib/alternatives/jre*
-rw-r--r--. 1 root root 381 Oct 12 08:52 /var/lib/alternatives/jre_1.8.0

[bogwan@valkyrie3 ~]$ file /var/lib/alternatives/jre_1.8.0
/var/lib/alternatives/jre_1.8.0: XML document text

The file is dated Oct 12.  It looks like something has been wrong for long while.

Comment 1 jiri vanek 2016-02-26 13:04:26 UTC
Hello! I had never seen this behaviour. And I 'm doing updates/downgrades/install/uninstalls of jdk pretty often. both manually and automatically.


> I did a dnf provides /var/lib/alternatives/jre_1.8.0 and got no results.
Thats correct. It is alternatives driven record. So nobody can provides it.

I think some old, wrong alternative persisted on your system, and for some reason did not disapeard during updates.
Or you were playing withalterantives and remained (even unintentionally) in inconsistent state. Try the commands provided later in this reply.

however - see http://pkgs.fedoraproject.org/cgit/rpms/java-1.8.0-openjdk.git/tree/java-1.8.0-openjdk.spec#n288 - this is valid target.
   and
file /var/lib/alternatives/jre_1.8.0
/var/lib/alternatives/jre_1.8.0: ASCII text
:)

Thats sequence of links, going through alternatives databse [1] - ending by directory. See:
alternatives --config jre_1.8.0
  Selection    Command
-----------------------------------------------
   1           /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-4.b15.fc23.x86_64-debug/jre
*+ 2           /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-4.b15.fc23.x86_64/jre

(or alternatives --config jre_1.8.0_openjdk)
(or alternatives --config jre_openjdk)

ll /usr//lib/jvm
...
jre -> /etc/alternatives/jre
jre-1.8.0 -> /etc/alternatives/jre_1.8.0
jre-1.8.0-openjdk -> /etc/alternatives/jre_1.8.0_openjdk
jre-1.8.0-openjdk-1.8.0.72-4.b15.fc23.x86_64 -> java-1.8.0-openjdk-1.8.0.72-4.b15.fc23.x86_64/jre
...

readlink /etc/alternatives/jre_1.8.0
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-4.b15.fc23.x86_64/jre


[1]
cat  /var/lib/alternatives/jre_1.8.0
auto
/usr/lib/jvm/jre-1.8.0
jre_1.8.0_exports
/usr/lib/jvm-exports/jre-1.8.0

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-4.b15.fc23.x86_64-debug/jre
@java-1.8.0-openjdk@1800071
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-4.b15.fc23.x86_64-debug/jre
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-4.b15.fc23.x86_64/jre
@java-1.8.0-openjdk@1800072
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-4.b15.fc23.x86_64/jre


So the error you are enountering is IN /var/lib/alternatives/jre_1.8.0 and maybe caused bny wrong alternatives (both app and settings)

May you:
cat  /var/lib/alternatives/jre_1.8.0
  Select (As root)
alternatives --config jre_1.8.0 
  manually
  and (second times)
cat  /var/lib/alternatives/jre_1.8.0
  For me?

Comment 2 Norman Smith 2016-02-26 19:41:57 UTC
I don't program in java and have not played with alternatives. I do use javascript for Gnome Shell extensions but I am sure that is not related.

As shown below alternatives --config jre_1.8.0 did not change /var/lib/alternatives/jre_1.8.0.


[root@valkyrie3 bogwan]# cat  /var/lib/alternatives/jre_1.8.0
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
	<schema id="org.gnome.totem.plugins.opensubtitles" path="/org/gnome/Totem/opensubtitles/" gettext-domain="totem">
		<key name="language" type="s">
			<default>''</default>
			<summary>Subtitle language</summary>
			<description>The language to search for subtitles for movies in.</description>
		</key>
	</schema>
</schemalist>

[root@valkyrie3 bogwan]# alternatives --config jre_1.8.0 
bad mode on line 1 of /var/lib/alternatives/jre_1.8.0

[root@valkyrie3 bogwan]# cat  /var/lib/alternatives/jre_1.8.0
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
	<schema id="org.gnome.totem.plugins.opensubtitles" path="/org/gnome/Totem/opensubtitles/" gettext-domain="totem">
		<key name="language" type="s">
			<default>''</default>
			<summary>Subtitle language</summary>
			<description>The language to search for subtitles for movies in.</description>
		</key>
	</schema>
</schemalist>


[root@valkyrie3 bogwan]# ll /usr/lib/jvm
total 4
lrwxrwxrwx. 1 root root   26 Feb 24 12:54 java -> /etc/alternatives/java_sdk
lrwxrwxrwx. 1 root root   32 Feb 24 12:54 java-1.8.0 -> /etc/alternatives/java_sdk_1.8.0
lrwxrwxrwx. 1 root root   40 Feb 24 12:54 java-1.8.0-openjdk -> /etc/alternatives/java_sdk_1.8.0_openjdk
drwxr-xr-x. 7 root root 4096 Feb  8 09:06 java-1.8.0-openjdk-1.8.0.72-4.b15.fc23.x86_64
lrwxrwxrwx. 1 root root   34 Feb 24 12:54 java-openjdk -> /etc/alternatives/java_sdk_openjdk
lrwxrwxrwx. 1 root root   27 Jan 24 10:11 jre-1.8.0 -> /etc/alternatives/jre_1.8.0
lrwxrwxrwx. 1 root root   49 Feb  8 09:06 jre-1.8.0-openjdk-1.8.0.72-4.b15.fc23.x86_64 -> java-1.8.0-openjdk-1.8.0.72-4.b15.fc23.x86_64/jre
 
[root@valkyrie3 bogwan]# readlink /etc/alternatives/jre_1.8.0
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.71-1.b15.fc23.x86_64/jre
                                      ????
Is 71-1 OK?

Comment 3 jiri vanek 2016-02-27 12:25:13 UTC
Thak you for additional info.

You mus tsee on your own, that:

[root@valkyrie3 bogwan]# cat  /var/lib/alternatives/jre_1.8.0
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
	<schema id="org.gnome.totem.plugins.opensubtitles" path="/org/gnome/Totem/opensubtitles/" gettext-domain="totem">
		<key name="language" type="s">
			<default>''</default>
			<summary>Subtitle language</summary>
			<description>The language to search for subtitles for movies in.</description>
		</key>
	</schema>
</schemalist>


is VERY wrong. I dont know how you managed that... 

From any point of view this is close not-a-bug.

I'm not sure how to fix your machine.  Best may be to replace content of yours 
/var/lib/alternatives/jre_1.8.0
   by mine: cat
/var/lib/alternatives/jre_1.8.0 (just with proer paths, so it points to the verison of java you have (but I have latest so you may be equals)
auto
/usr/lib/jvm/jre-1.8.0
jre_1.8.0_exports
/usr/lib/jvm-exports/jre-1.8.0

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-4.b15.fc23.x86_64-debug/jre
@java-1.8.0-openjdk@1800071
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-4.b15.fc23.x86_64-debug/jre
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-4.b15.fc23.x86_64/jre
@java-1.8.0-openjdk@1800072
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-4.b15.fc23.x86_64/jre


I will attach the file as attachement so there is no confusion in whitesapces/emtpy chars....


Although I'm closing this as  not-a-bug, feel free to ask here for any other help on this topic.

Comment 4 jiri vanek 2016-02-27 12:27:09 UTC
Created attachment 1131084 [details]
/var/lib/alternatives/jre_1.8.0

Comment 5 Norman Smith 2016-02-27 13:22:07 UTC
Thanks for your help.  Please excuse this long comment but I found something
very interesting.

Your suggestion corrected the problem.

bogwan@valkyrie2:~
$ ssh valkyrie3
Last login: Fri Feb 26 12:37:33 2016
[bogwan@valkyrie3 ~]$ su
Password: 
[root@valkyrie3 bogwan]# vi /var/lib/alternatives/jre_1.8.0
[root@valkyrie3 bogwan]# alternatives --config jre_1.8.0

There is 1 program that provides 'jre_1.8.0'.

  Selection    Command
-----------------------------------------------
*  1           /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-4.b15.fc23.x86_64/jre

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

From comment 2:
"[root@valkyrie3 bogwan]# readlink /etc/alternatives/jre_1.8.0
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.71-1.b15.fc23.x86_64/jre
                                      ????"
alternatives --config jre_1.8.0 fixed that problem.


[root@valkyrie3 bogwan]# dnf reinstall java-1.8.0-openjdk-headless-1:1.8.0.72-4.b15.fc23.x86_64
Last metadata expiration check performed 1:06:35 ago on Sat Feb 27 06:46:43 2016.
Dependencies resolved.
===============================================================================================================================
 Package                                  Arch                Version                               Repository            Size
===============================================================================================================================
Reinstalling:
 java-1.8.0-openjdk-headless              x86_64              1:1.8.0.72-4.b15.fc23                 updates               31 M

Transaction Summary
===============================================================================================================================

Total download size: 31 M
Is this ok [y/N]: y
Downloading Packages:
java-1.8.0-openjdk-headless-1.8.0.72-4.b15.fc23.x86_64.rpm                                     793 kB/s |  31 MB     00:40    
-------------------------------------------------------------------------------------------------------------------------------
Total                                                                                          780 kB/s |  31 MB     00:41     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Reinstalling: java-1.8.0-openjdk-headless-1:1.8.0.72-4.b15.fc23.x86_64                                                   1/2 
  Erasing     : java-1.8.0-openjdk-headless-1:1.8.0.72-4.b15.fc23.x86_64                                                   2/2 
  Verifying   : java-1.8.0-openjdk-headless-1:1.8.0.72-4.b15.fc23.x86_64                                                   1/2 
  Verifying   : java-1.8.0-openjdk-headless-1:1.8.0.72-4.b15.fc23.x86_64                                                   2/2 

Reinstalled:
  java-1.8.0-openjdk-headless.x86_64 1:1.8.0.72-4.b15.fc23                                                                     

Complete!

It looks like there was an update to totem dated Oct 12 08:52.

[root@valkyrie3 bogwan]# ls -Rl / | grep "Oct 12 08:52"

-rwxr-xr-x.   1 root root       11192 Oct 12 08:52 totem
-rwxr-xr-x.   1 root root       19560 Oct 12 08:52 totem-audio-preview
-rwxr-xr-x.   1 root root       40256 Oct 12 08:52 totem-video-thumbnailer
-rwxr-xr-x.  1 root root   499936 Oct 12 08:52 libtotem.so.0.0.0
-rwxr-xr-x. 1 root root 35648 Oct 12 08:52 libtotem-properties-page.so
-rwxr-xr-x. 1 root root 15144 Oct 12 08:52 libapple-trailers.so
-rwxr-xr-x. 1 root root 15192 Oct 12 08:52 libautoload-subtitles.so
-rwxr-xr-x. 1 root root 23424 Oct 12 08:52 libbrasero-disc-recorder.so
-rw-r--r--. 2 root root 10137 Oct 12 08:52 dbusservice.cpython-34.pyc
-rw-r--r--. 2 root root 10137 Oct 12 08:52 dbusservice.cpython-34.pyo
-rwxr-xr-x. 1 root root 15400 Oct 12 08:52 libgromit.so
-rwxr-xr-x. 1 root root 15184 Oct 12 08:52 libtotem-im-status.so
-rwxr-xr-x. 1 root root 19336 Oct 12 08:52 libmedia_player_keys.so
-rw-r--r--. 1 root root  8326 Oct 12 08:52 media-player-keys.plugin
-rwxr-xr-x. 1 root root 15160 Oct 12 08:52 libontop.so
-rw-r--r--. 1 root root 11286 Oct 12 08:52 ontop.plugin
-rw-r--r--. 1 root root  1316 Oct 12 08:52 hash.py
-rw-r--r--. 1 root root  9405 Oct 12 08:52 opensubtitles.plugin
-rw-r--r--. 1 root root 26377 Oct 12 08:52 opensubtitles.py
-rw-r--r--. 1 root root  6852 Oct 12 08:52 opensubtitles.ui
-rw-r--r--. 2 root root  1210 Oct 12 08:52 hash.cpython-34.pyc
-rw-r--r--. 2 root root  1210 Oct 12 08:52 hash.cpython-34.pyo
-rw-r--r--. 2 root root 22166 Oct 12 08:52 opensubtitles.cpython-34.pyc
-rw-r--r--. 2 root root 22166 Oct 12 08:52 opensubtitles.cpython-34.pyo
-rwxr-xr-x. 1 root root 27568 Oct 12 08:52 libmovie-properties.so
-rw-r--r--. 1 root root  7036 Oct 12 08:52 movie-properties.plugin
-rw-r--r--. 1 root root 12303 Oct 12 08:52 console.py
-rw-r--r--. 1 root root  6283 Oct 12 08:52 pythonconsole.plugin
-rw-r--r--. 1 root root  4833 Oct 12 08:52 pythonconsole.py
-rw-r--r--. 2 root root 9560 Oct 12 08:52 console.cpython-34.pyc
-rw-r--r--. 2 root root 9560 Oct 12 08:52 console.cpython-34.pyo
-rw-r--r--. 2 root root 3771 Oct 12 08:52 pythonconsole.cpython-34.pyc
-rw-r--r--. 2 root root 3771 Oct 12 08:52 pythonconsole.cpython-34.pyo
-rwxr-xr-x. 1 root root 15144 Oct 12 08:52 librecent.so
-rw-r--r--. 1 root root  8543 Oct 12 08:52 recent.plugin
-rwxr-xr-x. 1 root root 23584 Oct 12 08:52 librotation.so
-rw-r--r--. 1 root root  9382 Oct 12 08:52 rotation.plugin
-rwxr-xr-x. 1 root root 23392 Oct 12 08:52 libsave-file.so
-rw-r--r--. 1 root root  7896 Oct 12 08:52 save-file.plugin
-rwxr-xr-x. 1 root root 15200 Oct 12 08:52 libscreensaver.so
-rw-r--r--. 1 root root  8656 Oct 12 08:52 screensaver.plugin
-rw-r--r--. 1 root root  3845 Oct 12 08:52 gallery.ui
-rwxr-xr-x. 1 root root 40000 Oct 12 08:52 libscreenshot.so
-rw-r--r--. 1 root root  8462 Oct 12 08:52 screenshot.plugin
-rwxr-xr-x. 1 root root 27664 Oct 12 08:52 libskipto.so
-rw-r--r--. 1 root root  6341 Oct 12 08:52 skipto.plugin
-rw-r--r--. 1 root root  3810 Oct 12 08:52 skipto.ui
-rwxr-xr-x. 1 root root 15136 Oct 12 08:52 libvimeo.so
-rw-r--r--. 1 root root  5660 Oct 12 08:52 vimeo.plugin
-rwxr-xr-x. 1 root root 27728 Oct 12 08:52 libtotem-zeitgeist-dp-plugin.so
-rw-r--r--. 1 root root  6788 Oct 12 08:52 zeitgeist-dp.plugin
-rwxr-xr-x. 1 root root 15144 Oct 12 08:52 libapple-trailers.so
-rw-r--r--. 1 root root    94 Oct 12 08:52 opensubtitles.convert
-rw-r--r--. 1 root root   106 Oct 12 08:52 pythonconsole.convert
-rw-r--r--. 1 root root    381 Oct 12 08:52 org.gnome.totem.plugins.opensubtitles.gschema.xml
-rw-r--r--. 1 root root    477 Oct 12 08:52 org.gnome.totem.plugins.pythonconsole.gschema.xml

"The following is from the beginning of this bug report.

[bogwan@valkyrie3 ~]$ file /var/lib/alternatives/jre_1.8.0
/var/lib/alternatives/jre_1.8.0: XML document text

The file is dated Oct 12.  It looks like something has been wrong for long while."

I think the totem update somehow caused the problem.  I will dig through the logs and see if I can find anything else of interest.

In any case all is well now.  Thanks again.

Comment 6 jiri vanek 2016-02-29 08:15:14 UTC
(In reply to Norman Smith from comment #5)
> Thanks for your help.  Please excuse this long comment but I found something
> very interesting.

Thast far from being ok :)
> 
> Your suggestion corrected the problem.
> 

good!

> bogwan@valkyrie2:~
...
> 
> It looks like there was an update to totem dated Oct 12 08:52.


Hm. Thats pretty scary indeed. If you find the root cause, would be worhty to bug totem maintainer a lot!
> 
...
> The file is dated Oct 12.  It looks like something has been wrong for long
> while."


J,