Problem: After Upgrade Kopano does not Start

kopano
upgrade
mysql
problem
mariadb

#1

Problem

Your Kopano server does not start up after upgrading to UCS 4.3.

Case 1

You will see those errors in logs:

Mon Mar 26 11:29:37 2018: [error  ] SQL [00000023] Failed: Cannot load from mysql.proc. The table is probably corrupted, Query Size: 33, Query: "DROP PROCEDURE IF EXIST$
Mon Mar 26 11:29:37 2018: [error  ] KDatabase::I_Update() query failed: DROP PROCEDURE IF EXISTS GetProps: Cannot load from mysql.proc. The table is probably corrupted
Mon Mar 26 11:29:37 2018: [error  ] Can't initialize database settings

Case 2

You will see the following in the logfile /var/log/kopano/server.log:

Mon Nov 19 08:38:16 2018: [error  ] K-1216: Cannot update to schema v69, because the "names" table contains unexpected rows. Certain prior versions of the server erroneously allowed these duplicates to be added (KC-1108).
Mon Nov 19 08:38:16 2018: [error  ] K-1220: To fix the excess rows, use `kopano-dbadm k-1216`. Consult the manpage and preferably make a backup first.
Mon Nov 19 08:38:16 2018: [error  ] K-1221: Alternatively, the server may be started with --ignore-da to forego the schema update.
Mon Nov 19 08:38:16 2018: [warning] WARNING: Unable to upgrade database from version 8.6.2.0.68 to 8.6.2.0.70
Mon Nov 19 08:38:16 2018: [warning]    You can force the server to start with --ignore-database-version-conflict
Mon Nov 19 08:38:16 2018: [warning]    Warning, you can lose data! If you don't know what you're doing, you shouldn't be using this option!
Mon Nov 19 08:38:16 2018: [=======] Server shutdown complete.

Solution

Case 1

Sometimes during the upgrade the database upgrade procedure is not run correctly. You can start the conversion manually by:
/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf

If this runs without an error your Kopano server should now start.

Case 2

According to Kopano article do the following:

systemctl stop mysql
tar czpvf /root/mysql_backup.tar.gz /var/lib/mysql/ # to backup your database
systemctl start mysql
kopano-dbadm k-1216
systemctl start kopano-server

If this runs without an error your Kopano server should now be started.


#2