Linux – OpenLDAP fails to stop ,but starts Ok but then status shows as slapd stopped

linuxopenldaprhel5

We are running openldap 2.3.43 on RHel 5.3.,Our LDAP server has been behaving erratically lately

1.It fails to stop when you issue command service ldap restart
but it "seems" to starts OK

2.However after running command service ldap status it shows slapd is stopped

I have looked in the ldap.log file and the only errors worth mentioning are

Jun 25 22:11:14 myldapserver slapd[11593]: daemon IPv6 socket() errno=7 

Jun25 22:11:15 myldapserver slapd[11598]: bdb(cn=accesslog):file id2entry.bdb (meta pgno =0) has LSN [1}[900784]

Jun25 22:11:15 myldapserver slapd[11598]: bdb(cn=accesslog):end of log is [1][956]
Jun25 22:11:15 myldapserver slapd[11598]: bdb(cn=accesslog):/var/log/ldap/accesslog/id2entry.bdb:unexpected file or format

Jun25 22:11:15 myldapserver slapd[11598]: bdb_db_opendb_open(cn=accesslog):/var/log/ldap/accesslog/id2entry.bdb) failed: Invalid argument (22)

Jun25 22:11:15 myldapserver slapd[11598]: bdb(cn=accesslog):Unknown locker ID :0 


Jun25 22:11:15 myldapserver slapd[11598]: 
Jun25 22:11:15 myldapserver slapd[11598]: backend_startup_one: bi_db_open failed! (22) 
Jun25 22:11:15 myldapserver slapd[11598]: bd_db_close: alock close failed! 
Jun 25 22:11:15 myldapserver slapd[11598]: slapd stopped. 
Jun 25 22:11:15 myldapserver slapd[11598]: connections_destroy: nothing to destroy.

Any help would be greatly appreciated.

Best Answer

You have problem to open file /var/log/ldap/accesslog/id2entry.bdb, which is a part of ldap's database.

You can try these steps:

1) In the normal case, ldap's database is somewhere like /var/lib/ldap (but I have Ubuntu installed). Didn't you change a directory of database (you can see it in the /etc/ldap/slapd.conf or somewhere in /etc/ldap/slap.d/*, it is a parameter named directory) Try to search true location of file id2entry.dbd and use in config file right place.

2) Is your file id2entry.dbd accessible by openldap for read and write? Check permission of this file.

3) If your database is in the right location and have proper rights, try to repair of ldap's database by using this command:

/usr/sbin/slapd_db_recover -v -h /var/lib/ldap

(/var/lib/ldap is directory, where is placed id2entry.dbd file).

Related Topic