It's an Amazon RHEL server and I deleted the libnss by running

rpm --nodeps -e nss-*;
package-cleanup --cleandupes;

Now when I run rpm I get an error:

rpm: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

And the same error with yum:

libnss3.so: cannot open shared object file: No such file or directory

How can I reinstall libnss now?

  • Just so we're clear, this is neither rpm's nor yum's fault. There is a reason why dependencies exist, and there is a proper procedure for reinstalling a package that is already installed. Mar 19 '18 at 23:28
  • yes.But I can not run either rpm or yum now.
    – Zack
    Mar 19 '18 at 23:36
  • Why can't you run yum or rpm? Mar 20 '18 at 1:03
  • @NasirRiley: Guess what dependency they both have. Mar 20 '18 at 1:51
  • 1
    @Nasir I very much doubt Amazon will fix this for the OP... Mar 20 '18 at 9:36

You’ll need to download the necessary packages manually, and extract them using rpm2cpio and cpio (which don’t need libnss3). Go to the package browser (using your subscription information) and look for nss, then follow the links to download the appropriate version for your RHEL installation. On the server, “install” it by extracting it as follows, as root:

cd /
rpm2cpio /path/to/nss-....rpm | cpio -idmv

(replacing the path as appropriate, and the ... with whatever version you have).

This will extract the libraries, and should allow you to use rpm and yum again. You should then re-install the nss package properly using yum, along with any other missing dependencies.

Please remember not to use --no-deps in future!


The answer above has an issue... Depending on the Fedora/RHEL version rpm2cpio may depend on libnss3 as well. You will need another operating system to extract the cpio file from the RPM package (Peazip can do it)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.