Problem: S4Cache: sqlite: database disk image is malformed

Problem:

The connecotr shows:
18.01.2022 12:33:57.838 LDAP (WARNING): S4Cache: sqlite: database disk image is malformed.

Investigation:

sqlite3 /etc/univention/connector/s4cache.sqlite 'PRAGMA integrity_check;'
* in database main *
Page 1509: btreeInitPage() returns error code 11
Page 2043: btreeInitPage() returns error code 11
Page 1511: btreeInitPage() returns error code 11
[..]

Solution:

:~ $ systemctl stop univention-s4-connector
:~ $ ( sqlite3 /etc/univention/connector/s4cache.sqlite  ".dump" | sqlite3 s4cache.sqlite.new )> s4cache.sqlite.new.log 2>&1
:~ $ mv s4cache.sqlite s4cache.sqlite.brocken
:~ $ mv s4cache.sqlite.new s4cache.sqlite
:~ $ sqlite3 /etc/univention/connector/s4cache.sqlite 'PRAGMA integrity_check;'
ok
:~ $ systemctl start univention-s4-connector
Mastodon