error: Failed to initialize NSS library
Solution 1
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 2
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 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
Solution 4
@Christian everything works but you need a fresh download link http://rpm.pbone.net/index.php3/stat/4/idpl/36086786/dir/scientific_linux_7/com/nspr-4.13.1-1.0.el7_3.x86_64.rpm.html
Puneet Dixit
Updated on September 18, 2022Comments
-
Puneet Dixit about 1 year
I am getting error when installing updates or patches in RHEL-7.7.3..
error: Failed to initialize NSS library
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
cannot import name ts
Please install a package which provides this module, or
verify that the module is installed correctly.
It's possible that the above module doesn't match the
current version of Python, which is:
2.7.5 (default, Aug 2 2016, 04:20:16)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
HOW can I resolve it?
-
metaleap about 6 yearsI got the
.so
but even this gives meerror: Failed to initialize NSS library
. No matter how I attempt to invokednf
,yum
,rpm
, orrpm2cpio
it always errors out with that message. -
ulidtko almost 5 yearsLinks rot. Please be so kind to summarize (using words) the article that you link to.
-
peterh over 4 yearsThis is the correct answer, at least today. Rpm needs some nss libs, and their initialization needs /dev/urandom, probably for some security thing. That is all.
-
brother-bilo almost 3 yearsif you're in a chroot
/dev
is not the only needed path to bind-mount. you'll need/proc
/sys
/dev/pts
see arch linux wiki -
Michael Hampton almost 3 yearsIt also requires a Red Hat subscription to read this content.