[Solved] Upgrade to 20.0.1 fails because Mail-App cannot be upgraded

Nextcloud version: from 19.0.4 to 20.0.1
Operating system and version: Debian 9 “stretch”
Apache or nginx version: Apache2
PHP version: 7.4
DB-Variant: MariaDB
DB-Character-Set: utf8mb4
DB-Engine: InnoDB
Old Mail-App Version: 1.6.0

Updating existing Instance (with active Mail-App) from 19.0.4 to 20.0.1 via web-based updater fails.

Maintenance-Mode is kept on + Informational Message when executing occ:

# sudo -u www-data php ./occ status
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade

Trying to Upgrade via occ

# sudo -u www-data php ./occ upgrade 
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Updating database schema
Updated database
Updating <mail> ...
Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'ALTER TABLE oc_mail_mailboxes ADD sync_in_background TINYINT(1) DEFAULT '0' NOT NULL':
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
Update failed
Maintenance mode is kept active
Resetting log level

Trying to deactivate Mail-App

# sudo -u www-data php ./occ app:disable mail
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
mail 1.6.0 disabled

Again - Trying to Upgrade System

# sudo -u www-data php ./occ upgrade
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Updating database schema
Updated database
Checking for update of app accessibility in appstore
Checked for update of app "accessibility" in appstore 
# [...]
Checking for update of app workflowengine in appstore
Checked for update of app "workflowengine" in appstore 
Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'CREATE TABLE oc_user_status (id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, user_id VARCHAR(255) NOT
NULL, status VARCHAR(255) NOT NULL, status_timestamp INT UNSIGNED NOT NULL, is_user_defined TINYINT(1) NOT NULL, message_id VARCHAR(255) DEFAULT NULL, custom_icon VARCHAR(255) 
DEFAULT NULL, custom_message LONGTEXT DEFAULT NULL, clear_at INT UNSIGNED DEFAULT NULL, UNIQUE INDEX user_status_uid_ix (user_id), INDEX user_status_clr_ix (clear_at), 
PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_bin` ENGINE = InnoDB ROW_FORMAT = compressed':
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
Update failed
Maintenance mode is kept active
Resetting log level

Reset to Snapshot and now running back on 19.0.4…
Thank you for your help :+1:

Fix your database tables before you try to update your installation. Many postings already exist on the forum which describe which need to be done to get this issue fixed:

https://help.nextcloud.com/search?q=Specified%20key%20was%20too%20long%3B%20max%20key%20length%20is%20767%20bytes

1 Like

Thank you! Searched with the wrong part of the error-Message…
Have a nice day!

1 Like