Bug 1016725

Summary: Empty /var/lib/alternatives/xxxx file makes `alternatives` confused
Product: [Fedora] Fedora Reporter: Tomáš Bžatek <tbzatek>
Component: chkconfigAssignee: Lukáš Nykrýn <lnykryn>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: lnykryn, lzachar, pez, tsmetana
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-19 10:27:57 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:

Description Tomáš Bžatek 2013-10-08 15:08:53 UTC
Description of problem:
For some reason (VM crash during yum update probably) some of the files on my filesystem got corrupted. Haven't really checked why, it's a development VM. However, my java stopped working, realizing that /usr/bin/java was a broken symlink, pointing to /etc/alternatives/java which itself was a broken link.

Reinstalling a package that uses that alternative didn't help. From user point of view I was screwed.

Looking at the package scriptlet, it calls `alternatives --install ...` to install its newly installed commands. However that call always returns "/var/lib/alternatives/xxxx empty!" error messages, not doing anything useful.

Removing that corrupted file from /var/lib/alternatives/ made the above call successful, updating links in /etc/alternatives/ etc.

Such troubles may happen anytime and we should have a kind of disaster recovery to prevent user being stuck.


Version-Release number of selected component (if applicable):
chkconfig-1.3.61-1.fc21.x86_64

How reproducible:
always

Steps to Reproduce:
1. Corrupt some files in /var/lib/alternatives/, i.e. make them empty
2. Install package that uses alternatives, e.g. java-1.7.0-openjdk
3. Watch error messages below

Actual results:
/var/lib/alternatives/java empty!
/var/lib/alternatives/jre_openjdk empty!
/var/lib/alternatives/jre_1.7.0 empty!

Expected results:
Working alternative update

Additional info:

Scriptlet excerpt:
> alternatives --install /usr/bin/java java /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.2.11.fc20.x86_64/jre/bin/java 170040
> alternatives --set $COMMAND /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.2.11.fc20.x86_64/jre/bin/java

Comment 1 Jaroslav Reznik 2015-03-03 15:07:30 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 4 CJ Kucera 2015-09-16 04:50:09 UTC
Yeah, I encountered this problem on my F22 laptop after some heat issues resulted in a mid-dnf-update hard poweroff.  Removing the empty /var/lib/alternatives/ entry fixed up the problem for me too!

Comment 5 Fedora End Of Life 2016-07-19 10:27:57 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.