getgrgid() differs from glibc when a GID is not found. glibc does not set errno, while the nss_wrapper library sets errno to ENOENT. FWIW, I've also checked musl, which also did not set errno. Demonstrator: #include <stdio.h> #include <sys/types.h> #include <grp.h> #include <errno.h> int main() { gid_t target_gid = 65530; if (getgrgid(target_gid) == NULL) { printf("No GID found, errno: %d\n", errno); } } $ ./test_getgrgid No GID found, errno: 0 $ LD_PRELOAD=/usr/lib64/libnss_wrapper.so NSS_WRAPPER_PASSWD=/etc/passwd NSS_WRAPPER_GROUP=/etc/group ./test_getgrgid No GID found, errno: 2