Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 2218242

Summary: The systemd-sysusers file triggers do not work when building container images
Product: Red Hat Enterprise Linux 9 Reporter: Jan Pazdziora (Red Hat) <jpazdziora>
Component: systemdAssignee: systemd maint <systemd-maint>
Status: CLOSED MIGRATED QA Contact: Frantisek Sumsal <fsumsal>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: CentOS StreamCC: bstinson, dtardon, jwboyer, systemd-maint-list
Target Milestone: rcKeywords: Improvement, MigratedToJIRA, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-21 15:33:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jan Pazdziora (Red Hat) 2023-06-28 14:13:45 UTC
Description of problem:

When building container images and the package brings sysusers.d definitions, it'd be good if the transfiletriggerin scriptlet kicked-in and worked, like it does when installing package on a host. That would help in situations when the %sysusers_create_compat mechanism fails to work, for example see bug 2218209.

Unlike in Fedora (https://src.fedoraproject.org/rpms/systemd/blob/rawhide/f/triggers.systemd) and upstream (https://github.com/systemd/systemd/blob/5d97475b270ed7651e1610e908c23ef65b62bbc4/src/rpm/triggers.systemd.sh.in), CentOS Stream (https://gitlab.com/redhat/centos-stream/rpms/systemd/-/blob/c9s/triggers.systemd) wraps the invocation of systemd-sysusers with the

  if test -d "/run/systemd/system"; then
    %{_bindir}/systemd-sysusers || :
  fi

check. When building a container image, such directory does not exist because systemd is not running.

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

systemd-252-15.el9.x86_64

How reproducible:

Deterministic.

Steps to Reproduce:
1. On host, install 389-ds-base which has the bug 2218209 problem:
   # dnf install -y 389-ds-base
2. # grep dirsrv /etc/passwd
3. Try the same in container:
   $ podman run --rm quay.io/centos/centos:stream9 bash -c 'dnf install -y 389-ds-base && grep dirsrv /etc/passwd'

Actual results:

On the host:

[...]

  Installing       : 389-ds-base-2.3.4-2.el9.x86_64                                                                                                   2/2 
  Running scriptlet: 389-ds-base-2.3.4-2.el9.x86_64                                                                                                   2/2 
useradd: invalid user ID '389:389'

Creating user 'dirsrv' (user for 389-ds-base) with UID 389 and GID 389.

  Verifying        : 389-ds-base-2.3.4-2.el9.x86_64                                                                                                   1/2 

[...]

dirsrv:x:389:389:user for 389-ds-base:/usr/share/dirsrv:/sbin/nologin

In container:

  Installing       : python3-lib389-2.3.4-2.el9.noarch                  149/151 
  Installing       : 389-ds-base-2.3.4-2.el9.x86_64                     150/151 
  Running scriptlet: 389-ds-base-2.3.4-2.el9.x86_64                     150/151 
useradd: invalid user ID '389:389'

  Installing       : rpm-plugin-selinux-4.16.1.3-23.el9.x86_64          151/151 
  Running scriptlet: nss-3.79.0-18.el9.x86_64                           151/151 
  Running scriptlet: selinux-policy-targeted-38.1.15-1.el9.noarch       151/151 

and the grep does not find the line in /etc/passwd.

Expected results:

I'd expect even in the container case that

Creating user 'dirsrv' (user for 389-ds-base) with UID 389 and GID 389.

line to be shown, indicating that the systemd-sysusers trigger got invoked and run. It is possible to force that to happen with

podman run --rm quay.io/centos/centos:stream9 bash -c 'mkdir -p /run/systemd/system && dnf install -y 389-ds-base && grep dirsrv /etc/passwd'

but it is a workaround and it also enables other triggers like sysctl that are likely correctly disabled in containers.

Additional info:

Comment 1 David Tardon 2023-06-29 07:26:41 UTC
@jamacku: triggers.systemd is another file we haven't copied from Fedora during the rebase. Since you're already handling bug 2217149, could you do this one as well?

(There's yet another file that's been changed: sysusers.prov . But I'm pretty sure we don't need https://src.fedoraproject.org/rpms/systemd/c/21ca64d8e065c231b21f6b2a23e4c4c7e681add4 .)

Comment 2 RHEL Program Management 2023-09-21 15:29:38 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 3 RHEL Program Management 2023-09-21 15:33:27 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.