Results 1 to 3 of 3

Thread: complete data loss due to corrupted LDAP BDB files?

  1. #1
    atseog is offline Starter Member
    Join Date
    Aug 2011
    Location
    Vienna/Austria
    Posts
    2
    Rep Power
    3

    Default complete data loss due to corrupted LDAP BDB files?

    Hi folks,

    one of my customers' zimbra server was restarted due to power loss recently. The machine runs zimbra "Release 7.1.0_GA_3140.UBUNTU8_64 UBUNTU8_64 FOSS edition." on ubuntu 8.04 LTS. The bad news: there is no backup and there is no UPS.

    So much for the unchangeable facts.

    Now the symptoms:

    Starting zimbra fails at the attempt to start ldap. The zimbra.log says:

    Code:
    Aug 10 16:01:31 zimbra slapd[27737]: @(#) $OpenLDAP: slapd 2.4.23 (Mar  4 2011 19:31:58) $ ^Iroot@zre-ubuntu8-64.eng.vmare.com:/home/build/p4/HELIX/ThirdParty/openldap/openldap-2.4.23.6z/servers/slapd 
    Aug 10 16:01:31 zimbra slapd[27737]: str2entry: entry -1 has no dn 
    Aug 10 16:01:31 zimbra slapd[27737]: slapd stopped. 
    Aug 10 16:01:31 zimbra slapd[27737]: connections_destroy: nothing to destroy.
    When I try to start slapd a bit more verbosely an irritating new issue arises:

    Code:
    zimbra@zimbra:~$ sudo /opt/zimbra/libexec/zmslapd -f /opt/zimbra/openldap/etc/openldap/slapd.conf -d 256                 
    @(#) $OpenLDAP: slapd 2.4.23 (Mar  4 2011 19:31:58) $
    	root@zre-ubuntu8-64.eng.vmare.com:/home/build/p4/HELIX/ThirdParty/openldap/openldap-2.4.23.6z/servers/slapd
    Unrecognized database type (bdb)
    /opt/zimbra/openldap/etc/openldap/slapd.conf: line 53: <database> failed init (bdb)
    slapd stopped.
    connections_destroy: nothing to destroy.
    Recipes that do *not* work for me:

    There are several threads around here, pointing out how to:
    * recover from backups (obviously not an option)
    * db_recover from zimbras packaged bdb tools happily returns "0" and changes not a single file, when run inside /opt/zimbra/data/ldap/hdb/db
    * dumping and regenerating the bdb files with db_dump - db_load (as proposed on a bdb mailing list) seems to modify some files (they slightly shrink in size) but fails to make slapd happy too.
    * of course slapd has bdb support _not_ compiled as a module (this is the standard reply from openldap folks) and the configuration is exactly the same as it is in a fresh zimbra installation.

    I even tried to reinstall zimbra from the original tarball. The installer finds the existing ldap database, tries to recover, fails and then happily loops over the steps start ldap - fail - try to recover - ignore failure - start ldap - ...

    No harm seems to be done to the mailstore. There are dozens of message within the 'store' directory and they seem to be intact. I could even write a script, collecting the files, sorting them by recipient and creating a maildir od maibox structure per user. This could be imported to a newly installed zimbra server. But users would loose their folders within the inbox, since that information is exclusively stored in ldap.

    Is it true, that a corrupted bdb file prevents me from using this system ever again? There must be a way to fix that file, or at least extract the remaining data.

    Any hints are welcome ...

  2. #2
    atseog is offline Starter Member
    Join Date
    Aug 2011
    Location
    Vienna/Austria
    Posts
    2
    Rep Power
    3

    Default

    Well, since nobody seemed to be able to help, I finally solved it myself.

    Here is what I found out:

    After starting slapd under strace, I saw that it complained about a file named ''/opt/zimbra/data/ldap/config/cn=config.ldif'', which, obviously due to the power loss, was empty.

    Checking the contents of the same file on a different Zimbra server, I decided to try and start with a copy of that file on the local machine ...

    Then there was another missing file (strace comes in handy some times ;-) ): ''/opt/zimbra/data/ldap/config/cn=config/olcDatabase={2}hdb.ldif''.

    This file was also copied from a working zimbra instance and: slapd started!

    So, my advice to all of you, who find "str2entry: entry -1 has no dn" in zimbra.log try this at home:

    Code:
    root@zimbra:~# strace -eopen /opt/zimbra/libexec/zmslapd -l LOCAL0 -u zimbra -h "ldapi:///" -F /opt/zimbra/data/ldap/config -d 1
    greetings

  3. #3
    Martin M is offline Starter Member
    Join Date
    Apr 2014
    Posts
    1
    Rep Power
    1

    Default

    One reason, why it is hard to find the missing config data is that when doing the DebugStart, the output of /opt/zimbra/libexec/zmslapd is filtered in the ldap startup script (/opt/zimbra/bin/ldap line 84).

    If you run this command manually, it shows the name of the corrupt file:
    bind_url='ldap://<your.host.name>:389'
    sudo /opt/zimbra/libexec/zmslapd -l LOCAL0 -u zimbra -h "${bind_url} ldapi:///" -F /opt/zimbra/data/ldap/config -d 1

    @(#) $OpenLDAP: slapd 2.4.26 (Sep 7 2011 12:24:46) $
    root@zre-ubuntu10-64:/home/build/p4/HELIX/ThirdParty/openldap/openldap-2.4.26.5z/servers/slapd
    ldap_pvt_gethostbyname_a: host=mx.kon5.de, r=0
    daemon_init: listen on ldap://<your.host.name>:389
    daemon_init: listen on ldapi:///
    daemon_init: 2 listeners to open...
    ldap_url_parse_ext(ldap://<your.host.name>:389)
    daemon: listener initialized ldap://<your.host.name>:389
    ldap_url_parse_ext(ldapi:///)
    daemon: listener initialized ldapi:///
    daemon_init: 2 listeners opened
    ldap_create
    slapd init: initiated server.
    slap_sasl_init: initialized!
    backend_startup_one: starting "cn=config"
    ldif_read_file: read entry file without checksum: "/opt/zimbra/data/ldap/config/cn=config.ldif"
    => str2entry: ""
    str2entry: entry -1 has no dn
    send_ldap_result: conn=-1 op=0 p=0
    slapd destroy: freeing system resources.
    slapd stopped.
    connections_destroy: nothing to destroy.
    Unfortunately, this useful information is not shown in zimbra.log, especially
    dif_read_file: read entry file without checksum: "/opt/zimbra/data/ldap/config/cn=config.ldif"
    => str2entry: ""
    And normally, it's
    /opt/zimbra/data/ldap/config/cn=config.ldif
    /opt/zimbra/data/ldap/config/cn=config/olcDatabase={2}hdb.ldif
    that get lost and can be replaced by another working zimbra installation.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. System crash leads to major MySQL corruption
    By Glider Guider in forum Administrators
    Replies: 1
    Last Post: 08-01-2011, 11:03 AM
  2. Replies: 2
    Last Post: 02-12-2008, 11:55 AM
  3. [SOLVED] ldap errors on zimbra start
    By jimbo in forum Administrators
    Replies: 1
    Last Post: 01-14-2008, 09:51 AM
  4. Zimbra + Samba LDAP auth problems
    By fajarpri in forum Installation
    Replies: 3
    Last Post: 07-04-2007, 11:39 PM
  5. 3 testing: LDAP: 389 Failed when restore zimbra
    By victorLeong in forum Administrators
    Replies: 15
    Last Post: 05-24-2007, 06:45 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •