Etat des lieux

Depuis samedi suite à une tentative de reindexation de la base par slapindex, le service d'OpenLDAP ne voulait plus démarrer...

J'ai donc eu l'erreur suivante dans monfichier de log /var/log/slapd.log

@(#) $OpenLDAP: slapd 2.3.30 (Dec 13 2006 15:54:43) $       buildd@palmer:/build/buildd/openldap2.3-2.3.30/debian/build/servers/slapd
/etc/ldap/slapd.conf: line 113: rootdn is always granted unlimited privileges.
/etc/ldap/slapd.conf: line 130: rootdn is always granted unlimited privileges.
nss_ldap: could not connect to any LDAP server as (null) - Can't contact LDAP server
nss_ldap: failed to bind to LDAP server ldap://127.0.0.1: Can't contact LDAP server
nss_ldap: could not connect to any LDAP server as (null) - Can't contact LDAP server
nss_ldap: failed to bind to LDAP server ldap://127.0.0.1: Can't contact LDAP server
nss_ldap: could not search LDAP server - Server is unavailable
nss_ldap: could not connect to any LDAP server as (null) - Can't contact LDAP server
nss_ldap: failed to bind to LDAP server ldap://127.0.0.1: Can't contact LDAP server
nss_ldap: could not connect to any LDAP server as (null) - Can't contact LDAP server
nss_ldap: failed to bind to LDAP server ldap://127.0.0.1: Can't contact LDAP server
nss_ldap: could not search LDAP server - Server is unavailable
bdb_db_open: Database cannot be opened, err 13. Restore from backup!
bdb(dc=chezdavid,dc=local): DB_ENV->lock_id_free interface requires an environment configured for the locking subsystem
bdb(dc=chezdavid,dc=local): txn_checkpoint interface requires an environment configured for the transaction subsystem
bdb_db_close: txn_checkpoint failed: Invalid argument (22)
backend_startup_one: bi_db_open failed! (13)
bdb_db_close: alock_close failed
slapd stopped.
connections_destroy: nothing to destroy.

La solution

  1. Localiser le répertoire de la base pour le serveur et s'y rendre Pour le localiser, on regarde dans le fichier de configuration de OpenLDAP. Pour moi, il s'agit de /etc/ldap/slapd.conf. On repère la ligne contenant le terme directory
    root@olivia:~# grep directory /etc/ldap/slapd.conf
    # The base of your directory in database #1
    directory       "/var/lib/ldap"
    # The base of your directory for database #2
    donc
    cd /var/lib/ldap
  2. Ensuite on lancer un restore en faisant db4.2_recover
    db4.2_recover
  3. Ensuite on supprime le fichier de lock
    rm -f alock

Et on redémarre tranquillement son serveur

/etc/init.d/slapd start
Cool ça fonctionne à nouveau!!!