My server running zimbra crashed hard and now the zimbra server won't start. Here is what I get in the logs:
Nov 24 21:04:14 zimbra1 slapd[21258]: @(#) $OpenLDAP: slapd 2.4.21 (Mar 24 2010 18:25:37) $ [email protected]:/home/build/p4/main/ThirdParty/openldap/openldap-2.4.21.7z/servers/slapd
Nov 24 21:04:15 zimbra1 slapd[21265]: bdb(): file id2entry.bdb has LSN 7/8194631, past end of log at 7/6485128
Nov 24 21:04:15 zimbra1 slapd[21265]: bdb(): Commonly caused by moving a database from one database environment
Nov 24 21:04:15 zimbra1 slapd[21265]: bdb(): to another without clearing the database LSNs, or by removing all of
Nov 24 21:04:15 zimbra1 slapd[21265]: bdb(): the log files from a database environment
Nov 24 21:04:15 zimbra1 slapd[21265]: bdb(): /opt/zimbra/data/ldap/hdb/db/id2entry.bdb: unexpected file type or format
Nov 24 21:04:15 zimbra1 slapd[21265]: hdb_db_open: database "": db_open(/opt/zimbra/data/ldap/hdb/db/id2entry.bdb) failed: Invalid argument (22).
Nov 24 21:04:16 zimbra1 slapd[21265]: backend_startup_one (type=hdb, suffix=""): bi_db_open failed! (22)
Nov 24 21:04:16 zimbra1 slapd[21265]: bdb_db_close: database "": alock_close failed
zmcontrol -v:
Release 6.0.6_GA_2324.RHEL5_20100406144520 CentOS5 FOSS edition.
Perl version 5.8.8
db_recover -V:
Berkeley DB 4.7.25: (May 15, 2008)
From the errors you've posted it looks as if the databased used by
slapd
, the LDAP server, has become corrupt. There are a number of things you can try. First, make a backup of your data even though its corrupt! Some of the suggestions here may modify the database files and preclude alternate recovery suggestions.NB: I know nothing about Zimbra, but I've worked with OpenLDAP quite a bit. There may be Zimbra-specific things you should be doing that I know nothing about.
The easiest would be to simply restore your database from backups. I'm not familiar with Zimbra in particular, but most applications that integrate tightly with an LDAP backend include some form of periodic dump of the database to LDIF records. If you have such a backup, you can probably remove everything in your /opt/zimbra/data/ldap/hdb/db/ (SAVE IT FIRST!) and re-import from your backups. This procedure is probably described somewhere in the documentation.
If the
db_recover
tool is available on your system (this is a BerkeleyDB maintenance tool), you can see if the database is recoverable. Change to/opt/zimbra/data/ldap/hdb/db/
, and then rundb_recover -v -h .
. This may or may solve anything. If Zimbra uses OpenLDAP more recent than 2.2 (e.g., 2.3.x or later), this should happen automatically.