2

I have installed OpenLDAP with yum, but I have accidentally deleted some of the config files. I am not able to recover them. I want to uninstall it. I tried the following command but it ends with an error:

--> Processing Dependency: PackageKit-glib = 0.5.8-20.el6 for package: PackageKit-gtk-module-0.5.8-20.el6.x86_64
--> Running transaction check
---> Package PackageKit-device-rebind.x86_64 0:0.5.8-20.el6 will be erased
---> Package PackageKit-gstreamer-plugin.x86_64 0:0.5.8-20.el6 will be erased
---> Package PackageKit-gtk-module.x86_64 0:0.5.8-20.el6 will be erased
--> Finished Dependency Resolution Error: Trying to remove "yum", which is protected  You could try using --skip-broken to work around the problem  You could try running: rpm -Va --nofiles --nodigest

Can someone please tell how to uninstall it properly so I can install it again and make the config changes?

enter image description here

  • Where is the command. It looks like you remove yum with yum (did you cut and paste a command and pasted it twice before hitting return?) – Anthon Jul 14 '15 at 7:52
  • # yum remove openldap – LinuxBegineer Jul 14 '15 at 7:53
1

Can you make a backup of the configuration and :

yum remove openldap
rpm -e openldap.package_name
yum install openldap

And copy your configuration files back

  • I think u did not check my question in detail – LinuxBegineer Jul 14 '15 at 8:43
  • Your configuration files have not been removed if you did only a yum remove. If you've errors while trying to install openldap back as "no such files or directory" it can mean that openldap as not been removed properly. Those commands stand to remove it properly and install it again. So far if your configuration disappeared from the disk you'd check if you have any backup. – Mathieu Coavoux Jul 14 '15 at 8:51
  • These error when i am trying to run 'yum remove openldap' 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, May 1 2012, 13:52:17) [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] – LinuxBegineer Jul 14 '15 at 8:52
  • Can you try to reinstall libldap only? – Mathieu Coavoux Jul 14 '15 at 9:15
  • yum install libldap end with the above error – LinuxBegineer Jul 14 '15 at 9:16
2

You're trying to remove the wrong package.

openldap provides only the library files (libldap, liblber, etc.) and it's required by pretty much everything on the system. So when you try to remove it yum goes through the list of dependencies which is pretty much all of it.

The configuration files that you deleted are part of the openldap-servers package (and possibly openldap-clients package). You can remove them as usual: yum remove openldap-servers.

You can check to which package the files belong to by running yum provides <full path or */file> ex. yum provides /etc/openldap/slapd.d or yum provides */ldap.conf

  • Now for every command i am getting below exception 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, May 1 2012, 13:52:17) [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] – LinuxBegineer Jul 14 '15 at 9:09
  • Well, it seems you have deleted the openldap package (or part of it - definitely the lib), so you'll have to find the package for your system and installed it manually. yum will not work, rpm however it will. I'm not sure what system you are running (version 2.4.23 is outdated for rhel6/7 - it's using vers 2.4.39). If it's a rhel/centos 6 download the latest and install: wget ftp.ntua.gr/pub/linux/centos/6/os/x86_64/Packages/… && rpm -ivh openldap-2.4.39-6.el7.x86_64.rpm – nkms Jul 14 '15 at 9:27
  • I am using Red Hat enterprises Linux Server Releases6.3(Santiago) – – LinuxBegineer Jul 14 '15 at 9:28
  • You'll need access to redhat network (rhn.redhat.com) to download the package manually (yumdownloader will not work). If you don't have access you can download the equivalent centos package (it will work) but if you don't want to upgrade to latest version (2.4.39) you'll need to find a repository which keeps older versions of packages (check vault.centos.org). – nkms Jul 14 '15 at 9:38
0

You can use reinstall to reinstall the OpenLDAP package:

# yum reinstall openldap

That should reinstall the default configuration files and leave you with a fresh installation.

  • 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, May 1 2012, 13:52:17) [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] – LinuxBegineer Jul 14 '15 at 8:00
  • @LinuxBegineer You've deleted parts of OpenLDAP, which now prevents yum from running. The solution is to download the OpenLDAP RPM for RHEL 6 and install that manually using rpm. That should fix yum. – mjturner Jul 14 '15 at 8:03
  • No i accidentally deleted only config file which is inside /etc/openldap/slapd.d/* nothing else – LinuxBegineer Jul 14 '15 at 8:05
  • @LinuxBegineer Ok. Well, the same suggestion applies - download the OpenLDAP RPM for RHEL6 and reinstall it using rpm. – mjturner Jul 14 '15 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.