快捷搜索:

SQLite卸载后造成rpm跟yum都不可用的恢复方法(亲测)

     今天在CentOS 6系统上测试一个功能的时候将sqlite卸载了,之后rpm,yum等均无法正常使用,自然而然等sqlite也无法通过rpm或者yum安装回来。

1、问题重现:
$ rpm -qa | grep sqlite
sqlite-3.6.20-1.el6_7.2.x86_64
# 卸载该软件包 #
$ rpm -e --nodeps sqlite-3.6.20-1.el6_7.2.x86_64
$ rpm -qa | grep sqlite
error: rpmdbNextIterator: skipping h#       2 Header V3 RSA/SHA1 Signature, key ID c105b9de: BAD
error: rpmdbNextIterator: skipping h#       4 Header V3 RSA/SHA256 Signature, key ID c105b9de: BAD
error: rpmdbNextIterator: skipping h#       6 Header V3 RSA/SHA1 Signature, key ID c105b9de: BAD
error: rpmdbNextIterator: skipping h#       8 Header V3 RSA/SHA1 Signature, key ID c105b9de: BAD
error: rpmdbNextIterator: skipping h#      10 Header V3 RSA/SHA1 Signature, key ID c105b9de: BAD
...
# 下面就报出了一大堆的错误 #
 
# 包括yum命令也无法使用了 #
$ yum list
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
 
   No module named sqlite
 
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.6.6 (r266:84292, Jul 23 2015, 15:22:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)]
 
If you cannot solve this problem yourself, please go to
the yum faq at:
  http://yum.baseurl.org/wiki/Faq

这个时候已经明确是sqlite缺失导致的以上报错,所以就需要将sqlite安装回来。
2、问题解决:
2.1、先下载一个sqlite的rpm包
方法一直接挂载一个ISO的包到CD里面,这个前提是你必须有安装包才行
$ mount -o loop CentOS-6.8-x86_64-bin-DVD1.iso /mnt/
$ mkdir /tmp/recover
$ cp /mnt/Packages/sqlite-3.6.20-1.el6_7.2.x86_64.rpm /tmp/recover
$ cd /tmp/recover
$ rpm -ivh sqlite-3.6.20-1.el6_7.2.x86_64.rpm
error: sqlite-3.6.20-1.el6_7.2.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: BAD
error: sqlite-3.6.20-1.el6_7.2.x86_64.rpm cannot be installed
方法二:那就是直接下载网上的一个rpm包就可以了,下载地址跟命令如下:wget http://mirror.centos.org/centos/6/os/x86_64/Packages/sqlite-3.6.20-1.el6_7.2.x86_64.rpm
2.2、将rpm包中的文件解压并拷贝到当前系统
$ rpm2cpio sqlite-3.6.20-1.el6_7.2.x86_64.rpm | cpio -idmv
./usr/bin/sqlite3
./usr/lib64/libsqlite3.so.0
./usr/lib64/libsqlite3.so.0.8.6
./usr/share/doc/sqlite-3.6.20
./usr/share/doc/sqlite-3.6.20/README
./usr/share/man/man1/sqlite3.1.gz
1253 块
$ ls sqlite-3.6.20-1.el6_7.2.x86_64.rpm  usr
$ cp -arp usr/ /

此时就会发现rpm,yum这些工具都已经恢复正常了。

您可能还会对下面的文章感兴趣: