记录 libldap-2.4.so.2: cannot open shared object file: No such file or directory

1.背景: 卸载openldap相关的所有rpm包后,出现libldap-2.4.so.2: cannot open shared object file: No such file or directory

 [root@sht-sgmhadoopcm-01 ~]# rpm -qa|grep openldap

openldap-2.4.23-32.el6_4.1.x86_64

openldap-devel-2.4.23-32.el6_4.1.x86_64

openldap-clients-2.4.23-32.el6_4.1.x86_64

openldap-servers-2.4.23-32.el6_4.1.x86_64

openldap-servers-sql-2.4.23-32.el6_4.1.x86_64

[root@sht-sgmhadoopcm-01 ~]# rpm -e openldap-* –nodeps
warning: /etc/openldap/ldap.conf saved as /etc/openldap/ldap.conf.rpmsave
[root@sht-sgmhadoopcm-01 ~]# rpm -qa|grep openldap
openldap-devel-2.4.23-32.el6_4.1.x86_64
openldap-clients-2.4.23-32.el6_4.1.x86_64
openldap-servers-2.4.23-32.el6_4.1.x86_64
openldap-servers-sql-2.4.23-32.el6_4.1.x86_64
[root@sht-sgmhadoopcm-01 ~]# rpm -e openldap-servers-sql-2.4.23-32.el6_4.1.x86_64
[root@sht-sgmhadoopcm-01 ~]# rpm -e openldap-servers-2.4.23-32.el6_4.1.x86_64
warning: /etc/sysconfig/ldap saved as /etc/sysconfig/ldap.rpmsave
[root@sht-sgmhadoopcm-01 ~]# rpm -e openldap-clients-2.4.23-32.el6_4.1.x86_64
[root@sht-sgmhadoopcm-01 ~]# rpm -e openldap-devel-2.4.23-32.el6_4.1.x86_64
[root@sht-sgmhadoopcm-01 ~]#
[root@sht-sgmhadoopcm-01 ~]# rpm -qa|grep openldap
[root@sht-sgmhadoopcm-01 ~]# yum
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   libldap-2.4.so.2: cannot open shared object file: No such file or directory

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, Nov 22 2013, 12:16:22)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)]

If you cannot solve this problem yourself, please go to
the yum faq at:
  http://yum.baseurl.org/wiki/Faq
 

[root@sht-sgmhadoopcm-01 ~]#

2.解决办法:下载openldap-2.4.23-32.el6_4.1.x86_64.rpm,校验MD5,再强制安装

[root@sht-sgmhadoopcm-01 ~]# wget http://ftp.pbone.net/mirror/ftp.scientificlinux.org/linux/scientific/6.4/x86_64/updates/fastbugs/openldap-2.4.23-32.el6_4.1.x86_64.rpm
[root@sht-sgmhadoopcm-01 ~]#  rpm -v –checksig ./openldap-2.4.23-32.el6_4.1.x86_64.rpm
./openldap-2.4.23-32.el6_4.1.x86_64.rpm:
    Header V4 DSA/SHA1 Signature, key ID 192a7d7d: NOKEY
    Header SHA1 digest: OK (2c80a5928199d9ac370b1def5d131ccdf18db585)
    MD5 digest: OK (a81248ad1f3e81b043a360b2d93ef404)
    V4 DSA/SHA1 Signature, key ID 192a7d7d: NOKEY
[root@sht-sgmhadoopcm-01 ~]# rpm -ivh –force –nodeps openldap-2.4.23-32.el6_4.1.x86_64.rpm
warning: openldap-2.4.23-32.el6_4.1.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 192a7d7d: NOKEY
Preparing…                ########################################### [100%]
   1:openldap               ########################################### [100%]
[root@sht-sgmhadoopcm-01 ~]# yum

Loaded plugins: fastestmirror, security
You need to give some command
Usage: yum [options] COMMAND

List of Commands:

check          Check for problems in the rpmdb
check-update   Check for available package updates
clean          Remove cached data
deplist        List a package’s dependencies
distribution-synchronization Synchronize installed packages to the latest available versions
downgrade      downgrade a package
erase          Remove a package or packages from your system
groupinfo      Display details about a package group
groupinstall   Install the packages in a group on your system
grouplist      List available package groups
groupremove    Remove the packages in a group from your system
help           Display a helpful usage message
history        Display, or use, the transaction history
info           Display details about a package or group of packages
install        Install a package or packages on your system
list           List a package or groups of packages
load-transaction load a saved transaction from filename
makecache      Generate the metadata cache
provides       Find what package provides the given value
reinstall      reinstall a package
repolist       Display the configured software repositories
resolvedep     Determine which package provides the given dependency
search         Search package details for the given string
shell          Run an interactive yum shell
update         Update a package or packages on your system
update-minimal Works like update, but goes to the ‘newest’ package match which fixes a problem that affects your system
updateinfo     Acts on repository update information
upgrade        Update packages taking obsoletes into account
version        Display a version for the machine and/or available repos.

点赞