error: Failed to initialize NSS library

Solution 1:

If you're like me, trying to save a server buckled under as-usual-unnecessary package-management force, from a rescue/chroot environment,

— be sure to bind-mount a valid /dev filesystem inside the chroot.

For, as strace -f rpm --help shows, it needs a /dev/urandom.


Enlightenment props go to this GitHub issue which highlighted the /dev/urandom thing which I definitely seen near ENOENT in strace log, but somehow didn't pay attention to. I've bind-mounted /{proc,sys} as well, for good measure. The issue went away; server rescued, yay!

Solution 2:

This could be related to a bug that surfaced yesterday with installing glibc.686 on a new install of RHEL 7.3, which causes both yum and rpm to break. See this Red Hat solutions post. Unfortunately I do not have a solution at the moment on how to fix it after you install glibc.686, however the solution on that page for 7.3 is to install nspr along side of it. You could reinstall RHEL 7.3 or restore from a backup and then run:

yum install glibc.i686 nspr

This supposedly bypasses the issue.

Edit: I was able to get this working on a broken instance of RHEL 7.3 by manually downloading an nspr library and running the following command:

LD_PRELOAD=./libnspr4.so yum update nspr

This will fix your yum and rpm. Good luck.


Solution 3:

The answer which worked for me:

download nspr package from nspr-4.13.1-1.0.el7_3.x86_64.rpm

rpm2cpio nspr-4.13.1-1.0.el7_3.x86_64.rpm | cpio -idmv

LD_PRELOAD=./usr/lib64/libnspr4.so yum update nspr (directory may differ, but should mostly be good)

Problem solved. Thanks for those who gave the clue.

Christian COMMARMOND

Tags:

Rhel7