[an error occurred while processing this directive] LDAP data recovery

LDAP data recovery

Our LDAP server with 470 days' uptime had to be switched off because vital maintenance of the transformers and switch gear of the laboratory's sub station was necessary. Of course when power returned, the server's hard disk had bad blocks all over its root partition, including /sbin/init and /etc/ldap/. Luckily /var was fine, and the Debian LDAP server's underlying database files were stored in /var/lib/ldap.

After preparing another box to act as a replacement LDAP server, the issue was how to extract the data from said directory, given that the old db utilities were no longer accessible, and the replacement server was much newer.

In the end I installed a new instance of openldap on a test box, with its slapd.conf pointing at

database        bdb
directory       /var/openldap/openldap-data

and copied all the files from the old server's equivalent directory (/var/lib/ldap) into /var/openldap/openldap-data. slapcat didn't cooperate, giving

... bdb_db_open: database "...": dbenv_open(/var/openldap/openldap-data).
... bdb(...): Program version 4.8 doesn't match environment version 0.18304
... bdb_db_open: database "..." cannot be opened, err -30971. Restore from backup!
The underlying error being:
db4_verify: Program version 4.8 doesn't match environment version 0.18304
db4_verify: DB_ENV->open: DB_VERSION_MISMATCH: Database environment version mismatch

The point of this page is that it took a while to find

cd /var/openldap/openldap-data
rm __db.* log.*
for i in *.bdb; do db4_load -r lsn $i; done
for i in *.bdb; do db4_upgrade $i; done

as the steps needed to allow a successful

slapcat -l dump.ldif

and dump.ldif could be loaded into the production server.

Of course to upgrade db files properly given the old database utilities, the standard process should be followed.

Patrick Welche, Inference Group, Cavendish Laboratory.

AEGIS logo The Dasher project is supported by the Gatsby Foundation
and by the European Commission in the context of
the AEGIS project — open Accessibility Everywhere: Groundwork, Infrastructure, Standards)