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 2103933

Summary: osbuild-composer cannot add a user with a given gid
Product: Red Hat Enterprise Linux 8 Reporter: Christophe Besson <cbesson>
Component: osbuild-composerAssignee: Image Builder team <osbuilders>
Status: CLOSED NEXTRELEASE QA Contact: Release Test Team <release-test-team-automation>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.6CC: amepatil, atodorov, obudai, prjagtap, sbarcomb, sujagtap, thozza
Target Milestone: rcKeywords: Reproducer, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: osbuild-composer-82-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-10-09 12:09:31 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 Christophe Besson 2022-07-05 10:24:23 UTC
Description of problem:
The documentation mentions we can specify a GID but it does not work.
"""
The GID is optional and must already exist in the image, be created by a package, or be created by the blueprint [[customizations.group]] entry. 
"""

Version-Release number of selected component (if applicable):
osbuild-composer-46.3-1.el8_6.x86_64
osbuild-53-2.el8.noarch

How reproducible:
Always

Steps to Reproduce:
1. Push the below blueprint

name = "unexisting-group"
description = "reproducer unexisting group"
version = "0.0.1"
modules = []
groups = []
distro = ""

[[customizations.group]]
name = "foo"
gid = 9045

[[customizations.user]]
name = "foo"
description = "foo user"
password = "$6$R4EexOTlkvDDwsK8$WkL4pU.JGHSO9LmpI/SMKYbunZU.t7BYLsZs1B9m0SeOH4RBICGlbScNRl0jUri3CBwasAd/sdZMkDp4SGoBq."
home = "/home/foo"
shell = "/usr/bin/bash"
groups = ["foo", "wheel"]
uid = 9045
gid = 9045

2. Compose an image


Actual results:
# composer-cli compose log ca09da9b-2e1f-4d0d-84d6-42d2c767c052 | tail -n17
Stage org.osbuild.users
Output:
[/usr/lib/tmpfiles.d/journal-nocow.conf:26] Failed to resolve specifier: uninitialized /etc detected, skipping
All rules containing unresolvable specifiers will be skipped.
useradd: group '9045' does not exist
Traceback (most recent call last):
  File "/run/osbuild/bin/org.osbuild.users", line 171, in <module>
    r = main(args["tree"], args["options"])
  File "/run/osbuild/bin/org.osbuild.users", line 160, in main
    useradd(tree, name, uid, gid, groups, description, home, shell, password)
  File "/run/osbuild/bin/org.osbuild.users", line 103, in useradd
    subprocess.run(["chroot", root, "useradd", *arguments, name], check=True)
  File "/usr/lib64/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['chroot', '/run/osbuild/tree', 'useradd', '--uid', '9045', '-o', '--gid', '9045', '--groups', 'foo,wheel', '--comment', 'foo user', '--home-dir', '/home/foo', '--create-home', '--shell', '/usr/bin/bash', '--password', '$6$R4EexOTlkvDDwsK8$WkL4pU.JGHSO9LmpI/SMKYbunZU.t7BYLsZs1B9m0SeOH4RBICGlbScNRl0jUri3CBwasAd/sdZMkDp4SGoBq.', 'foo']' returned non-zero exit status 6.

Expected results:
org.osbuild.groups executed before org.osbuild.users ?

Comment 3 Ondřej Budai 2022-11-21 13:19:45 UTC
The group's name currently cannot be the same as the name of the user. Is there an option for you to omit the group customization entirely? The group "foo" should be created anyway, because it's the primary group for the user "foo".

Comment 8 Ondřej Budai 2023-10-09 12:09:31 UTC
The fix will be released in 8.9.