# Clean install LDAP and BDB issue (Solved)

## dudestir

I'm following the HOWTO_LDAP_SAMBA_PDC_Basic_Setup wiki entry to setup ldap and samba.

I can not seem to get the database created though.  It appears to me that the actual ldpa bdb tables are not being built so anything that wants to use them fails.

Directly after the install the only file in the /var/lib/openldap-data/ directory is DB_CONFIG.example.

After creating DB_CONFIG and running slaptest I have __db.001 to 005, alock and a log.0000000001 file but not a id2entry.bdb listed in the error

```

thebird # slaptest

bdb_db_open: db_open(/var/lib/openldap-data/id2entry.bdb) failed: No such file or directory (2)

backend_startup_one: bi_db_open failed! (2)

slap_startup failed (test would succeed using the -u switch)

```

Tring to start slapd I get the following error messages

```

Sep 11 16:21:47 thebird slapd[6941]: @(#) $OpenLDAP: slapd 2.3.24 (Sep 11 2006 16:10:30) $      root@thebird:/var/tmp/portage/openldap-2.3.24-r1/work/openldap-2.3.24/servers/slapd

Sep 11 16:21:47 thebird slapd[6942]: bdb_db_open: alock package is unstable

Sep 11 16:21:47 thebird slapd[6942]: backend_startup_one: bi_db_open failed! (-1)

Sep 11 16:21:47 thebird slapd[6942]: slapd stopped.

Sep 11 16:21:47 thebird slapd[6942]: connections_destroy: nothing to destroy.

```

My /etc/openldap/slapd.conf looks like this

```

include         /etc/openldap/schema/core.schema

include         /etc/openldap/schema/cosine.schema

include         /etc/openldap/schema/inetorgperson.schema

include         /etc/openldap/schema/nis.schema

include         /etc/openldap/schema/samba.schema

pidfile         /var/run/openldap/slapd.pid

argsfile        /var/run/openldap/slapd.args

#######################################################################

# BDB database definitions

#######################################################################

loglevel        256

database        bdb

suffix          "dc=CRAWFORD_HOUSE,dc=NET"

rootdn          "cn=Manager,dc=CRAWFORD_HOUSE,dc=NET"

checkpoint      32      30 # <kbyte> <min>

rootpw          {MD5}iJM+YcvpcJ/3FCSMJQoIVQ==

# The database directory MUST exist prior to running slapd AND

# should only be accessible by the slapd and slap tools.

# Mode 700 recommended.

directory       /var/lib/openldap-data

# Indices to maintain

index    sambaSID    eq

index    sambaPrimaryGroupSID    eq

index    sambaDomainName    eq

index    objectClass,uid,uidNumber,gidNumber,memberUid eq

index    cn,mail,surname,givenname   eq,subinitial

```

openldap was built with the following flags

```
net-nds/openldap-2.3.24-r1  USE="berkdb crypt ipv6 kerberos readline samba ssl tcpd -debug -gdbm -minimal -odbc -overlays -perl -sasl (-selinux) -slp"

```

Running the emerge with the output redirected so I can quickly see the system messages gives me this out out that does not seem scream to me that something is seriously broken

```

thebird dean # emerge openldap > ldap1.txt

configure: WARNING: Please use --enable-ldbm-api instead of --with-ldbm-api

configure: WARNING: SASL authentication not supported!

configure: WARNING: Use of --without-threads is recommended with back-shell

ar: creating liblutil.a

ar: creating liblunicode.a

ar: creating librewrite.a

ar: creating libback_ldif.a

ar: creating libback_bdb.a

ar: creating libback_ldap.a

ar: creating libback_ldbm.a

ar: creating libback_relay.a

ar: creating ../liboverlays.a

schema_init.c: In function 'certificateValidate':

schema_init.c:121: warning: passing argument 2 of 'd2i_X509' from incompatible pointer type

schema_init.c: In function 'certificateExactNormalize':

schema_init.c:2635: warning: passing argument 2 of 'd2i_X509' from incompatible pointer type

daemon.o: In function `slapd_daemon_task':

daemon.c:(.text+0x1446): warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead

daemon.c:(.text+0x1435): warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead

fm.o: In function `populate_queue':

fm.c:(.text+0x1e4): warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead

libtool: install: warning: remember to run `libtool --finish /usr/lib64'

libtool: install: warning: relinking `libldap.la'

libtool: install: warning: remember to run `libtool --finish /usr/lib64'

libtool: install: warning: relinking `libldap_r.la'

libtool: install: warning: remember to run `libtool --finish /usr/lib64'

libtool: install: warning: `../../libraries/libldap/libldap.la' has not been installed in `/usr/lib64'

libtool: install: warning: `/var/tmp/portage/openldap-2.3.24-r1/work/openldap-2.3.24/libraries/liblber/liblber.la' has not been i                         nstalled in `/usr/lib64'

libtool: install: warning: `../../libraries/liblber/liblber.la' has not been installed in `/usr/lib64'

libtool: install: warning: `../../libraries/libldap/libldap.la' has not been installed in `/usr/lib64'

libtool: install: warning: `/var/tmp/portage/openldap-2.3.24-r1/work/openldap-2.3.24/libraries/liblber/liblber.la' has not been i                         nstalled in `/usr/lib64'

libtool: install: warning: `../../libraries/liblber/liblber.la' has not been installed in `/usr/lib64'

libtool: install: warning: `../../libraries/libldap/libldap.la' has not been installed in `/usr/lib64'

libtool: install: warning: `/var/tmp/portage/openldap-2.3.24-r1/work/openldap-2.3.24/libraries/liblber/liblber.la' has not been i                         nstalled in `/usr/lib64'

libtool: install: warning: `../../libraries/liblber/liblber.la' has not been installed in `/usr/lib64'

libtool: install: warning: `../../libraries/libldap/libldap.la' has not been installed in `/usr/lib64'

libtool: install: warning: `/var/tmp/portage/openldap-2.3.24-r1/work/openldap-2.3.24/libraries/liblber/liblber.la' has not been i                         nstalled in `/usr/lib64'

libtool: install: warning: `../../libraries/liblber/liblber.la' has not been installed in `/usr/lib64'

libtool: install: warning: `../../libraries/libldap/libldap.la' has not been installed in `/usr/lib64'

libtool: install: warning: `/var/tmp/portage/openldap-2.3.24-r1/work/openldap-2.3.24/libraries/liblber/liblber.la' has not been i                         nstalled in `/usr/lib64'

libtool: install: warning: `../../libraries/liblber/liblber.la' has not been installed in `/usr/lib64'

libtool: install: warning: `../../libraries/libldap/libldap.la' has not been installed in `/usr/lib64'

libtool: install: warning: `/var/tmp/portage/openldap-2.3.24-r1/work/openldap-2.3.24/libraries/liblber/liblber.la' has not been i                         nstalled in `/usr/lib64'

libtool: install: warning: `../../libraries/liblber/liblber.la' has not been installed in `/usr/lib64'

libtool: install: warning: `../../libraries/libldap/libldap.la' has not been installed in `/usr/lib64'

libtool: install: warning: `/var/tmp/portage/openldap-2.3.24-r1/work/openldap-2.3.24/libraries/liblber/liblber.la' has not been i                         nstalled in `/usr/lib64'

libtool: install: warning: `../../libraries/liblber/liblber.la' has not been installed in `/usr/lib64'

libtool: install: warning: `../../libraries/libldap_r/libldap_r.la' has not been installed in `/usr/lib64'

libtool: install: warning: `/var/tmp/portage/openldap-2.3.24-r1/work/openldap-2.3.24/libraries/liblber/liblber.la' has not been i                         nstalled in `/usr/lib64'

libtool: install: warning: `../../libraries/liblber/liblber.la' has not been installed in `/usr/lib64'

libtool: install: warning: relinking `back_dnssrv.la'

libtool: install: warning: remember to run `libtool --finish /usr/lib64/openldap/openldap'

libtool: install: warning: relinking `back_hdb.la'

libtool: install: warning: remember to run `libtool --finish /usr/lib64/openldap/openldap'

libtool: install: warning: relinking `back_meta.la'

libtool: install: warning: remember to run `libtool --finish /usr/lib64/openldap/openldap'

libtool: install: warning: relinking `back_monitor.la'

libtool: install: warning: remember to run `libtool --finish /usr/lib64/openldap/openldap'

libtool: install: warning: relinking `back_null.la'

libtool: install: warning: remember to run `libtool --finish /usr/lib64/openldap/openldap'

libtool: install: warning: relinking `back_passwd.la'

libtool: install: warning: remember to run `libtool --finish /usr/lib64/openldap/openldap'

libtool: install: warning: relinking `back_shell.la'

libtool: install: warning: remember to run `libtool --finish /usr/lib64/openldap/openldap'

libtool: install: warning: remember to run `libtool --finish /usr/lib64'

libtool: install: warning: `../../libraries/libldap_r/libldap_r.la' has not been installed in `/usr/lib64'

libtool: install: warning: `/var/tmp/portage/openldap-2.3.24-r1/work/openldap-2.3.24/libraries/liblber/liblber.la' has not been i                         nstalled in `/usr/lib64'

libtool: install: warning: `../../libraries/liblber/liblber.la' has not been installed in `/usr/lib64'

>>> Regenerating /etc/ld.so.cache...

```

From the emerge messages themself it appears the Berkley was desired backend

```

 ^[[32;01m*^[[0m Using Berkeley DB for local backend

 * econf: updating openldap-2.3.24/build/config.guess with /usr/share/gnuconfig/config.guess

 * econf: updating openldap-2.3.24/build/config.sub with /usr/share/gnuconfig/config.sub

 * econf: updating openldap-2.3.24/contrib/ldapc++/config.guess with /usr/share/gnuconfig/config.guess

 * econf: updating openldap-2.3.24/contrib/ldapc++/config.sub with /usr/share/gnuconfig/config.sub

./configure --prefix=/usr --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc 

--localstatedir=/var/lib --enable-static --enable-shared --libexecdir=/usr/lib64/openldap --enable-slapd --enable-slurpd --enable-ldbm

--enable-bdb --with-ldbm-api=berkeley --enable-hdb=mod --enable-passwd=mod --enable-phonetic=mod --enable-dnssrv=mod --enable-ldap

--enable-meta=mod --enable-monitor=mod --enable-null=mod --enable-shell=mod --disable-perl --disable-sql --enable-syncprov --enable-crypt

--disable-slp --enable-rewrite --enable-rlookups --enable-aci --enable-modules --enable-cleartext --enable-slapi --with-lmpasswd --enable-dyngroup

--enable-proxycache --enable-syslog --enable-dynamic --enable-local --enable-proctitle --enable-ipv6 --enable-readline --without-cyrus-sasl

--disable-spasswd --enable-wrappers --with-tls --disable-overlays --libdir=/usr/lib64 --build=x86_64-pc-linux-gnu

```

and 

```

checking for Berkeley DB major version... 4

checking for Berkeley DB minor version... 2

checking for Berkeley DB link (-ldb42)... no

checking for Berkeley DB link (-ldb-42)... no

checking for Berkeley DB link (-ldb-4.2)... yes

checking for Berkeley DB version match... yes

checking for Berkeley DB thread support... yes

checking Berkeley DB version for BDB/HDB backends... yes

```

Thanks

Dean Crawford

----------

## dudestir

Ok the issue was the files that slaptest created were created as root

After chown back to ldap:ldap the bdb files were created when I started slapd.

----------

