My system is centos7.
[root@centos7 caiyiheng]# uname -a
Linux centos7 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015
x86_64 x86_64 x86_64 GNU/Linux
My system run in a virtualbox.
When I run the cmd yum -y update
, and press ctrl+c
while yum is updateing something. after that I found I can't use yum or rpm anymore. when I input yum or rpm it show as:
[root@centos7 caiyiheng]# yum
error: Failed to initialize NSS library
error: no dbpath has been set
error: cannot open Packages database in /%{_dbpath}
CRITICAL:yum.main:
Error: rpmdb open failed
[root@centos7 caiyiheng]# rpm
error: Failed to initialize NSS library
most yum or rpm command can't work, such as yum install
,yum clean all
even yum --help
.
I check /var/log/yum.log
, it show as:
[root@centos7 caiyiheng]# tail -f /var/log/yum.log
Sep 21 05:53:21 Installed: wget-1.14-15.el7_4.1.x86_64
Sep 21 05:53:21 Installed: lsof-4.87-5.el7.x86_64
Sep 21 05:53:22 Installed: net-tools-2.0-0.22.20131004git.el7.x86_64
Sep 26 17:28:11 Updated: libgcc-4.8.5-28.el7_5.1.x86_64
Sep 26 17:28:12 Installed: 1:grub2-common-2.02-0.65.el7.centos.2.noarch
Sep 26 17:28:13 Installed: 1:grub2-pc-modules-2.02-0.65.el7.centos.2.noarch
Sep 26 17:28:13 Installed: firewalld-filesystem-0.4.4.4-14.el7.noarch
Sep 26 17:28:14 Updated: tzdata-2018e-3.el7.noarch
Sep 26 17:28:14 Updated: ncurses-base-5.9-14.20130511.el7_4.noarch
Sep 26 17:28:15 Updated: nss-softokn-freebl-3.36.0-5.el7_5.x86_64
and I search in google for a whole day, found lots of solutions may like my problem, I tried them but nothing happen.
such as
I even download the rpm https://centos.pkgs.org/7/centos-updates-x86_64/nss-softokn-freebl-3.36.0-5.el7_5.x86_64.rpm.html
and rpm2cpio nss-softokn-freebl-3.36.0-5.el7_5.x86_64.rpm | cpio -idmv
and copy ./usr/lib or lib64 or ./etc to /usr/lib /usr/lib64 /etc, but all of that can't solve my problem.
Someone mentioned that yum has a problem with chroot (https://bugs.centos.org/view.php?id=14767) but it doesn't match my situation, I even tried that, but nothing happen.
rpm -qa |grep nss
and edit your question to post the results please (if it will let you run that)rpm2cpio
command at the root of the machine? That would automatically dump the required files. Maybe try it with the previous version noted inyum.log