Bug 1145981 - Provide utility or macro to add users/groups in %pre of other packages, observing uidgid too
Summary: Provide utility or macro to add users/groups in %pre of other packages, obser...
Alias: None
Product: Fedora
Classification: Fedora
Component: shadow-utils
Version: rawhide
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Tomas Mraz
QA Contact: Fedora Extras Quality Assurance
Depends On:
Blocks: 1213404
TreeView+ depends on / blocked
Reported: 2014-09-24 08:46 UTC by Jan Pazdziora
Modified: 2018-12-20 15:31 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Last Closed: 2018-12-20 15:31:45 UTC
Type: Bug

Attachments (Terms of Use)

Description Jan Pazdziora 2014-09-24 08:46:25 UTC
Description of problem:

Currently, packages that need to create uid/gid are supposed to run useradd/groupadd manually, and for pre-allocated uids/gids even with a bit more complex logic:


(The version as of the time of filing this bugzilla is

It would be good to provide utility which would do this automatically, using values from /usr/share/doc/setup/uidgid (that probably should no longer be %doc but real data file), avoiding the need of hardcoding the uid/gid in all packages that feel they need the user.

Or it could be an rpm macro.

Then the guidelines could be changed to recommend to just call this one utility / macro -- something like

   ensure-user-exists apache


   %ensure-user-exists apache

and packages changed to just do this.

Even better, rpm could this automatically when it would detect files owned by user that does not exist but is defined in uidgid.

Additional benefit would be should the local users start to live somewhere else than in /etc/passwd one day -- possibly in local sssd database. Then this single utility would need to be changed to add the feature or enhance it, rather than multiple .spec files.

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

and Packaging:UsersAndGroups as of today

How reproducible:


Steps to Reproduce:
1. Try to ensure user exists for your packages (bug 1143067 or bug 1143067).
2. Read the Packaging:UsersAndGroups.
3. Wonder if this is the easiest way to do it.

Actual results:

It's not that easy.

Expected results:

It's very easy.

Additional info:

Comment 1 Jan Pazdziora 2014-09-24 08:51:25 UTC
A good partial step could be for useradd/groupadd with -r and without -u/-g to observe uidgid and use those values if no clashing record yet exists, instead of going down from 999. That would also lead to gradual consolidation of installations to use the pre-allocated uids/gids.

Comment 2 Jan Pazdziora 2014-09-24 08:52:17 UTC
(In reply to Jan Pazdziora from comment #0)
> 1. Try to ensure user exists for your packages (bug 1143067 or bug 1143067).

I meant to write bug 1143066 or bug 1143067 here.

Comment 3 Fedora End Of Life 2015-05-29 12:57:11 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. 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 Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 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, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 Tomas Mraz 2018-12-20 15:31:45 UTC
I am sorry, we are not going to pursue this RFE at this point. Pagure PRs are always welcome.

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