Bug 2103934 - sysusers rpm macro fails on UID:GID
Summary: sysusers rpm macro fails on UID:GID
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 37
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-07-05 10:27 UTC by Michal Hlavinka
Modified: 2023-12-05 01:09 UTC (History)
13 users (show)

Fixed In Version: systemd-252.2-1.fc38 systemd-251.19-1.fc37
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-12-05 01:09:40 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Michal Hlavinka 2022-07-05 10:27:31 UTC
Description of problem:
When migrating package according to https://fedoraproject.org/wiki/Changes/Adopting_sysusers.d_format

I've created config file with user ID set to UID:GID as specifined in 
ID section of https://www.freedesktop.org/software/systemd/man/sysusers.d.html

but rpm macro tries to create username and group with "UID:GID" name, its not parsing the values

Version-Release number of selected component (if applicable):
systemd-rpm-macros-250.7-1.fc36.noarch

How reproducible:
always

Steps to Reproduce:
1.create usersys config file with:
u     dovecot 97:97 "Dovecot IMAP server"        /usr/libexec/dovecot /sbin/nologin
2. use it for  %sysusers_create_compat macro 


Actual results:
getent group 'dovecot' >/dev/null || groupadd -f -g '97:97' -r 'dovecot' || :
if ! getent passwd 'dovecot' >/dev/null; then
    if ! getent passwd '97:97' >/dev/null; then
        useradd -r -u '97:97' -g 'dovecot' -d '/usr/libexec/dovecot' -s /sbin/nologin -c 'Dovecot IMAP server' 'dovecot' || :
    else
        useradd -r -g 'dovecot' -d '/usr/libexec/dovecot' -s /sbin/nologin -c 'Dovecot IMAP server' 'dovecot' || :
    fi
fi

and obviously  groupadd -f -g '97:97' -r 'dovecot' will fail:
groupadd: invalid group ID '97:97'

same error is for useradd -u '97:97'


Expected results:
groupadd -f -g '97' ...
useradd -r -u 97 -g 97 ....

Additional info:

Comment 1 Frantisek Sumsal 2022-08-12 13:26:36 UTC
It looks like the uid:gid syntax is not yet supported by the sysusers.generate-pre script, that is used in that macro, given the TODO comment here https://src.fedoraproject.org/rpms/systemd/blob/rawhide/f/sysusers.generate-pre.sh#_62.

Reading the script I guess this line should achieve the same thing:

u dovecot 97 "Dovecot IMAP server" /usr/libexec/dovecot /sbin/nologin

since it should get expanded to following calls:

getent group dovecot >/dev/null || groupadd -f -g 97 -r dovecot || :
useradd -r -u 97 -g dovecot -d /usr/libexec/dovecot -s /sbin/nologin -c "Dovecot IMAP server" dovecot || :

(assuming the user doesn't exist).

Comment 2 Ben Cotton 2023-04-25 17:33:23 UTC
This message is a reminder that Fedora Linux 36 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 36 on 2023-05-16.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '36'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 36 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 3 Zbigniew Jędrzejewski-Szmek 2023-04-26 07:24:10 UTC
In F38+, this is supported since systemd-252.2-1.fc38.
I queued the patch for F37 now too.

Comment 4 Aoife Moloney 2023-11-23 00:14:24 UTC
This message is a reminder that Fedora Linux 37 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 37 on 2023-12-05.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '37'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 37 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 5 Fedora Update System 2023-11-27 14:11:07 UTC
FEDORA-2023-1582a08b60 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2023-1582a08b60

Comment 6 Fedora Update System 2023-11-28 02:50:55 UTC
FEDORA-2023-1582a08b60 has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-1582a08b60`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-1582a08b60

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2023-12-05 01:09:40 UTC
FEDORA-2023-1582a08b60 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.


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