Problem:
Ldapserver does not start anymore:
root@ucs:~# service slapd start
[…] Check database: …[info] Could not determine BDB version of /var/lib/univention-ldap/ldap.
[info] Skipping /usr/bin/db5.1_recover to avoid damage.
[FAIL] Starting ldap server(s): slapd …failed.
[info] 60476bbd OVER: Loading Translog Overlay 60476bbd OVER: db_init 60476bbd OVER: Configuring Translog Overlay 60476bbd OVER: Configured Translog Overlay to use file
“/var/lib/univention-ldap/listener/listener” 60476bcf bdb(dc=schein,dc=lokal): unable to join the environment 60476bcf bdb_db_open: database “dc=schein,dc=lokal” cannot
be opened, err 11. Restore from backup! 60476bcf backend_startup_one (type=bdb, suffix=“dc=schein,dc=lokal”): bi_db_open failed! (11) slap_startup failed.
Solution:
Stop running and relevant services:
root@ucs:~#systemctl stop univention-directory-listener.service
root@ucs:~#systemctl stop univention-s4-connector.service
root@ucs:~#/etc/init.d/slapd stop
root@ucs:~#slapcat -l slapd-export.ldif -f /etc/ldap/slapd.conf -b "$(ucr get ldap/base)"
root@ucs:~#mv /var/lib/univention-ldap/ldap /var/lib/univention-ldap/ldap-2021-03-09
root@ucs:~#mkdir /var/lib/univention-ldap/ldap/
root@ucs:~#cp /var/lib/univention-ldap/ldap-2021-03-09/DB_CONFIG /var/lib/univention-ldap/ldap/
root@ucs:~#chown -R openldap.openldap /var/lib/univention-ldap/ldap
root@ucs:~#chmod +x /var/lib/univention-ldap/ldap
root@ucs:~#/etc/init.d/slapd start # creates an empty db
root@ucs:~#/etc/init.d/slapd stop
root@ucs:~#slapadd -l slapd-export.ldif -f /etc/ldap/slapd.conf -b "$(ucr get ldap/base)"
root@ucs:~#chown -R openldap.openldap /var/lib/univention-ldap/ldap
root@ucs:~#/etc/init.d/slapd start
root@ucs:~#systemctl start univention-directory-listener.service
root@ucs:~#systemctl start univention-s4-connector.service
This may be also applicable to ldap with mdb!
Additional:
With mdb backend it could
also be the case, that the translog database is corrupt also. An indication could be the slapd stopping, when the notifier tries to update a change. A test for that could be the mdb_copy command:
# systemctl stop univention-directory-notifier.service
# systemctl stop slapd.service
# mkdir /var/lib/univention-ldap/translog-new
# mdb_copy -c /var/lib/univention-ldap/translog /var/lib/univention-ldap/translog-new
If you get a BUS ERROR proceed with “translog db fix” otherwise you can fullfill the mdb_copy, to get more db space → Article Step 2 →
# mv /var/lib/univention-ldap/translog /var/lib/univention-ldap/translog-old
# mv /var/lib/univention-ldap/translog-new /var/lib/univention-ldap/translog
# systemctl start slapd.service
# systemctl start univention-directory-notifier.service
or leave it here and start the ldap and notifier services .
Otherwise you do “translog db fix”
translog db fix
# systemctl stop univention-directory-notifier.service
# mkdir univention-support/
# cd univention-support/
# slapcat -s cn=translog >> translog.ldif
# mv /var/lib/univention-ldap/translog /var/lib/univention-ldap/translog.bak
# mkdir /var/lib/univention-ldap/translog
# chown openldap.openldap /var/lib/univention-ldap/translog
# /etc/init.d/slapd start
# /etc/init.d/slapd stop
# cp /var/lib/univention-ldap/translog.bak/DB_CONFIG /var/lib/univention-ldap/translog/
# chown -R openldap.openldap /var/lib/univention-ldap/translog
# /etc/init.d/slapd start
# slapadd -n 2 -l translog.ldif
# systemctl start univention-directory-notifier.service
An other option may be found here.
See also: