UCS update fails with verify_translog_schema

Problem:

UCS update fails with verify_translog_schema.

...
Checking valid_machine_credentials ...            OK
Checking verify_translog_schema ...               FAIL

The system can not be updated to UCS 5.1 due to the following reasons:

verify_translog_schema:
        There is a problem with the translog schema on this system.
        Please check /var/log/univention/updater.log or run 'slapcat -f /etc/ldap/slapd.conf  -n 3 | slapadd -f /etc/ldap/slapd.conf -n 3 -u' manually.
        Please see <https://help.univention.com/t/23981> for more information.

This can happen when an OpenLDAP schema extension was used in the past but has been uninstalled and some objects in the history of cn=translog stil reference attributes from that schema in the reqDN. Examples are: univentionVirtualMachineUUID and univentionCorporateClientSessionName.

Solution:

Download fix_translog_schema.sh
and run the script with

bash fix_translog_schema.sh

This script looks for the last entry in cn=translog that causes a problem with slapd schema validation and runs univention-translog prune to truncate the transaction history, basically following Problem: Prune transaction log. The same caveats apply.