Centos下yum和rpm命令半天没有反应问题解决

in with 0 comment  访问: 100 次

由于rpm的数据库出现异常导至直接卡死,造成这种异常是因为之前不正常的安装或查询,当次现象发生的时候,需要进行如下操作:

1、删除rpm的数据文件

[root@localhost yum.repos.d]# ls /var/lib/rpm/*
/var/lib/rpm/Basenames     /var/lib/rpm/__db.003    /var/lib/rpm/Name          /var/lib/rpm/Requirename
/var/lib/rpm/Conflictname  /var/lib/rpm/Dirnames    /var/lib/rpm/Obsoletename  /var/lib/rpm/Sha1header
/var/lib/rpm/__db.001      /var/lib/rpm/Group       /var/lib/rpm/Packages      /var/lib/rpm/Sigmd5
/var/lib/rpm/__db.002      /var/lib/rpm/Installtid  /var/lib/rpm/Providename   /var/lib/rpm/Triggername
[root@localhost yum.repos.d]# rm -rf /var/lib/rpm/__db.00*

2、删除一些网络不可达的Yum安装Repo源文件

[root@localhost yum.repos.d]# ls
CentOS-Base.repo       CentOS-fasttrack.repo  CentOS-Sources.repo  epel.repo
CentOS-Debuginfo.repo  CentOS-Media.repo      CentOS-Vault.repo
[root@localhost yum.repos.d]# rm -rf CentOS-CR.repo  CentOS-fasttrack.repo CentOS-Debuginfo.repo CentOS-Sources.repo  CentOS-Vault.repo

3、重新创建rpm数据文件

[root@localhost ~]# rpm --rebuilddb

4、尝试yum search看看是否还卡

image-20190924114051626-9296451.png

5、查看新生成的rpm数据文件

[root@localhost ~]# ls /var/lib/rpm/*
/var/lib/rpm/Basenames     /var/lib/rpm/__db.003    /var/lib/rpm/Name          /var/lib/rpm/Requirename
/var/lib/rpm/Conflictname  /var/lib/rpm/Dirnames    /var/lib/rpm/Obsoletename  /var/lib/rpm/Sha1header
/var/lib/rpm/__db.001      /var/lib/rpm/Group       /var/lib/rpm/Packages      /var/lib/rpm/Sigmd5
/var/lib/rpm/__db.002      /var/lib/rpm/Installtid  /var/lib/rpm/Providename   /var/lib/rpm/Triggername

到此问题解决。

WeZan
Responses