Getting error "RPC: Can't decode result" on NIS-enabled clients
Environment
- Red Hat Enterprise Linux (RHEL) all versions
- ypbind
Issue
- When trying to perform a particular action on a NIS client server, the following error appears:
yp_all: clnt_call: RPC: Can't decode result
Resolution
Either trim the lines in /etc/group which are longer than 1024 characters, removing users from the group, or split the groups into smaller groups with the same gid. This must be done for all yp-related calls.
Alternatively, a possible workaround is to add the --no-limit-check option to the makedbm command in /var/yp/Makefile, so as to ignore lines longer than 1024 bytes:
- Edit /var/yp/Makefile
-
Change the DBLOAD line:
-DBLOAD = $(YPBINDIR)/makedbm -c -m `$(YPBINDIR)/yphelper --hostname` +DBLOAD = $(YPBINDIR)/makedbm --no-limit-check -c -m `$(YPBINDIR)/yphelper --hostname` -
rebuild maps:
# cd /var/yp # make -
Restart NIS.
Root Cause
An inherent limit in glibc (MAXYPRECORD) states the longest length of a line for NIS:
glibc-2.16-75f0d304/nis/rpcsvc/yp.x:const YPMAXRECORD = 1024;
glibc-2.16-75f0d304/nis/rpcsvc/yp.h:#define YPMAXRECORD 1024
glibc-2.16-75f0d304/nis/rpcsvc/yp_prot.h:#define YPMAXRECORD 1024
When the limit is hit, the response from glibc gets truncated, which in turn causes the RPC error.
Diagnostic Steps
-
Check for the length of lines in /etc/group:
# wc -L /etc/group -
If wc reports more than 1024, any such long lines must be truncated. Additionally, check ypcat against the groups:
# ypcat group.byname
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
