Bug 2215604 - useradd/groupmod errors do not terminate %pre script with errors
Summary: useradd/groupmod errors do not terminate %pre script with errors
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Fast Datapath
Classification: Red Hat
Component: openvswitch2.17
Version: FDP 22.L
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: ---
Assignee: Timothy Redaelli
QA Contact: Rick Alongi
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-06-16 18:11 UTC by ovs-bugzilla
Modified: 2023-07-06 19:17 UTC (History)
3 users (show)

Fixed In Version: openvswitch2.17-2.17.0-92.el9fdp
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-07-06 19:17:41 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FD-2956 0 None None None 2023-06-16 18:11:35 UTC
Red Hat Product Errata RHBA-2023:3988 0 None None None 2023-07-06 19:17:54 UTC

Description ovs-bugzilla 2023-06-16 18:11:13 UTC
+++ This bug was initially created as a clone of Bug #2193168 +++

We have observed that ppc64le RHCOS builds fail to modify the hugetlbfs group to add the openvswitch user, which causes OVS startup to fail because it cannot chown directories to the right group/user.

This appears to be because RPM's /bin/sh does not "set -e" and therefore errors returned by useradd/groupadd/usermod get ignored and do not terminate the %pre script.

%pre
getent group openvswitch >/dev/null || groupadd -r openvswitch
getent passwd openvswitch >/dev/null || \
    useradd -r -g openvswitch -d / -s /sbin/nologin \
    -c "Open vSwitch Daemons" openvswitch

%ifarch %{dpdkarches}
    getent group hugetlbfs >/dev/null || groupadd hugetlbfs
    usermod -a -G hugetlbfs openvswitch
%endif
exit 0

This causes issues like:

[2023-05-02T18:30:05.713Z] openvswitch3.1.prein: usermod.rpmostreesave: /etc/passwd.6: lock file already used
[2023-05-02T18:30:05.713Z] openvswitch3.1.prein: usermod.rpmostreesave: cannot lock /etc/passwd; try again later.

If we add "|| exit 1" behind those it'll supposedly help surface errors.

Comment 1 ovs-bugzilla 2023-06-16 18:11:15 UTC
* Fri Jun 16 2023 Timothy Redaelli <tredaelli> - 2.17.0-92
- redhat: Use sysusers instead of useradd/groupadd directly [RH git: aeeb5c020a] (#2193168)
    Reported-at: https://bugzilla.redhat.com/2193168
    Reported-by: Dan Williams <dcbw>
    Signed-off-by: Timothy Redaelli <tredaelli>

Comment 4 Rick Alongi 2023-07-05 12:27:59 UTC
Marking BZ Verified per https://bugzilla.redhat.com/show_bug.cgi?id=2193168#c13.

Comment 6 errata-xmlrpc 2023-07-06 19:17:41 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 (openvswitch2.17 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:3988


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