# slapd fails to start after upgrade



## Niccolas Dewaele (Feb 19, 2015)

Hi,

I did an upgrade of my FreeBSD server and after this, slapd fails to start.

The log says that :

```
Feb 19 22:34:05 ldap slapd[97197]: @(#) $OpenLDAP: slapd 2.4.40 (Feb 11 2015 12:45:09) $    root@10amd64-default-job-17:/wrkdirs/usr/ports/net/openldap24-server/work/openldap-2.4.40/servers/slapd
Feb 19 22:34:05 ldap slapd[97197]: lt_dlopenext failed: (back_bdb) file not found
Feb 19 22:34:05 ldap slapd[97197]: slapd stopped.
Feb 19 22:34:05 ldap slapd[97197]: connections_destroy: nothing to destroy.
```
My upgrade : FreeBSD 10.0 -> 10.1
`freebsd-update -r 10.1-RELEASE upgrade`
`freebsd-update install`
`reboot`
`freebsd-update install`
`pkg upgrade`
`service slapd restart`

`pkg upgrade` has upgraded openldap-server and client :

```
openldap-server: 2.4.39_1 -> 2.4.40_3
  openldap-client: 2.4.39 -> 2.4.40_1
```
I'm new on FreeBSD and I don't know how to resolve that.

Thanks,
Nicolas


----------



## junovitch@ (Feb 19, 2015)

Well the "bdb" string reminds me of Berkeley DB.  How long has it been since the system was updated?  Does the 20140318 entry in /usr/ports/UPDATING apply?

`less -p 20140318 /usr/ports/UPDATING` will take you right there assuming the ports(7) collection is up to date.  Otherwise the entry follows.


> 20140318:
> AFFECTS: users of net/openldap24-server
> AUTHOR: delphij@FreeBSD.org
> 
> ...


----------



## Niccolas Dewaele (Feb 19, 2015)

I see.
I upgraded this server today but I don't know when it was upgraded before because I wasn't the sysadmin.
I have no idea how it's complicated to change LDAP backend from bdb to mdb.

Thanks for your answer


----------



## junovitch@ (Feb 19, 2015)

Actually looking at the version number at net/openldap24-server it looks like it was updated in August 2014.  Therefore the entry from that day applies.  It looks like the Berkeley DB backend still works for the time being just needs to be one of the newer versions supported upstream.

`less -p 20140821 /usr/ports/UPDATING`


> 20140821:
> AFFECTS: users of databases/db4, databases/db4[1-7]*
> AUTHOR: mandree@FreeBSD.org
> 
> ...


----------



## gqgunhed (Feb 20, 2015)

Hi Niccolas Dewaele, I had a similar problem after my upgrade to 10.1-RELEASE, but coming from 9.2 ;-) I could not get my `slapd` up again with the bdb database backend.
I have to look up the exact information how I solved it in my own bugtracker database, but as far as I remember I did the following because I was unable to get my old database backend up again:


```
# find the location of your LDAP database within your /usr/local/etc/openldap/slapd.conf
# e.g. /var/db/openldap-data
grep ^directory /usr/local/etc/openldap/slapd.conf

# make backup of existing LDAP storage
# if LDAP database resides in /var/db/openldap-data
cp -Ra /var/db/openldap-data /var/db/openldap-data.bdb

# change BDB to MDB within /usr/local/etc/openldap/slapd.conf
# find the line "database bdb" and change it to:
database mdb

# restart slapd
/usr/local/etc/rc.d/slapd restart

# if really everything works, cleanup LDAP database backup
rm -R /var/db/openldap-data.bdb
```

As far as I remember the mdm backend recovered the bdb database just fine.

Additonal hint:
Dump your running LDAP database in LDIF format for easy backup (database backend independent) with slapcat(8) like so (see Examples section within `man slapcat`:

```
slapcat -l /usr/local/etc/openldap/ldif.backup
```

Please report back if that worked for you.


----------

