1

I upgraded openldap from openldap-2.4.39-8.el6.x86_64 to 2.4.40-12.el6.x86_64 and after restarting the server i get the following error. I am trying to work out how to recover as I don't have a backup.

586d0afc <<< dnNormalize: <cn=write>
586d0afc backend_startup_one: starting "dc=custsvc,dc=mycompany"
586d0afc bdb_db_open: "dc=custsvc,dc=mycompany"
586d0afc bdb_db_open: database "dc=custsvc,dc=mycompany": dbenv_open(/var/lib/ldap).
586d0afc bdb(dc=custsvc,dc=mycompany): file id2entry.bdb has LSN 1/720219, past end of log at 1/600
586d0afc bdb(dc=custsvc,dc=mycompany): Commonly caused by moving a database from one database environment
586d0afc bdb(dc=custsvc,dc=mycompany): to another without clearing the database LSNs, or by removing all of
586d0afc bdb(dc=custsvc,dc=mycompany): the log files from a database environment
586d0afc bdb(dc=custsvc,dc=mycompany): /var/lib/ldap/id2entry.bdb: unexpected file type or format
586d0afc bdb_db_open: database "dc=custsvc,dc=mycompany": db_open(/var/lib/ldap/id2entry.bdb) failed: Invalid argument (22).
586d0afc ====> bdb_cache_release_all
586d0afc backend_startup_one (type=bdb, suffix="dc=custsvc,dc=mycompany"): bi_db_open failed! (22)
586d0afc slapd shutdown: initiated
586d0afc ====> bdb_cache_release_all
586d0afc bdb_db_close: database "dc=custsvc,dc=mycompany": alock_close failed
586d0afc slapd destroy: freeing system resources.
586d0afc slapd stopped.
Tim Hughes
  • 313
  • 3
  • 10

1 Answers1

1

So after looking around the internet and not finding a solution that worked and the only recommended method appeared to be db_recover -v -h /var/lib/ldap/ which didn't work but I noticed it incremented the recovery checkpoint.

[root@lddev-build-par01 ~]# db_recover -v -h /var/lib/ldap/
Finding last valid log LSN: file: 1 offset 1632
Recovery complete at Wed Jan  4 14:52:26 2017
Maximum transaction ID 0 Recovery checkpoint [1][1632]
[root@lddev-build-par01 ~]# db_recover -v -h /var/lib/ldap/
Finding last valid log LSN: file: 1 offset 1724
Recovery complete at Wed Jan  4 14:52:26 2017
Maximum transaction ID 0 Recovery checkpoint [1][1724]

So after making sure I had a backup of my non working data I just ran that command many times until the recovery checkpoint was higher than where the BDB file thought the issue was. I didn't really expect it to work.

while true; do db_recover -v -h /var/lib/ldap/; done

But it did :-)

I wouldn't want to guarantee that there was no data loss but as this was a development environment it is not the end of the world and the test suite will soon find any issues. Hope this helps someone.

Tim Hughes
  • 313
  • 3
  • 10