dmb
dmb

Reputation: 267

openldap with lmdb; cannot be opened: No such file or directory

I am trying to configure openldap-2.4.43 with lmdb backend on a linux system. So far without success.

slapd.conf:

include     /opt/openldap/etc/schema/core.schema
include     /opt/openldap/etc/schema/cosine.schema
include     /opt/openldap/etc/schema/inetorgperson.schema

allow bind_v2

pidfile     /var/run/slapd.pid
argsfile    /var/run/slapd.args

database    config
rootdn      "cn=Manager,cn=config"
rootpw      {SSHA}sMXtPWSAL9yEgDslsXMZiM+qgLJZW9VO

database    mdb
suffix      "dc=mydomain,dc=com"
rootdn      "cn=Manager,dc=mydomain,dc=com"
rootpw      {SSHA}sMXtPWSAL9yEgDslsXMZiM+qgLJZW9VO
directory   /var/openldap/data/main/
maxsize     10485760

index   objectClass         eq,pres
index   ou,cn,mail,surname,givenname    eq,pres,sub

straced slaptest (/opt/openldap/sbin/slaptest -f slapd.conf -F ./slapd.d/) result (last part):

 stat("/var/openldap/data/main/", {st_mode=S_IFDIR|0700, st_size=40, ...}) = 0
 getpid()                                = 2440
 brk(0x828a000)                          = 0x828a000
 open("/var/openldap/data/main//data.mdb", O_RDONLY) = -1 ENOENT (No such file or directory)
 time(NULL)                              = 1453993047
 write(2, "56aa2c57 mdb_db_open: database \""..., 12256aa2c57 mdb_db_open: database "dc=mydomain,dc=com" cannot be opened: No such file or directory (2). Restore from backup!) = 122
time(NULL)                              = 1453993047
write(2, "56aa2c57 backend_startup_one (ty"..., 9356aa2c57backend_startup_one (type=mdb, suffix="dc=mydomain,dc=com"): bi_db_open failed! (2)) = 93
write(2, "slap_startup failed (test would "..., 61slap_startup failed (test would succeed using the -u switch)) = 61
_exit(1)                                = ?
+++ exited with 1 +++

/var/openldap/data/main is writable. The system only has a single root user.

I tried changing the target folder, set ulimit -c unlimited, changed the value of maxsize. All without any noticeable outcome.

What am I missing? Why is openldap assuming that the /var/openldap/data/main//data.mdb should already be there and does not create it on its own?

Upvotes: 1

Views: 4031

Answers (2)

Notoc
Notoc

Reputation: 163

Ran into same error while converting slapd.conf to slapd.d with Slaptest.

Configuration was being converted, it was just that those errors are in fact warning, because of course I still had no database in /var/lib/ldap, because I emptied the folder beforehand.

Upvotes: 5

user207421
user207421

Reputation: 310980

Get rid of the trailing slash after main, and run slapindex before you run slapd. You need to do that any time the database changes.

Upvotes: 1

Related Questions