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 1946453 - Backport upstream commit related to user-runtime-dir@.service
Summary: Backport upstream commit related to user-runtime-dir@.service
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: systemd
Version: 8.3
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Jacek Migacz
QA Contact: Frantisek Sumsal
URL:
Whiteboard:
Depends On:
Blocks: 1990403
TreeView+ depends on / blocked
 
Reported: 2021-04-06 07:40 UTC by Renaud Métrich
Modified: 2021-11-29 10:15 UTC (History)
13 users (show)

Fixed In Version: systemd-239-48.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1990403 (view as bug list)
Environment:
Last Closed: 2021-11-09 19:56:28 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github systemd-rhel rhel-8 pull 179 0 None open (#1946453) Backport upstream commit related to user-runtime-dir@.service 2021-05-25 10:03:05 UTC
Github systemd systemd pull 9791 0 None closed user-runtime-dir@.service fixes 2021-04-06 13:09:57 UTC
Red Hat Knowledge Base (Solution) 5931241 0 None None None 2021-04-06 08:11:43 UTC
Red Hat Product Errata RHBA-2021:4469 0 None None None 2021-11-09 19:56:56 UTC

Description Renaud Métrich 2021-04-06 07:40:51 UTC
Description of problem:

We need to backport commit d06e8fbce35c2b52ee1d09af4888876d5f2d7ae4 related to user-runtime-dir@.service.
This commit makes sure the user-runtime-dir@.service is really done before starting "systemd --user", which is really required or else race conditions happen leading the "systemd --user" failure.


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

systemd-239-41.el8_3.1.x86_64


How reproducible:

Always using a systemtap script

Steps to Reproduce:

1. Create delay_mount_runtimepath.stp that will delay the mount of /run/user/<UID> operation (here below UID 101166)

  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
  probe syscall.mount.call {
  	if (argstr =~ "\"/run/user/101166\"") {
  		delay = 1500 + randint(150)
  		printf("PID %lu (%s) entered '%s(%s)', delaying call by %ld\n", pid(), execname(), name, argstr, delay)
  		mdelay(delay)
  	}
  }
  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

2. Execute the stap script (requires Guru mode)

  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
  # yum -y install systemtap
  # stap-prep
  # stap -g -v ./delay_mount_runtimepath.stp 
  [...]
  Pass 5: starting run.
  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

3. Log in through ssh as the target user

  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
  # ssh rmetrich@localhost true
  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------


Actual results:

- Stap output:

  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
  PID 4281 (systemd-user-ru) entered 'mount("tmpfs", "/run/user/101166", "tmpfs", MS_NOSUID|MS_NODEV, "mode=0700,uid=101166,gid=101166,size=190722048")', delaying call by 1575
  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

- Journal:

  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
  Apr 06 08:57:17.748899 vm-sssd8 systemd[3994]: pam_unix(systemd-user:session): session opened for user rmetrich by (uid=0)
  Apr 06 08:57:19.284443 vm-sssd8 systemd[3994]: Failed to fully start up daemon: Permission denied
  Apr 06 08:57:19.285148 vm-sssd8 systemd[3995]: pam_unix(systemd-user:session): session closed for user rmetrich
  Apr 06 08:57:19.285853 vm-sssd8 systemd[1]: user: Failed with result 'protocol'.
  Apr 06 08:57:19.286015 vm-sssd8 systemd[1]: Failed to start User Manager for UID 101166.
  Apr 06 08:57:19.286443 vm-sssd8 systemd[1]: Stopping /run/user/101166 mount wrapper...
  Apr 06 08:57:19.287687 vm-sssd8 sshd[3991]: pam_systemd(sshd:session): Failed to create session: Start job for unit user failed with 'failed'
  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Expected results:

  No error spawning "systemd --user"

Additional info:

  See also BZ #1945569 for hardening this.

Comment 1 Renaud Métrich 2021-05-17 15:03:27 UTC
We have a few customers hitting this now, apparently using lingering helps hit the issue (probably because of the activity during boot).

Comment 3 Renaud Métrich 2021-05-26 18:42:33 UTC
I think QE can use the reproducer I provided as the test case.

Comment 4 Lukáš Nykrýn 2021-06-22 12:27:17 UTC
fix merged to github master branch -> https://github.com/redhat-plumbers/systemd-rhel8/pull/179

Comment 9 Micah Abbott 2021-06-28 19:00:39 UTC
Requesting a backport to 8.4.z

The RHCOS integration tests are hitting a failure similar to what is described here and would be interested in getting this change into 8.4.z

See https://bugzilla.redhat.com/show_bug.cgi?id=1914362 and https://github.com/coreos/coreos-assembler/pull/2261 for additional context

Comment 10 Jiri Jaburek 2021-07-03 12:09:01 UTC
I've also seen

systemd: user-runtime-dir: Failed with result 'start-limit-hit'.
systemd: Failed to start /run/user/5678 mount wrapper.
systemd: Dependency failed for User Manager for UID 5678.
systemd: user: Job user/start failed with result 'dependency'.
sshd: pam_systemd(sshd:session): Failed to create session: Start job for unit user failed with 'dependency'

on a minimal install of RHEL-8.4.0 @ s390x, which seems to be related to this BZ.

(5678 is an unprivileged UID)

Comment 11 Michal Sekletar 2021-07-31 19:59:21 UTC
Approved z-stream request for RHEL-8.4-z.

Comment 18 errata-xmlrpc 2021-11-09 19:56:28 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 (systemd 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:4469


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