1. 前情:
因为需要使用rpm命令升级rpm包,但是报错无法执行,所以加了 “ --force --nodeps ” 选项,结果执行完后rpm和yum命令都无法使用了。
2. 报错:
[root@host-172-20-130-16 ~]# rpm
rpm: /lib64/libnssutil3.so: version `NSSUTIL_3.59' not found (required by /lib64/libnss3.so)
[root@host-172-20-130-16 ~]# yum install nss
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
/lib64/libnssutil3.so: version `NSSUTIL_3.59' not found (required by /lib64/libnss3.so)
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 7 2019, 00:51:29)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
3. 解决方法:
- 直接找个rpm命令可以使用的机器。可以是服务器或者虚拟机都行。然后将
/lib64/libnssutil3.so
文件拷贝到rpm命令无法使用的机器,覆盖掉原先的文件即可。然后rpm和yum命令就可以使用了。 - 如果还是有问题,可以试下把
/lib64/*.so
文件全部拷贝过去即可(记得备份原来的/lib64/
目录)。