# OpenLDAP - failed to start `/usr/lib64/openldap/slapd'

## Wizumwalt

I've emerged openldap but can't get it to start. I'm doing this on a small local LAN, so no real domain name.

I made these changes to /etc/openldap/slapd.conf.

```

database        hdb

suffix          "dc=eme,dc=local"

#         <kbyte> <min>

checkpoint      32      30

rootdn          "cn=Manager,dc=eme,dc=local"                  

# Cleartext passwords, especially for the rootdn, should

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

# Use of strong authentication encouraged.

rootpw          {SSHA}aDDsx9o/AbMsksL1dLnxBBX6VdnCqbrc

```

Always fails w/ this error.

```

sudo /etc/init.d/slapd start

 * Starting ldap-server ...

 * start-stop-daemon: failed to start `/usr/lib64/openldap/slapd'         [ !! ]

 * ERROR: slapd failed to start

```

I emerged it with these USE flags.

```

USE="-gtk -gnome -X -opengl bindist mmx sse sse2 ssl ipv6 perl python crypt ncurses fortran f77 pam udev thin diags opensm mstflint perftest -systemd nfsv4 nfsv4.1 libmount nfsidmap tcpd uuid berkdb nls gnutls sasl syslog -minimal"

```

Here's the perms.

```

# pwd

/var/lib/openldap-data

# ls -l

total 836

-rw------- 1 ldap ldap    845 Sep 15 18:08 DB_CONFIG.example

-rw------- 1 ldap ldap  24576 Sep 15 19:01 __db.001

-rw------- 1 ldap ldap 114688 Sep 15 19:01 __db.002

-rw------- 1 ldap ldap 270336 Sep 15 19:01 __db.003

-rw------- 1 ldap ldap 163840 Sep 15 18:20 __db.004

-rw------- 1 ldap ldap 860160 Sep 15 19:01 __db.005

-rw------- 1 ldap ldap  32768 Sep 15 19:01 __db.006

-rw-r--r-- 1 ldap ldap   2048 Sep 15 19:01 alock

```

Any help much appreciated.

----------

## kikko

Hi Wizumwalt

have you already tried a config test? 

```
slaptest -v -d 1 -f /etc/openldap/slapd.conf
```

You can also raise the "loglevel" directive to 4 and look in /var/log/messages for errors from slapd daemon

----------

## Wizumwalt

I ran the slaptest line as above and posted the end of the slaptest which doesn't look normal.

```

...

56031cc7 slaptest startup: initiated.

56031cc7 backend_startup_one: starting "cn=config"

56031cc7 config_back_db_open

56031cc7 config_build_entry: "cn=config"

56031cc7 config_build_entry: "cn=schema"

56031cc7 >>> dnNormalize: <cn={0}core>

56031cc7 <<< dnNormalize: <cn={0}core>

56031cc7 config_build_entry: "cn={0}core"

56031cc7 >>> dnNormalize: <cn={1}cosine>

56031cc7 <<< dnNormalize: <cn={1}cosine>

56031cc7 config_build_entry: "cn={1}cosine"

56031cc7 >>> dnNormalize: <cn={2}inetorgperson>

56031cc7 <<< dnNormalize: <cn={2}inetorgperson>

56031cc7 config_build_entry: "cn={2}inetorgperson"

56031cc7 >>> dnNormalize: <cn={3}nis>

56031cc7 <<< dnNormalize: <cn={3}nis>

56031cc7 config_build_entry: "cn={3}nis"

56031cc7 >>> dnNormalize: <cn={4}misc>

56031cc7 <<< dnNormalize: <cn={4}misc>

56031cc7 config_build_entry: "cn={4}misc"

56031cc7 config_build_entry: "olcDatabase={-1}frontend"

56031cc7 config_build_entry: "olcDatabase={0}config"

56031cc7 config_build_entry: "olcDatabase={1}hdb"

56031cc7 backend_startup_one: starting "dc=eme,dc=local"

56031cc7 hdb_db_open: warning - no DB_CONFIG file found in directory /var/lib/openldap-data: (2).

Expect poor performance for suffix "dc=eme,dc=local".

56031cc7 hdb_db_open: database "dc=eme,dc=local": dbenv_open(/var/lib/openldap-data).

56031cc7 hdb_db_open: database "dc=eme,dc=local": db_open(/var/lib/openldap-data/id2entry.bdb) failed: No such file or directory (2).

56031cc7 ====> bdb_cache_release_all

56031cc7 backend_startup_one (type=hdb, suffix="dc=eme,dc=local"): bi_db_open failed! (2)

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

```

----------

## kikko

Hi Wizumwalt

 *Wizumwalt wrote:*   

> 
> 
> ```
> 56031cc7 hdb_db_open: database "dc=eme,dc=local": db_open(/var/lib/openldap-data/id2entry.bdb) failed: No such file or directory (2).
> ```
> ...

 

Is there something in "/var/lib/openldap-data" ?

Regards

----------

## Wizumwalt

I have the following in that dir. Could it be corrupt? I have tried thins in the past. How would I re-init this db?

```

# cd /var/lib/openldap-data/

openldap-data # ls -l

total 836

-rw------- 1 ldap ldap    845 Sep 15 18:08 DB_CONFIG.example

-rw------- 1 ldap ldap  24576 Sep 23 16:42 __db.001

-rw------- 1 ldap ldap 114688 Sep 23 16:42 __db.002

-rw------- 1 ldap ldap 270336 Sep 23 16:42 __db.003

-rw------- 1 ldap ldap 163840 Sep 15 18:20 __db.004

-rw------- 1 ldap ldap 860160 Sep 23 16:42 __db.005

-rw------- 1 ldap ldap  32768 Sep 23 16:42 __db.006

-rw-r--r-- 1 ldap ldap   2048 Sep 23 16:42 alock

```

----------

## kikko

Hi Wizumwalt

I'm not sure about what happened to your OpenLDAP, but it seems that newer versions store configurations in LDAP itself

you can follow this guide go get around your error: http://apfelboymchen.net/gnu/notes/openldap%20config%20backend.html

It looks like you have to start OpenLDAP with a proper slapd.conf file in order to get those initial files  

Let me know 

Regards

----------

## Wizumwalt

I have OpenLDAP now running on the server. From what I'm understanding, the next step seems to be adding an ldap client to the hosts that I want to use with the server.

Can someone recommend one that works well w/ Gentoo, easy for a small number of people, commandline, no desktop.

----------

## kikko

Hi Wizumwalt

don't want to get into your business, but what are you trying to do? LDAP Centralized Authentication doesn't require specific client tools installed, AFAIK PAM module handles queries itself

https://wiki.gentoo.org/wiki/Centralized_authentication_using_OpenLDAP contains indications of what to merge for this purpose

On the other hand, if you need a CLI interface for other reasons, the only one that comes to my mind is the OpenLDAP "suite" of tools (ldapsearch for searches, ldapmodify for commits and so on... even Apache Directory Studio relies on these under the hood). 

If you need it on Gentoo clients, you can emerge openldap with the "minimal" USE flag enabled

Regards

----------

