RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1583241 - setroubleshoot-server dies trying to open SELinux policy file /sys/fs/selinux/policy
Summary: setroubleshoot-server dies trying to open SELinux policy file /sys/fs/selinux...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: setroubleshoot
Version: 7.5
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Vit Mojzis
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-28 14:22 UTC by Renaud Métrich
Modified: 2024-03-25 15:05 UTC (History)
6 users (show)

Fixed In Version: setroubleshoot-3.2.30-6.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-08-06 13:00:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:2168 0 None None None 2019-08-06 13:00:47 UTC

Description Renaud Métrich 2018-05-28 14:22:48 UTC
Description of problem:

Sometimes, if the /sys/fs/selinux/policy file is already being processed by some other tool (e.g. "seinfo"), setroubleshootd daemon fails to start with "server.py:702:RunFaultServer:ValueError: unable to open /sys/fs/selinux/policy:  Device or resource busy"


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

setroubleshoot-server-3.2.29-3.el7


How reproducible:

Often using the reproducer below:


Steps to Reproduce:
1. In a terminal, run "seinfo" in loop

  # while :; do seinfo; done

2. In the GUI, start the SELinux Troubleshooter applet ("sealert")

Actual results:

# abrt-cli ls
id 4b008c272b2d6c24b3378be400d4912e7aaae210
reason:         server.py:702:RunFaultServer:ValueError: unable to open /sys/fs/selinux/policy:  Device or resource busy
time:           Mon 28 May 2018 04:17:13 PM CEST
cmdline:        /usr/bin/python -Es /usr/sbin/setroubleshootd -f ''
package:        setroubleshoot-server-3.2.29-3.el7
uid:            995 (setroubleshoot)
Directory:      /var/spool/abrt/Python-2018-05-28-16:17:13-3416
Run 'abrt-cli report /var/spool/abrt/Python-2018-05-28-16:17:13-3416' for creating a case in Red Hat Customer Portal

The Autoreporting feature is disabled. Please consider enabling it by issuing
'abrt-auto-reporting enabled' as a user with root privileges


Expected results:

More tries opening the file?

Comment 2 Petr Lautrbach 2018-05-29 06:46:30 UTC
I guess you can't avoid some kind of backtrace on one or other side in these situations. But we could race to who will get the file first during pre-defined timeout like this:

diff --git a/framework/src/setroubleshoot/server.py b/framework/src/setroubleshoot/server.py
index e320ae2..b491578 100755
--- a/framework/src/setroubleshoot/server.py
+++ b/framework/src/setroubleshoot/server.py
@@ -698,8 +698,18 @@ def goodbye(database):
     audit2why.finish()
 
 def RunFaultServer(timeout=10):
-    # FIXME
-    audit2why.init()
+
+    signal.alarm(timeout)
+    while True:
+        try:
+            audit2why.init()
+            signal.alarm(0)
+            break
+        except ValueError as e:
+            if "Device or resource busy" in str(e):
+                continue
+            raise e
+
     global host_database, analysis_queue, email_recipients
 
     signal.signal(signal.SIGHUP, sighandler)

Comment 14 errata-xmlrpc 2019-08-06 13:00:39 UTC
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.

https://access.redhat.com/errata/RHBA-2019:2168


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