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 1839753 - "Failed to reset fd limit before activating service: org.freedesktop.DBus.Error.AccessDenied: Failed to restore old fd limit: Operation not permitted" messages
Summary: "Failed to reset fd limit before activating service: org.freedesktop.DBus.Err...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: dbus
Version: 8.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: 8.0
Assignee: David King
QA Contact: Petr Schindler
URL:
Whiteboard:
Depends On:
Blocks: 1942052 1942054
TreeView+ depends on / blocked
 
Reported: 2020-05-25 12:52 UTC by Renaud Métrich
Modified: 2024-03-25 15:58 UTC (History)
27 users (show)

Fixed In Version: dbus-1.12.8-13.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1942052 1942054 (view as bug list)
Environment:
Last Closed: 2021-11-09 19:31:44 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 5167301 0 None None None 2020-10-07 00:35:50 UTC
Red Hat Product Errata RHBA-2021:4365 0 None None None 2021-11-09 19:31:56 UTC

Description Renaud Métrich 2020-05-25 12:52:13 UTC
Description of problem:

On RHEL 8.2 workstations, while logged in as root user, as soon as the root user executes a program that spawns a dbus service behind (e.g. "SELinux Troubleshooter"), the following message is seen in the journal, at Warning level:
"
Failed to reset fd limit before activating service: org.freedesktop.DBus.Error.AccessDenied: Failed to restore old fd limit: Operation not permitted
"

From DBus code, the message appears when DBus daemon's child tries to restore limits. This has no impact but is confusing to the users.

dbus-1.12.8/bus/activation.c:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
1711 static void
1712 child_setup (void *user_data)
1713 {
1714 #ifdef DBUS_UNIX
1715   BusActivation *activation = user_data;
1716   DBusRLimit *initial_fd_limit;
1717   DBusError error;
1718 
1719   dbus_error_init (&error);
1720   initial_fd_limit = bus_context_get_initial_fd_limit (activation->context);
1721 
1722   if (initial_fd_limit != NULL &&
1723       !_dbus_rlimit_restore_fd_limit (initial_fd_limit, &error))
1724     {
1725       /* unfortunately we don't actually know the service name here */
1726       bus_context_log (activation->context,
1727                        DBUS_SYSTEM_LOG_WARNING,
1728                        "Failed to reset fd limit before activating "
1729                        "service: %s: %s",
1730                        error.name, error.message);
1731     }
1732 #endif
1733 }
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

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

dbus-1.12.8-9.el8.x86_64


How reproducible:

Always


Steps to Reproduce:
1. Login as the root user in the GUI
2. Execute SELinux Troubleshooter (under Sundry folder)

Actual results:

Strace of dbus daemon shows:

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
3212  14:45:15.878851 prlimit64(0, RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=256*1024}, NULL) = -1 EPERM (Operation not permitted) <0.000020>
3212  14:45:15.879102 sendto(20<UNIX:[25770->6756]>, "<28>May 25 14:45:15 dbus-daemon[3212]: [system] Failed to reset fd limit before activating service: org.freedesktop.DBus.Error.AccessDenied: Failed to restore old fd limit: Operation not permitted", 196, MSG_NOSIGNAL, NULL, 0) = 196 <0.001304>

3212  14:45:15.880540 execve("//usr/libexec/dbus-1/dbus-daemon-launch-helper", ["//usr/libexec/dbus-1/dbus-daemon-launch-helper", "org.fedoraproject.Setroubleshootd"], ["DBUS_SYSTEM_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket,guid=1514dcc38e0d60fe80fc0bd85ecbbcd6", "DBUS_STARTER_BUS_TYPE=system", "JOURNAL_STREAM=9:24942", "SYSTEMD_NSS_BYPASS_BUS=1", "DBUS_STARTER_ADDRESS=unix:path=/run/dbus/system_bus_socket,guid=1514dcc38e0d60fe80fc0bd85ecbbcd6", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin", "INVOCATION_ID=aa6f0e519c5944a48b82802b25a7928d", "LANG=en_US.UTF-8"]) = 0 <0.003668>
...
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------


Expected results:

No message if this is a false positive, or a proper way of setting the NOFILE limit if this is necessary.

Comment 5 David King 2020-08-17 13:47:27 UTC
prlimit() can fail with EPERM for a few reasons, but this could be that dbus-daemon does not have the CAP_SYS_RESOURCE capability set, or that the fd limit hard limit is attempting to be raised above the limit in /proc/sys/fs/nr_open, or some other manifestation of the calling process not being able to set the limits. Can you confirm that dbus-daemon has CAP_SYS_RESOURCE? Can you also confirm that this problem also occurs when running a regular (non-root user) dbus session bus?

Comment 10 Jason Edgecombe 2020-09-09 18:03:27 UTC
FYI, running the following commands made the log message go away for me:

    sed -e 's/.*DefaultLimitNOFILE=.*/DefaultLimitNOFILE=4096/g' /etc/systemd/system.conf
    reboot

The solution might be overkill, but I'll leave it to someone else to refine it. I usually increase the open file limit anyway, so it works for me.

Comment 11 Jason Edgecombe 2020-09-09 19:27:20 UTC
Oops, the correct sed command is "sed -i 's/.*DefaultLimitNOFILE=.*/DefaultLimitNOFILE=4096/g' /etc/systemd/system.conf' (replace "-e" with "-i")

The correct commands are:

    sed -i 's/.*DefaultLimitNOFILE=.*/DefaultLimitNOFILE=4096/g' /etc/systemd/system.conf
    reboot

Comment 12 Emmanuel Kasper 2020-09-16 13:40:13 UTC
After reading Jason's comment, I noticed that the LimitNOFILE systemd property for dbus seems to have change between 8.1 and 8.2.

$ grep ^VERSION= /etc/os-release 
VERSION="8.1 (Ootpa)
systemctl show dbus  --property=LimitNOFILE
LimitNOFILE=4096

grep ^VERSION= /etc/os-release
VERSION="8.2 (Ootpa)"
systemctl show dbus  --property=LimitNOFILE
LimitNOFILE=262144

could it be related to this warning ?

Comment 16 David King 2020-12-07 15:32:03 UTC
If the defaults for the number of open files changed between 8.1 and 8.2, that could be the culprit, but the prlimit() call in comment #0 seems to have a valid soft and hard limit according to those default limits, and as I mentioned in comment #5, there are several reasons for a failure with a code of EPERM. As the new hard limit seems to be the same as the initial limit, it suggests that either the call is from an unprivileged process (which cannot raise the hard limit, so is presumably missing CAP_SYS_RESOURCE) or there is some other mechanism preventing the call.

Comment 36 Bill Sanford 2021-04-16 16:46:52 UTC
Verified with dbus-1.12.8-13

A tail of the journalctl shows:

Apr 16 12:37:02 localhost.localdomain dbus-daemon[56623]: [session uid=0 pid=56623] Activating service name='org.fedoraproject.Setroubleshootd' requested by ':1.91' (uid=0 pid=57743 comm="/usr/libexec/platform-python -Es /usr/bin/sealert " label="unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023")
Apr 16 12:37:03 localhost.localdomain dbus-daemon[56623]: [session uid=0 pid=56623] Successfully activated service 'org.fedoraproject.Setroubleshootd'
Apr 16 12:37:03 localhost.localdomain dbus-daemon[930]: [system] Activating service name='org.fedoraproject.Setroubleshootd' requested by ':1.943' (uid=0 pid=57746 comm="/usr/libexec/platform-python -Es /usr/bin/sealert " label="unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023") (using servicehelper)
Apr 16 12:37:03 localhost.localdomain dbus-daemon[930]: [system] Successfully activated service 'org.fedoraproject.Setroubleshootd'

Comment 39 errata-xmlrpc 2021-11-09 19:31:44 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 (dbus bug fix and enhancement update), 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-2021:4365


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