slapd[11705]: bdb(dc=xxx,dc=com): PANIC: fatal region error detected; run recovery
Note: my bdb version is 4.7, yours may differ;
slapd stands for Stand-alone LDAP Daemon, your service name may be ldap
At first I tried to recover LDAP using
db4.7_verify -h /var/lib/ldap db4.7_recover -v -h /var/lib/ldap
But LDAP got broken again and again.
Thus I decided to recreate whole LDAP folder. Here is the scenario:
- Stop the LDAP server
service slapd stop
- Dump the directory structure to a text file
slapcat -l /etc/ldap/backup/ldap_old.ldif
- Recover LDAP
db4.7_recover -v -h /var/lib/ldap
- Dump the directory structure to a text file
slapcat -l /etc/ldap/backup/ldap.ldif
- Verify that ldap.ldif contains your entries. If it does not, or if slapcat returned errors in step 3, try running db4.7_recover in catastrophic mode:
db4.7_recover -v -h /var/lib/ldap -c
and repeat step 3 - Delete the LDAP directory
rm -fr /var/lib/ldap/*
- Load LDAP directory from the file you have create in step 3
slapadd -l /etc/ldap/backup/slap.ldif
- Make openldap the owner of the LDAP directory
chown -R openldap:openldap /var/lib/ldap/*
- Start the LDAP server
service slapd start