OpenLdap: Why slapd tell me there's no DB_CONFIG when there is one
When I run slapcat or restart slapd on Debian 6, OpenLdap 2.4.23-7.32.4.23-7.3, I see this warning:
hdb_db_open: warning - no DB_CONFIG file found in directory /var/lib/ldap: (14).
Expect poor performance for suffix "dc=i-tracing,dc=lan".
But when I take a look:
[root@xxx-ldap:/etc/ldap]# ls -lh /var/lib/ldap
total 5,8M
[...]
-rw-r--r-- 1 openldap openldap 3,1K 8 nov. 12:00 DB_CONFIG
[...]
And
ps aux | grep openldap
openldap 22919 4.4 1.5 87204 5860 ? SLsl 12:20 0:02 /usr/sbin/slapd -h ldaps://xxx-ldap.xxx.lan:636/ ldap://127.0.0.1:389 -g openldap -u openldap -f /etc/ldap/slapd.conf
Do you know what can I do in order to show Slapd that DB_CONFIG is really here, in /var/lib/ldap ?
NB: Even when doing this:
service slapd stop
cp /tmp/DB_CONFIG /var/lib/ldap/
chown openldap:openldap /var/lib/ldap/DB_CONFIG
service slapd start
It keeps telling that there's no DB_CONFIG file in /var/lib/ldap !?!
Maybe others person may hit the same problem. For me, the version of openldap:
openldap.x86_64 2.4.40-13.el7 @base openldap-clients.x86_64 2.4.40-13.el7 @base openldap-servers.x86_64 2.4.40-13.el7 @base
I found the DB_CONFIG
file in /usr/share/openldap-servers/DB_CONFIG.example
, so just cp the file to the directory of ldap. After fix the problem, the result of slaptest
is:
599ade3a bdb_monitor_db_open: monitoring disabled; configure monitor database to enable config file testing succeeded
I have finally found the root cause, it was hidden in the creation time of DB_CONFIG:
-rw-r--r-- 1 openldap openldap 3,1K 8 nov. 12:00 DB_CONFIG
It was exactly the time of last slapd restart.
I have fixed it with those commands:
service slapd stop
cp /tmp/DB_CONFIG /var/lib/ldap/
chown openldap:openldap /var/lib/ldap/DB_CONFIG
service slapd start