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 2215925 - Services configured with Delegate=yes and having a ExecStartPost/ExecStopPost command fail
Summary: Services configured with Delegate=yes and having a ExecStartPost/ExecStopPost...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: systemd
Version: 8.8
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: David Tardon
QA Contact: Frantisek Sumsal
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-06-19 12:30 UTC by Renaud Métrich
Modified: 2023-11-14 18:02 UTC (History)
6 users (show)

Fixed In Version: systemd-239-78.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-14 15:48:29 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github redhat-plumbers systemd-rhel8 pull 397 0 None open When Delegate=yes is set for a unit, run ExecStartPre= and friends in a subcgroup of the unit 2023-06-20 08:10:15 UTC
Github systemd systemd pull 10813 0 None Merged make sure ExecStartPre= and Delegate=yes mix well 2023-06-20 07:10:18 UTC
Red Hat Issue Tracker RHELPLAN-160194 0 None None None 2023-06-19 12:32:51 UTC
Red Hat Product Errata RHBA-2023:7097 0 None None None 2023-11-14 15:49:07 UTC

Description Renaud Métrich 2023-06-19 12:30:18 UTC
Description of problem:

A customer reports that his service enabling Delegation (a podman container actually) cannot start properly because it has some ExecStartPost command.
This happens with cgroup unified hierarchy only.
Thanks to his reproducer (see below), I can confirm there is an issue due to having systemd start the ExecStartPost command to root's node, which is not possible and returns EBUSY.

It seems like we need to backport https://github.com/systemd/systemd/pull/10813/files which is related to issue https://github.com/systemd/systemd/issues/10482.

What is weird is that my own reproducer, not using podman but with just delegation and some child hierarchy, doesn't fail for me, so somehow podman must "protect" the hierarchy.

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

systemd-239 up to systemd-239-74.el8_8 included

How reproducible:

Always

Steps to Reproduce:
1. Boot the system with "systemd.unified_cgroup_hierarchy=1"
2. Create a container service unit

  # cat /etc/containers/systemd/delegate_issue.container 
  [Unit]
  Description=The sleep container
  After=local-fs.target
  
  [Service]
  TimeoutStopSec=2
  
  [Container]
  Image=ubi8
  Exec=sleep 1000

3. Reload systemd so that service generation is performed and start then stop the service

  # yum -y install crun
  # systemctl daemon-reload
  # systemctl start delegate_issue.service
  # systemctl stop delegate_issue.service
  # systemctl status delegate_issue.service

Actual results:

● delegate_issue.service - The sleep container
   Loaded: loaded (/etc/containers/systemd/delegate_issue.container; generated)
   Active: failed (Result: timeout) since Mon 2023-06-19 12:53:58 CEST; 2s ago
  Process: 2243 ExecStopPost=/usr/bin/rm -f /run/delegate_issue.cid (code=exited, status=219/CGROUP)
  Process: 2242 ExecStopPost=/usr/bin/podman rm -f -i --cidfile=/run/delegate_issue.cid (code=exited, status=219/CGROUP)
  [...]

Expected results:

Execution of ExecStopPost commands and no failure with 219/CGROUP status

Additional info:

Stracing systemd shows EBUSY on PID 2242, then child of 2242 (2243) fails as well:

# grep -A2 "write(.*/sys/fs/cgroup/system.slice/delegate_issue.service/" /tmp/systemd.strace
[...]
1     12:53:58.754846 write(72</sys/fs/cgroup/system.slice/delegate_issue.service/cgroup.procs>, "2242\n", 5) = -1 EBUSY (Device or resource busy) <0.000006>
2243  12:53:58.764451 write(3</sys/fs/cgroup/system.slice/delegate_issue.service/cgroup.procs>, "2243\n", 5 <unfinished ...>
2243  12:53:58.764467 <... write resumed>) = -1 EBUSY (Device or resource busy) <0.000010>

Comment 1 David Tardon 2023-06-20 08:08:18 UTC
With the upstream fix:

# systemctl status delegate_issue.service
● delegate_issue.service
   Loaded: loaded (/etc/containers/systemd/delegate_issue.container; generated)
   Active: failed (Result: timeout) since Tue 2023-06-20 10:03:43 CEST; 41s ago
  Process: 5435 ExecStopPost=/usr/bin/rm -f /run/delegate_issue.cid (code=exited, status=0/SUCCESS)
  Process: 5392 ExecStopPost=/usr/bin/podman rm -f -i --cidfile=/run/delegate_issue.cid (code=exited, status=0/SUCCESS)
  [...]

Comment 2 Plumber Bot 2023-08-22 11:35:56 UTC
fix merged to github main branch -> https://github.com/redhat-plumbers/systemd-rhel8/pull/397

Comment 7 errata-xmlrpc 2023-11-14 15:48:29 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-2023:7097


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