Bug 291411

Summary: SELinux is preventing /usr/sbin/lvm (lvm_t) "write" to .cache (lvm_etc_t)
Product: Red Hat Enterprise Linux 5 Reporter: Andy Loftus <aloftus>
Component: lvm2Assignee: Milan Broz <mbroz>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: low Docs Contact:
Priority: medium    
Version: 5.0CC: agk, dwalsh, dwysocha, heinzm, mbroz, prockai, pvrabec
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2008-0378 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-21 15:39:35 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:

Description Andy Loftus 2007-09-14 18:21:04 UTC
Description of problem:
When I run 'pvcreate /dev/mapper/sdd7_[01]' (which are multipath aliases for /
dev/mapper/dm-[34], respectively), I see this in /var/log/messages:

Sep 14 12:58:32 venom setroubleshoot:      SELinux is preventing /usr/sbin/lvm 
(lvm_t) "write" to .cache (lvm_etc_t).      For complete SELinux messages. run 
sealert -l a4364cd2-25ef-4851-9e81-8760a8e3d9a4

I ran the sealert command specified above and it told me to try running this 
command:
restorecon -v .cache
which failed with the message:
lstat(.cache) failed: No such file or directory




Version-Release number of selected component (if applicable):
lvm2-2.02.16-3.el5
device-mapper-1.02.13-1.el5
device-mapper-multipath-0.4.7-8.el5


How reproducible: Consistent.  I did 'dd if=/dev/zero of=/dev/mapper/<device> 
bs=1024 count=1' to each device, then re-run pvcreate and I get the same 
message.


Steps to Reproduce:
1. pvcreate /dev/mapper/<devicename>
2. 
3. 
  
Actual results: 


Expected results: no SElinux errors


Additional info:  also happens with vgcreate, vgchange, vgdislpay.  Assume it 
will happen with all the LVM cmds.

Comment 1 Daniel Walsh 2007-09-14 21:01:32 UTC
restorecon -R -v /etc/lvm

Should fix the context, but some app is causing it to be written with the wrong
context.

Upstream has fixed this problem by moving the cache file to a subdirectory
Fedora 7 8 and beyond.
/etc/lvm/cache/

Comment 2 Daniel Walsh 2007-10-09 13:58:02 UTC
There is one of two solutions to this problem.  Backport the change from Rawhide
that moves /etc/lvm/.cache to /etc/lvm/cache/.cache or just allow lvm to write
to any of its config files.



Comment 3 Alasdair Kergon 2007-11-02 02:39:33 UTC
Backport.

Comment 4 RHEL Program Management 2007-11-02 02:44:31 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 5 Milan Broz 2008-01-18 00:23:34 UTC
In lvm2-2.02.30-1.el5.

Comment 8 errata-xmlrpc 2008-05-21 15:39:35 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2008-0378.html