[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Slapd database goes corrupt repeatedly after recovery

On 25.03.2010, at 14:27, Dieter Kluenter wrote:

> Kaspar Fischer <kaspar.fischer@....org> writes:
>> Dear list,
>> We are using an OpenLDAP/slapd server to manage the user accounts of
>> our Samba server and have recently run into the problem that users
>> cannot connect to Samba drives anymore after some time. Samba
>> complains that it cannot connect to the LDAP server (see below for
>> error message in Samba log) and the slapd log shows
> [...]
>>  Mar 25 11:38:15 office-server slapd[3433]: bdb(dc=foo,dc=org): file
>> id2entry.bdb has LSN 1/382892, past end of log at 1/283666
> [...]
>> Strangely, restarting slapd helps and users can use Samba again for a
>> limited and arbitrary period of time until the problem pops up
>> again. I tried fixing the database using
>>  db4.7_recover -v -h /var/lib/ldap
>> but again, the problem pops up again later.
> [...]
> For some unknown reason the last transaction logfile has been removed,
> therefor the database connot be recovered. Unfortunately you have to
> rebuild the database
> -Dieter


First of all, thanks for your prompt and helpful reply!

I have just rebuild the database and will check now whether that did it.

For the sake of completeness (for others with similar problems), here's how I rebuilt the db:

  /etc/init.d/slapd stop
  slapcat -l slapd-export.ldif -f /etc/ldap/slapd.conf -b "dc=foo,dc=org"
  rm -fr /var/lib/ldap/ # make sure this IS the path to your db as specified in slapd.conf
  mkdir /var/lib/ldap/
  chgrp -R openldap /var/lib/ldap/; chown -R openldap /var/lib/ldap/
  /etc/init.d/slapd start # creates an empty db
  /etc/init.d/slapd stop
  slapadd -l slapd-export.ldif -f /etc/ldap/slapd.conf -b "dc=foo,dc=org"
  chgrp -R openldap /var/lib/ldap/; chown -R openldap /var/lib/ldap/
  /etc/init.d/slapd start