Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 511876

Summary: [RHEL 5] nfsnobody uid/gid values incorrectly depend on architecture
Product: Red Hat Enterprise Linux 5 Reporter: Sachin Prabhu <sprabhu>
Component: nfs-utilsAssignee: Steve Dickson <steved>
Status: CLOSED ERRATA QA Contact: yanfu,wang <yanwang>
Severity: medium Docs Contact:
Priority: low    
Version: 5.3CC: dkovalsk, elliott.forney, mercier_jonathan, myamazak, rlerch, simon.matter, syeghiay
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: nfs-utils-1.0.9-54.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 511874
: 744397 (view as bug list) Environment:
Last Closed: 2011-07-21 11:34:34 UTC Type: ---
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: 708918    
Bug Blocks:    

Description Sachin Prabhu 2009-07-15 13:49:14 UTC
+++ This bug was initially created as a clone of Bug #511874 +++

From the nfs-utils .spec file:

# Define the correct unsigned uid value for 32 or 64 bit archs
%ifarch %{all_32bit_archs}
%define nfsnobody_uid   65534
%else
%define nfsnobody_uid   4294967294
%endif

This is incorrect. uid_t is of the same size on both 32 and 64 bit machines. The values for uid/gid for nfsnobody should be the same irrespective of the architecture.

Current values in /etc/passwd are as follows
RHEL 5.3 64 bit
nfsnobody:x:4294967294:4294967294:Anonymous NFS User:/var/lib/nfs:/sbin/nologin

RHEL 5.3 32 bit
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin


--- Additional comment from sprabhu on 2009-07-15 09:44:57 EDT ---

There is another inconsistency on the default anonuid/anongid values used in RHEL 4 and RHEL 5.

On RHEL 4, this is set to (unsigned int) -2 = 4294967294
RHEL 5, it is set to 65534

That issue is being handled separately in bz 497551.

Comment 6 yanfu,wang 2011-06-01 09:20:42 UTC
hi Steve,
There's one related bug 708918 filed now and the bug is blocked for testing, pls resolve the regression ASAP, thanks.

Comment 7 Steve Dickson 2011-06-05 13:42:56 UTC
*** Bug 708918 has been marked as a duplicate of this bug. ***

Comment 9 yanfu,wang 2011-06-15 03:36:10 UTC
hi Steve,
I could reproduce the problem like comment #4, indeed nfsnobody user has not been created when RHEL5.7 has been installed.
Since nfsnobody group is created before, so useradd failed, and add '-g' option into useradd line could fix the issue:
# grep nfsnobody /etc/passwd /etc/group
/etc/group:nfsnobody:x:65534:
# /usr/sbin/useradd -l -c "Anonymous NFS User" -r -s /sbin/nologin -u 65534 -d
/var/lib/nfs nfsnobody 
useradd: group nfsnobody exists - if you want to add this user to that group,
use -g.

For your test steps, since you remove the nfs-utils package first, the nfsnobody user and group gone, so you can't reproduce the problem. Pls use Masayoshi Yamazaki test steps to reproduce, and the fix is easy.

Comment 11 yanfu,wang 2011-06-21 06:14:13 UTC
pls check comment #9

Comment 12 Steve Dickson 2011-06-21 13:10:39 UTC
(In reply to comment #9)
> hi Steve,
> I could reproduce the problem like comment #4, indeed nfsnobody user has not
> been created when RHEL5.7 has been installed.
> Since nfsnobody group is created before, so useradd failed, and add '-g' option
> into useradd line could fix the issue:
> # grep nfsnobody /etc/passwd /etc/group
> /etc/group:nfsnobody:x:65534:
> # /usr/sbin/useradd -l -c "Anonymous NFS User" -r -s /sbin/nologin -u 65534 -d
> /var/lib/nfs nfsnobody 
> useradd: group nfsnobody exists - if you want to add this user to that group,
> use -g.
> 
> For your test steps, since you remove the nfs-utils package first, the
> nfsnobody user and group gone, so you can't reproduce the problem. Pls use
> Masayoshi Yamazaki test steps to reproduce, and the fix is easy.
Yes I did remove the package which indeed removed the nfsnobody user.
But, I added back nfsnobody with the useradd command and then I
reinstall the package with out error...

Comment 15 yanfu,wang 2011-06-22 02:19:39 UTC
(In reply to comment #12)
> (In reply to comment #9)
> > hi Steve,
> > I could reproduce the problem like comment #4, indeed nfsnobody user has not
> > been created when RHEL5.7 has been installed.
> > Since nfsnobody group is created before, so useradd failed, and add '-g' option
> > into useradd line could fix the issue:
> > # grep nfsnobody /etc/passwd /etc/group
> > /etc/group:nfsnobody:x:65534:
> > # /usr/sbin/useradd -l -c "Anonymous NFS User" -r -s /sbin/nologin -u 65534 -d
> > /var/lib/nfs nfsnobody 
> > useradd: group nfsnobody exists - if you want to add this user to that group,
> > use -g.
> > 
> > For your test steps, since you remove the nfs-utils package first, the
> > nfsnobody user and group gone, so you can't reproduce the problem. Pls use
> > Masayoshi Yamazaki test steps to reproduce, and the fix is easy.
> Yes I did remove the package which indeed removed the nfsnobody user.
> But, I added back nfsnobody with the useradd command and then I
> reinstall the package with out error...

hi, the reason why you can not reproduce the problem is that you added back
nfsnobody using the useradd command which would create nfsnobody group default
at the same time, so it's not the scenario described in comment #4:
Here is a part of postinstall of nfs-utils-1.0.9-52.el5:
----------------------------------------------------------------------
# Create nfsnobody gid as long as it does not already exist.
cat /etc/group | cut -d':' -f 1 | grep --quiet nfsnobody 2>/dev/null
if [ "$?" -eq 1 ]; then
    /usr/sbin/groupadd -g 65534 nfsnobody 2>/dev/null || :
else
    /usr/sbin/groupmod -g 65534 nfsnobody 2>/dev/null || :
fi

# Create nfsnobody uid as long as it does not already exist.
cat /etc/passwd | cut -d':' -f 1 | grep --quiet nfsnobody 2>/dev/null
if [ "$?" -eq 1 ]; then
        /usr/sbin/useradd -l -c "Anonymous NFS User" -r \
                -s /sbin/nologin -u 65534 -d /var/lib/nfs nfsnobody 2>/dev/null
|| :
else
        /usr/sbin/usermod -u 65534 nfsnobody 2>/dev/null || :
fi
----------------------------------------------------------------------------

In usually case, nfsnobody group is created on the above script. However, if
nfsnobody group exists, useradd on the above will fail if without -g option.
----------------------------------------------------------------------------

If you reserve a RHEL5.7 server from beaker and you will find nfsnobody user is
not existent when you login:
      Beaker Test information:
                         HOSTNAME=sun-x4200-01.rhts.eng.bos.redhat.com
                            JOBID=99944
                         RECIPEID=203569
                    RESULT_SERVER=127.0.0.1:7092
                           DISTRO=RHEL5.7-Server-20110615.0
                     ARCHITECTURE=i386
**  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **
[root@sun-x4200-01 ~]# id nfsnobody
id: nfsnobody: No such user
[root@sun-x4200-01 ~]# grep nfsnobody /etc/passwd /etc/group
/etc/group:nfsnobody:x:65534:

Comment 19 yanfu,wang 2011-06-23 05:58:55 UTC
verified against nfs-utils-1.0.9-54.el5 on i386 and x86_64:
[root@intel-sugarbay-DH-02 ~]# rpm -Uvh nfs-utils-1.0.9-54.el5.i386.rpm 
Preparing...                ########################################### [100%]
   1:nfs-utils              ########################################### [100%]
[root@intel-sugarbay-DH-02 ~]# id nfsnobody
uid=65534(nfsnobody) gid=65534(nfsnobody) groups=65534(nfsnobody) context=root:system_r:unconfined_t:SystemLow-SystemHigh

Comment 20 errata-xmlrpc 2011-07-21 11:34:34 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-1048.html

Comment 21 Elliott Forney 2011-07-22 20:54:16 UTC
It looks like this patch changed the GID for nfsnobody to 65534 but didn't change the default group for the nfsnobody user:

# grep nfsnobody /etc/passwd
nfsnobody:x:65534:4294967294:Anonymous NFS User:/var/lib/nfs:/sbin/nologin

# grep nfsnobody /etc/group
nfsnobody:x:65534:

Notice that nfsnobody belongs to a non-existent group.

Comment 22 Simon Matter 2011-10-03 12:02:48 UTC
Elliott is right, the updated package results in a mess.
I guess the correct fix would be:

- /usr/sbin/usermod -u 65534 nfsnobody 2>/dev/null || :
+ /usr/sbin/usermod -g nfsnobody -u 65534 nfsnobody 2>/dev/null || :

Simon

Comment 23 yanfu,wang 2011-10-08 05:44:02 UTC
(In reply to comment #22)
> Elliott is right, the updated package results in a mess.
> I guess the correct fix would be:
> 
> - /usr/sbin/usermod -u 65534 nfsnobody 2>/dev/null || :
> + /usr/sbin/usermod -g nfsnobody -u 65534 nfsnobody 2>/dev/null || :
> 
> Simon

pls file a bug for rhel5.8? developer may deal with it in rhel5.8.

Comment 24 yanfu,wang 2011-10-18 06:33:51 UTC
confirm the issue isn't existent in RHEL5.7 package:
      Beaker Test information:
                         HOSTNAME=intel-chiefriver-02.lab.bos.redhat.com
                            JOBID=144592
                         RECIPEID=300704
                    RESULT_SERVER=127.0.0.1:7086
                           DISTRO=RHEL5-Server-U7
                     ARCHITECTURE=x86_64
**  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **
[root@intel-chiefriver-02 ~]# id nfsnobody
uid=65534(nfsnobody) gid=65534(nfsnobody) groups=65534(nfsnobody) context=root:system_r:unconfined_t:SystemLow-SystemHigh
[root@intel-chiefriver-02 ~]# grep nfsnobody /etc/passwd
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
[root@intel-chiefriver-02 ~]# grep nfsnobody /etc/group
nfsnobody:x:65534:
[root@intel-chiefriver-02 ~]# rpm -qa|grep nfs-utils
nfs-utils-lib-1.0.8-7.6.el5
nfs-utils-1.0.9-54.el5

Comment 25 Simon Matter 2011-10-18 06:52:04 UTC
For new installs, nfs-utils-1.0.9-54.el5 is fine, but for updates it does not correct the gid of user nfsnobody, only the uid is fixed/changed. That means nfs-utils-1.0.9-54.el5 is broken and should be fixed.

Comment 26 yanfu,wang 2011-10-18 11:13:01 UTC
(In reply to comment #25)
> For new installs, nfs-utils-1.0.9-54.el5 is fine, but for updates it does not
> correct the gid of user nfsnobody, only the uid is fixed/changed. That means
> nfs-utils-1.0.9-54.el5 is broken and should be fixed.

hi,
Thanks for your reporting the issue, I've filed a bug to track the issue, see https://bugzilla.redhat.com/show_bug.cgi?id=746948