My server has broken and I had to urgently put it up again. I needed to reinstall the system and, since I was time constrained, I lazily just copied the directories I considered necessary (/etc, /opt, /root and /var) with cp to an external disk and formatted the system.

Now, I need to restore my LDAP configuration and data, but I did not do a backup correctly. I still have every single file because they were stored in /var, but copying them to the same place and starting slapd fails. I get the following messages on /var/log/messages:

Aug 25 21:02:33 localhost slapd[2664]: @(#) $OpenLDAP: slapd 2.4.38 (Aug 25 2014 16:04:17) $
Aug 25 21:02:33 localhost slapd[2667]: hdb_db_open: database "dc=my,dc=host,dc=com": alock package is unstable.
Aug 25 21:02:33 localhost slapd[2667]: backend_startup_one (type=hdb, suffix="dc=my,dc=host,dc=com"): bi_db_open failed! (-1)
Aug 25 21:02:33 localhost slapd[2667]: slapd stopped.
Aug 25 21:02:33 localhost /etc/init.d/slapd[2663]: start-stop-daemon: failed to start `/usr/lib64/openldap/slapd'
Aug 25 21:02:33 localhost /etc/init.d/slapd[2647]: ERROR: slapd failed to start

I reinforce that I both have the old configuration files and a verbatin database files copy. If it is possible to recover with it, how should I proceed?


I just completed my restore of openldap on ubuntu14.04 from files from ubuntu 12.04 restore your files for these two dirs. be sure to backup the current contents before.

As root
1. backup contents of /var/lib/ldap/*
2. backup contents of /etc/ldap/*
3. sudo service slapd stop
4. clear out /var/lib/ldap/*
5. clear out /etc/ldap/*

6. cp [backup]/var/lib/ldap/* /var/lib/ldap/
7. cp [backup]/etc/ldap/* /etc/ldap/
8. chown openldap /etc/ldap/*
9. sudo service slapd start

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.