Linux : Yum/rpm broken upgrading from CentOS/RHEL 7.3 to 7.4 (error: Failed to initialize NSS library)

By | September 6, 2017

You probably experienced the following issue, running “Yum update” on a RHEL 7.3 system :

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

Apparently, some component updated are “out of sync” in term of version with existing, non-updated components of the system.

To resolve this issue, you need to invoke yum with “libnspr4” shared object, upgrading nspr.

1. Download libnspr4 shared object :

www.itechlounge.net/softwares/rhel/libnspr4.so_.tar.bz2

Alternate link (subscription required) : https://access.redhat.com/node/3134931/40/0

2. Unpack it :

tar -jxvf libnspr4.so_.tar.bz2

3. Invoke Yum with it :

LD_PRELOAD=./libnspr4.so yum update nspr

Yum should be working now.