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 2176337 - systemd upgrade should not forcibly add 'systemd' in passwd nsswitch.conf
Summary: systemd upgrade should not forcibly add 'systemd' in passwd nsswitch.conf
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: systemd
Version: 9.1
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Jacek Migacz
QA Contact: Frantisek Sumsal
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-03-08 01:38 UTC by Ding-Yi Chen
Modified: 2023-11-07 11:31 UTC (History)
3 users (show)

Fixed In Version: systemd-252-16.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-07 08:54:03 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Gitlab redhat/centos-stream/rpms systemd merge_requests 78 0 None merged spec: Append 'systemd' to nsswitch.conf only during install 2023-05-29 11:36:16 UTC
Red Hat Bugzilla 1577250 0 unspecified CLOSED systemd-libs modifies /etc/nsswitch.conf in scriptlets which conflicts with authselect on Fedora 28 2023-03-08 01:57:26 UTC
Red Hat Issue Tracker RHELPLAN-151008 0 None None None 2023-03-08 01:40:21 UTC
Red Hat Product Errata RHBA-2023:6640 0 None None None 2023-11-07 08:54:28 UTC

Description Ding-Yi Chen 2023-03-08 01:38:54 UTC
Description of problem:

post script of systemd forcily append of `systemd` in following databases

- passwd
- group

While the behavior make sense for initial installation, but not necessary for upgrade. Some customers need to use their own nsswitch.conf, and would not want it to be modified by systemd upgrade script.


Quote Pavel Březina from https://bugzilla.redhat.com/show_bug.cgi?id=1577250#c7

> Do you actually need to run it during upgrade?
> Wouldn't it be sufficient to run it only during first installation?


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

systemd-250-12.el9_1.1.x86_64

How reproducible:

always


Steps to Reproduce:
1. Edit /etc/nsswitch.conf, and make the passwd line become: 
 
   passwd: sss files
2. Upgrade systemd
3. grep passwd /etc/nsswitch.conf

Actual results:

systemd is forcibly appended 

passwd: sss files systemd

Expected results:

the passwd line is untouched

passwd: sss files

Additional info:

Work around:

Instead of removing systemd keywords, comment them out like

 
passwd:     files sss # systemd
group:      files sss # systemd


================ systemd post script
# rpm -q --scripts systemd-libs
postinstall scriptlet (using /bin/sh):


function mod_nss() {
    if [ -f "$1" ] ; then
        # Add nss-systemd to passwd and group
        grep -E -q '^(passwd|group):.* systemd' "$1" ||
        sed -i.bak -r -e '
                s/^(passwd|group):(.*)/\1:\2 systemd/
                ' "$1" &>/dev/null || :
    fi
}

FILE="$(readlink /etc/nsswitch.conf || echo /etc/nsswitch.conf)"
if [ "$FILE" = "/etc/authselect/nsswitch.conf" ] && authselect check &>/dev/null; then
        mod_nss "/etc/authselect/user-nsswitch.conf"
        authselect apply-changes &> /dev/null || :
else
        mod_nss "$FILE"
        # also apply the same changes to user-nsswitch.conf to affect
        # possible future authselect configuration
        mod_nss "/etc/authselect/user-nsswitch.conf"
fi
...

Comment 1 Pavel Březina 2023-03-29 08:42:25 UTC
Does systemd still touch the nsswitch.conf on its own? AFAIK I removed the scriptlets in Fedora 37... This can be left on authselect, so it shouldn't be necessary to run any scriptlet on systemd side.

See: https://fedoraproject.org/wiki/Changes/Make_Authselect_Mandatory

Comment 2 Pavel Březina 2023-03-29 08:46:48 UTC
Ah, this is RHEL, the authselect change is not yet there. In that case, probably touching nsswitch.conf only on first install should be sufficient to avoid overriding user changes.

Comment 8 errata-xmlrpc 2023-11-07 08:54:03 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:6640


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