# Openldap - Unrecognized database type (hdb)

## honp

Hi, i tried install openldap using http://www.gentoo.org/doc/en/ldap-howto.xml but in Code Listing 2.6: Starting SLAPd step i have this problem:

```
gentoo-clear ~ # /etc/init.d/slapd start

 * Starting ldap-server ...

Unrecognized database type (hdb)
```

and /var/log/messages tells me this:

```
May 14 17:47:14 gentoo-clear slapd[20019]: @(#) $OpenLDAP: slapd 2.3.43 (May 14 2009 17:28:16) $    root@gentoo-clear:/var/tmp/portage/net-nds/openldap-2.3.43/work/openldap-2.3.43/servers/slapd

May 14 17:47:14 gentoo-clear slapd[20019]: /etc/openldap/slapd.conf: line 62: <database> failed init (hdb)!

May 14 17:47:14 gentoo-clear slapd[20019]: slapd stopped.

May 14 17:47:14 gentoo-clear slapd[20019]: connections_destroy: nothing to destroy.
```

do you know what to do with this? Thank you...

----------

## malern

Have you emerged openldap with the "berkdb" use flag?

Also, could you post your /etc/openldap/slapd.conf?

----------

## honp

Hi, thanks for rep.

```
gentoo-clear ~ # emerge -pv openldap

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R   ] net-nds/openldap-2.3.43  USE="berkdb crypt gdbm perl ssl tcpd -debug -ipv6 -kerberos -minimal -odbc -overlays* -samba -sasl (-selinux) -slp -smbkrb5passwd" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB

gentoo-clear ~ #
```

```

#

# See slapd.conf(5) for details on configuration options.

# This file should NOT be world readable.

#

include         /etc/openldap/schema/core.schema

include         /etc/openldap/schema/cosine.schema

include         /etc/openldap/schema/inetorgperson.schema

include         /etc/openldap/schema/nis.schema

# Define global ACLs to disable default read access.

# Do not enable referrals until AFTER you have a working directory

# service AND an understanding of referrals.

#referral       ldap://root.openldap.org

pidfile         /var/run/openldap/slapd.pid

argsfile        /var/run/openldap/slapd.args

# Load dynamic backend modules:

 modulepath     /usr/lib/openldap/openldap

# moduleload    back_shell.so

# moduleload    back_relay.so

# moduleload    back_perl.so

# moduleload    back_passwd.so

# moduleload    back_null.so

# moduleload    back_monitor.so

# moduleload    back_meta.so

 moduleload     back_hdb.so

# moduleload    back_dnssrv.so

# Sample security restrictions

#       Require integrity protection (prevent hijacking)

#       Require 112-bit (3DES or better) encryption for updates

#       Require 63-bit encryption for simple bind

# security ssf=1 update_ssf=112 simple_bind=64

# Sample access control policy:

#       Root DSE: allow anyone to read it

#       Subschema (sub)entry DSE: allow anyone to read it

#       Other DSEs:

#               Allow self write access

#               Allow authenticated users read access

#               Allow anonymous users to authenticate

#       Directives needed to implement policy:

 access to dn.base="" by * read

 access to dn.base="cn=Subschema" by * read

 access to *

        by self write

        by users read

        by anonymous auth

#

# if no access controls are present, the default policy

# allows anyone and everyone to read anything but restricts

# updates to rootdn.  (e.g., "access to * by * read")

#

# rootdn can always read and write EVERYTHING!

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

# BDB database definitions

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

database        hdb

suffix          "dc=comparex-test,dc=cz"

#         <kbyte> <min>

checkpoint      32      30

rootdn          "cn=Manager,dc=comparex-test,dc=cz"

# Cleartext passwords, especially for the rootdn, should

# be avoid.  See slappasswd(8) and slapd.conf(5) for details.

# Use of strong authentication encouraged.

#rootpw         secret

rootpw          {SSHA}pVZfgCGnUrbBGhc47P3EHaTHbWMscMC9

# 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-ldbm

#directory      /var/lib/openldap-data

# Indices to maintain

index   objectClass     eq
```

thanks

----------

## nativemad

Hi, 

from the ebuild:

```
# HDB is only available with BerkDB

        myconf_berkdb='--enable-bdb --enable-ldbm-api=berkeley --enable-hdb=mod'

        myconf_gdbm='--disable-bdb --enable-ldbm-api=gdbm --disable-hdb'

```

if you have both (berkdb and gdbm), then hdb will get disabled!   :Wink: 

Cheers!

----------

## honp

Thanks, but still doesn`t work. Here is what i have:

```
USE="-gdbm" emerge openldap 

...

 * Using Berkeley DB for local backend

 * Found db version 4.5

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

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

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

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

./configure --prefix=/usr --build=i486-pc-linux-gnu --host=i486-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/lib/openldap --enable-slapd --enable-slurpd --enable-ldbm --enable-bdb --enable-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 --enable-relay=mod --enable-perl=mod --disable-sql --enable-crypt --disable-slp --enable-rewrite --enable-rlookups --enable-aci --enable-modules --enable-cleartext --enable-slapi --disable-lmpasswd --enable-dyngroup --enable-proxycache --enable-syncprov --enable-syslog --enable-dynamic --enable-local --enable-proctitle --disable-ipv6 --without-cyrus-sasl --disable-spasswd --enable-wrappers --with-tls

Configuring OpenLDAP 2.3.43-Release ...

...

checking db.h usability... yes

checking db.h presence... yes

checking for db.h... yes

checking for Berkeley DB major version... 4

checking for Berkeley DB minor version... 5

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

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

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

checking for Berkeley DB version match... yes

checking for Berkeley DB thread support... yes

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

...

* Messages for package net-nds/openldap-2.3.43:

 * Adding back_dnssrv.so

 * Adding back_hdb.so

 * Adding back_meta.so
```

and still the same

```
gentoo-clear ~ # /etc/init.d/slapd start

 * Caching service dependencies ...                                                                                                                                                                      [ ok ]

 * Starting ldap-server ...

Unrecognized database type (hdb)                                                                                                                                                                         [ !! ]

gentoo-clear ~ # 
```

what i think that is strange is in log:

```
May 15 11:20:01 gentoo-clear cron[19177]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons )

May 15 11:25:56 gentoo-clear slapd[17992]: @(#) $OpenLDAP: slapd 2.3.43 (May 15 2009 11:23:45) $        root@gentoo-clear:/var/tmp/portage/net-nds/openldap-2.3.43/work/openldap-2.3.43/servers/slapd

May 15 11:25:56 gentoo-clear slapd[17992]: /etc/openldap/slapd.conf: line 62: <database> failed init (hdb)!

May 15 11:25:56 gentoo-clear slapd[17992]: slapd stopped.

May 15 11:25:56 gentoo-clear slapd[17992]: connections_destroy: nothing to destroy
```

root@gentoo-clear:/var/tmp/portage/net-nds/openldap-2.3.43/work/openldap-2.3.43/servers/slapd

Honza

----------

## nativemad

Hmm... mine is working over here...!??

I've just done a "USE=-gdbm emerge openldap" and it worked...

Could you check that  /usr/lib/openldap/openldap/back_hdb.so is a valid symlink and has enough rights for "world" to execute?

It could also be helpful to have a bit more output... -place a "-d 128" in the "OPTS" in /etc/conf.d/slapd.

----------

## honp

lrwxrwxrwx 1 root root 22 May 15 11:25 /usr/lib/openldap/openldap/back_hdb.so -> back_hdb-2.3.so.0.2.31

----------

## honp

When i append -d 128:

```
gentoo-clear ~ # /etc/init.d/slapd start

 * Starting ldap-server ...

@(#) $OpenLDAP: slapd 2.3.43 (May 15 2009 11:23:45) $

   root@gentoo-clear:/var/tmp/portage/net-nds/openldap-2.3.43/work/openldap-2.3.43/servers/slapd

Unrecognized database type (hdb)

/etc/openldap/slapd.conf: line 62: <database> failed init (hdb)!

slapd stopped.

connections_destroy: nothing to destroy.                                                                                                                                                                 [ !! ]

gentoo-clear ~ #
```

as i said, the strange thing is this:

root@gentoo-clear:/var/tmp/portage/net-nds/openldap-2.3.43/work/openldap-2.3.43/servers/slapd

why it execute slapd from this place?

----------

## nativemad

 :Laughing: 

After i copied your config and tested it, i've found one lovely thing!

WHITESPACES!!

You should not start a new definition in slapd.conf with a whitespace or tab!! These are used for longer statements like acls!!   :Wink: 

..another case, where "nothing" can cause trouble!   :Twisted Evil: 

Cheers and enjoy the Weekend!  :Razz: 

----------

## honp

Nativemad, thank you very very much, now it works. 

When you are in Prague, don`t forgot to contact me, i owe you glass (or more) of beer:)

Honza

----------

## nativemad

 *Quote:*   

> root@gentoo-clear:/var/tmp/portage/net-nds/openldap-2.3.43/work/openldap-2.3.43/servers/slapd 

 

I think this is coming from where it is compiled! My production Server also claims that, but it has no portage at all on it!    :Shocked: 

Ok, hopefully i will be there soon!   :Razz: 

----------

