Bug 974505 - warning: %post(shared-mime-info-0.70-4.el6.i686) scriptlet failed, exit status 127
warning: %post(shared-mime-info-0.70-4.el6.i686) scriptlet failed, exit statu...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: shared-mime-info (Show other bugs)
6.5
Unspecified Unspecified
medium Severity medium
: beta
: ---
Assigned To: Bastien Nocera
Desktop QE
:
: 730461 (view as bug list)
Depends On:
Blocks: 994246 972747
  Show dependency treegraph
 
Reported: 2013-06-14 06:01 EDT by Marian Ganisin
Modified: 2014-05-27 05:07 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-05-27 05:07:21 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
install.log in the no-error case (9.89 KB, text/plain)
2014-01-22 16:53 EST, Kay Williams
no flags Details
install.log in the error case (53.43 KB, text/plain)
2014-01-22 16:53 EST, Kay Williams
no flags Details

  None (edit)
Description Marian Ganisin 2013-06-14 06:01:36 EDT
Description of problem:

During installation of system installer reports this failure:

Installing shared-mime-info-0.70-4.el6.i686
warning: %post(shared-mime-info-0.70-4.el6.i686) scriptlet failed, exit status 127

Version-Release number of selected component (if applicable):
Installing shared-mime-info-0.70-4.el6

How reproducible:
Always

Expected results:
Properly installed package including correct execution of rpm scriptlets or no error message in case of success or harmless issue.
Comment 4 Kay Williams 2014-01-22 16:51:32 EST
I am seeing this issue as well, but not in all cases. 

The scriptlet that is failing has the following command (as seen from rpm -q --scripts shared-mime-info):
/usr/bin/update-mime-database /usr/share/mime &> /dev/null

Error 127 means 'command not found'. The update-mime-database command is installed by the shared-mime-info command, so presumably it is not missing but rather there is a permissions (maybe selinux) issue?

Whether the error appears or not seems related to the order packages are installed.

For example- 

Good: with a barebones install of @core and shared-mime-info, a total of 114 packages install ahead of shared-mime-info and there is no error.

Bad: With a more complex install, a total of 84 packages install ahead of it and the error occurs.

See attached files that show the install.log for both cases.
Comment 5 Kay Williams 2014-01-22 16:53:10 EST
Created attachment 854051 [details]
install.log in the no-error case
Comment 6 Kay Williams 2014-01-22 16:53:46 EST
Created attachment 854052 [details]
install.log in the error case
Comment 7 Kay Williams 2014-01-22 22:43:42 EST
More information:

Since this issue is blockign a current project, I continued experimenting. My first step was to modify the shared-mime-info specfile and rebuilding the rpm (see related bug 1056802).

Specifically, I modified the scriptlet line in the specfile as follows:

before: /usr/bin/update-mime-database /usr/share/mime &> /dev/null
after:  /usr/bin/update-mime-database /usr/share/mime

This unmasked the real error message which turned out to be:

/usr/bin/update-mime-database: error while loading shared libraries: libglib-2.0.so.0: cannot open shared object file: No such file or directory
 
So, the underlying problem is that (for some reason) the glib2 package (which provides libglib-2.0.so.0) is being installed after shared-mime-info in some cases.

I tried adding a "Requires: glib2" statement to the specfile, but this made no difference - glib2 was still installed after shared-mime-info. (Note that adding glib2 should not have been necessary at any rate as the 'rpm -q --requires shared-mime-info' already listed 'libglib-2.0.so.0()(64bit)'

So now this looks like a dependency resolution issue?
Comment 8 Kay Williams 2014-01-22 23:02:07 EST
More information:

Actually, there is a circular dependency here. The glib2 package lists 'shared-mime-info' as a requires, and the shared-mime-info package lists 'libglib-2.0.so.0' (provided by glib2).

From the install.log files (attached), you can see that in the 'good' case, shared-mime-info is installed first, just prior to glib2.  In the 'bad' case the order is reversed.
Comment 9 Kay Williams 2014-01-23 16:40:18 EST
Final note:

I am able to work around this for now by rebuilding the shared-mime-info package with the following post install script:

%post
# Should fail, as it would mean a problem in the mime database
if [ -f %{_lib}/libglib-2.0.so.0 ]; then
  %{_bindir}/update-mime-database %{_datadir}/mime > /dev/null
fi
Comment 10 Bastien Nocera 2014-01-27 08:39:07 EST
The problem should be solved in anaconda (or at least, the packaging guidelines should be amended to take those cases into account if that's not fixable in anaconda itself).

FWIW, I don't know whether it's possible to reproduce this bug at all in yum, as I don't think we can install a RHEL or Fedora base system without glib2 installed (thus, without shared-mime-info being installed at the same time through the installed/anaconda).

Thanks a lot for the root-causing Kay.
Comment 11 David Cantrell 2014-01-27 08:45:47 EST
Either the glib2 package or shared-mime-info package needs their Requires and/or scripts adjusted to deal with this situation.  We do not work around issues like this in anaconda.  I agree that this is something that should be updated in the packaging guidelines (ideally the package review process would catch circular dependency issues like this too).

This bug either belongs with shared-mime-info or glib2, but not anaconda.  It might be both.  At any rate, it's definitely not something we can deal with in anaconda.  If you want the problem addressed in glib2, please reassign it there.  If you want it addressed as a distribution-wide issues, please reassign it to 'distribution'.
Comment 12 Bastien Nocera 2014-01-27 09:47:52 EST
*** Bug 730461 has been marked as a duplicate of this bug. ***
Comment 14 Johnny Hughes 2014-02-19 19:32:16 EST
I see the same error in mock root logs as shared-mime-info installs before glib2.
Comment 15 Matthias Clasen 2014-03-27 11:45:43 EDT
The rawhide package has 

Requires(post): glib2

I assume thats sufficient to fix this bug
Comment 16 Kay Williams 2014-03-30 13:53:55 EDT
Actually, no, that won't address the issue, unless a change has also been made to the requires of the glib2 package.

The trouble is that there is a circular dependency.

shared-mime-info requires glib2 (via libglib-2.0.so.0)
glib2 requires shared-mime-info

One of those two packages needs to be modified to remove the dependency on the other.
Comment 17 Matthias Clasen 2014-04-02 17:42:46 EDT
a circular dependency just means that shared-mime-info and glib2 have to be installed at the same time. The requires(post) adds additional information that should be sufficient to sort out the necessary ordering inside the transation.
Comment 18 Kay Williams 2014-04-02 18:50:21 EDT
I see. Thanks for the clarification.
Comment 19 Bastien Nocera 2014-05-21 10:46:53 EDT
Package with the idea from comment 15 is built in shared-mime-info-0.70-5.el6.
Comment 23 errata-xmlrpc 2014-05-27 05:07:21 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-0555.html

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