30 July 2006

More OpenLDAP recovery...

I accidentally killed power to my Linux box while I was plugging in a new router. No biggie, except OpenLDAP wouldn't start again at reboot because the database got corrupted. I'm beginning to think that trying to use ldap as an address book just isn't worth it.

Anyway, problem resolved, thanks to PaulHowarth/Blog.

Here's the error I was getting:

[root@ldap]# /etc/rc.d/init.d/ldap start
Checking configuration files for slapd: bdb_db_open: unclean shutdown detected; attempting recovery.
bdb_db_open: Recovery skipped in read-only mode. Run manual recovery if errors are encountered.
bdb_db_open: Database cannot be opened, err 13. Restore from backup!
bdb(dc=mydomain,dc=com): DB_ENV->lock_id_free interface requires an environment configured for the locking subsystem
backend_startup_one: bi_db_open failed! (13)
slap_startup failed (test would succeed using the -u switch)
[FAILED]
stale lock files may be present in /var/lib/ldap [WARNING]


Here's how the database was repaired:


[root@ldap]# /usr/sbin/slapd_db_recover -v -h /var/lib/ldap
Finding last valid log LSN: file: 1 offset 5315883
Recovery starting from [1][5315755]
Recovery complete at Sun Jul 30 11:31:56 2006
Maximum transaction ID 8000040d Recovery checkpoint [1][5315883]


I also used the notes from PaulHowarth/Blog to add a checkpoint directive to slapd.conf.

7 comments:

fastpagemode said...

Had the same issue, same fix just worked. BDB on OpenLDAP locked up and wouldn't start, so a bdb recover fixed it. Just make sure after you run the bdb recover, you remember to chown the files back to ldap:ldap, or else it still will be busted.

ganesa said...

thanx for your help :)

Vladan said...

Thanks. It work exactly as you said it will.

Dhaval said...

Thank You Very Much For Your Help.

Dhaval

testz said...

Worked for me too. Thanks!

Unknown said...

Very cool - had a disk full issue on an ldap instance used for testing ldap stuff (e.g. deleting all users and recreation). filesystem was simply full so he stopped to work. Recover worked after the space issue was solved :)

Big THX!

Jeyaraj said...

Jeyaraj here:

Thanks a lot... Solution very perfect..