Bug 59494

Summary: %pre scriptlet fails on ro-mounted /usr/share
Product: [Retired] Red Hat Linux Reporter: Enrico Scholz <rh-bugzilla>
Component: scrollkeeperAssignee: Havoc Pennington <hp>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-03-01 17:41:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 51193    
Bug Blocks:    

Description Enrico Scholz 2002-02-08 22:47:25 UTC
Description of Problem:

When having /usr/share mounted ro, installation of scrollkeeper fails:

| $ rpm -U /usr/src/redhat/RPMS/i386/scrollkeeper-0.3.4-2.i386.rpm 
| rm: cannot unlink `/usr/share/scrollkeeper/Templates/C/scrollkeeper_cl.xml': Read-only file system
| rm: cannot remove directory `/usr/share/scrollkeeper/Templates/C': Read-only file system
| ...
| error: execution of %pre scriptlet from scrollkeeper-0.3.4-2 failed, exit status 1
| error:   install: %pre scriptlet failed (2), skipping scrollkeeper-0.3.4-2


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

scrollkeeper-0.3.4-2

Comment 1 Jay Turner 2002-02-19 17:28:42 UTC
Not quite sure what you are working towards here, but of course the scriptlet
failed.  You have the filesystem mounted RO and the scriptlet is attempting to
remove a directory on /usr/share.  Even is the scriptlet didn't fail, the
install of the package is going to fail, as there are a ton of files that it is
going to try to write to the /usr/share/ filesystem.

Comment 2 Enrico Scholz 2002-02-19 17:42:05 UTC
No; the installation itself works and only the scriptlet fails. rpm knows a
%_netsharedpath variable which handles cases where parts of the filesystem are
mounted RO (e.g. because they are shared by NFS). Then files located there will
never be touched by rpm.

Please see bug #51193 for a related discussion.

Comment 3 Havoc Pennington 2002-03-01 17:15:10 UTC
I'm not sure how to fix this without ignoring legitimate errors - any suggestions?

i.e. I don't really want to just say "rm foo || true" because it will 
potentially mask real problems.

Comment 4 Enrico Scholz 2002-03-01 17:41:32 UTC
You could check if /usr/share/scrollkeeper is writable by you:

| test -w /usr/share/scrollkeeper && {
|   rm -rf ... }

Alternativily to the 'test -w ...' you can use the __isDirectoryShared macro
defined in bug #51193. 

But this may be too much bloat for a simple 'rm -rf'; I can not imagine a
problem which would not be detected in a later stage of rpm. Therefore, keep it
small and simple, and make

| rm -rf /usr/share/scrollkeeper 2>/dev/null || true

Comment 5 Havoc Pennington 2002-03-05 21:32:16 UTC
Should be fixed in 0.3.4-3