Bug 2028072

Summary: installation of dhcp-server reports warning with uid outside of SYS_UID_MIN 201 and SYS_UID_MAX 999
Product: [Fedora] Fedora Reporter: Lukas Herbolt <lherbolt>
Component: dhcpAssignee: Martin Osvald 🛹 <mosvald>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 35CC: jorton, mosvald, pavel, pemensik
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2068108 (view as bug list) Environment:
Last Closed: 2022-08-04 07:32:06 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:
Bug Depends On:    
Bug Blocks: 2068108    

Description Lukas Herbolt 2021-12-01 12:47:18 UTC
Description of problem:
When install dhcp-server the instalation proces reports:
Running transaction
  Preparing        :                                                                                                                                                                                       1/1 
  Running scriptlet: dhcp-server-12:4.4.2-16.b1.fc35.x86_64                                                                                                                                                1/1 
useradd warning: dhcpd's uid 177 outside of the SYS_UID_MIN 201 and SYS_UID_MAX 999 range.


Version-Release number of selected component (if applicable):
dhcp-server-12:4.4.2-16.b1.fc35.x86_64

How reproducible:
every time

Steps to Reproduce:
1. fresh install fedora 35
2. install dhcp-server 


Actual results:
dhcpd user with uid 177 is created

Expected results:
dhcpd user within allowed range is created

Additional info:

Comment 1 Martin Osvald 🛹 2022-02-15 14:09:12 UTC
(In reply to Lukas Herbolt from comment #0)
...
> Expected results:
> dhcpd user within allowed range is created

This is not a bug, but intended behavior. UID/GID 177 for dhcpd has been reserved for a very long time as for the other services mentioned in the following file:

~~~
$ egrep 'dhcp|UID' /usr/share/doc/setup*/uidgid
NAME    UID     GID     HOME            SHELL   PACKAGES
dhcpd   177     177     /               /sbin/nologin   dhcp
$
~~~

When looking at how some of the other services solve this:

~~~
/usr/sbin/useradd -g 23 -u 23 -d /var/spool/squid -r -s /sbin/nologin squid >/dev/null 2>&1 || exit 1
/usr/sbin/useradd  -u %{bind_uid} -r -N -M -g named -s /sbin/nologin -d /var/named -c Named named >/dev/null 2>&1 || :;
/usr/sbin/useradd -M -N -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \
	-c "PostgreSQL Server" -u 26 postgres >/dev/null 2>&1 || :
~~~

They simply redirect useradd/groupadd output into /dev/null and I will do the same in the next dhcp update.

Comment 2 Martin Osvald 🛹 2022-02-17 13:02:50 UTC
Noticed this old squid BZ:

Bug 118718 - RPM install doesn't stop in case of user can' be added

which means that those who simply redirect to /dev/null might get into problems and miss reporting the error to the user e.g. when the passwd db file is locked (/etc/passwd.lock exists).

Just fixed the same issue for cyrus-imapd and the below allows filtering out the warning message, to see the other possible errors and exit on them:

~~~
 %pre
+# /bin/sh does not declare it before the first use
+PIPESTATUS=( 0 )
 # Create 'cyrus' user on target host
 getent group saslauth >/dev/null || /usr/sbin/groupadd -g %gid -r saslauth
 getent passwd cyrus >/dev/null || /usr/sbin/useradd -c "Cyrus IMAP Server" -d /var/lib/imap -g %cyrusgroup \
-  -G saslauth -s /sbin/nologin -u %uid -r %cyrususer
+  -G saslauth -s /sbin/nologin -u %uid -r %cyrususer 2>&1 | grep -v 'outside of the SYS_UID_MIN' | tee
+# exit if useradd fails
+if [ ${PIPESTATUS[0]} -ne 0 ]; then exit 1; fi
~~~

Comment 3 Martin Osvald 🛹 2022-08-04 07:32:06 UTC
Won't be fixing this. This is rather a cosmetic issue which will get fixed in shadow-utils by:

http://pkgs.devel.redhat.com/cgit/rpms/shadow-utils/commit/?h=rhel-9-main&id=1fa6b1e5d511c256338e427b077886b0f2ef4776

Therefore closing this as NOTABUG.