nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.44k stars 4.08k forks source link

Update from v15 to v16.01 Failed #15739

Closed Manchichi closed 5 years ago

Manchichi commented 5 years ago

Steps to reproduce

  1. Installed Nextcloud 15 automatically some months ago on vServer
  2. Tried to update today via Web UI "Update Launcher"
  3. Update failed due to database error

Expected behaviour

Update via Update Launcher should have completed successful to Nextcloud v16.01

Actual behaviour

Update fails with an error message.

Server configuration

Initial Configuration and Nextcloud (+ needed Services for Nextcloud) used this Guide: https://websiteforstudents.com/install-nextcloud-on-ubuntu-16-04-lts-with-apache2-mariadb-php-7-1-and-lets-encrypt-ssl-tls/

Operating system: Ubuntu 16.04.6

Web server: Apache2

Database: MariaDB

PHP version: 7.1

Nextcloud version: (see Nextcloud admin page) 15.07

Updated from an older Nextcloud/ownCloud or fresh install: Tried to update from 15.07 to 16.01 - now can't do anything else than trying to start the Update again over the Web UI

Where did you install Nextcloud from: Official Nextcloud Repository

Signing status:

Signing status ``` Login as admin user into your Nextcloud and access http://example.com/index.php/settings/integrity/failed paste the results here. ```

List of activated apps:

App list Nextcloud will be updated to version 16.0.1 These apps will be updated: Accessibility (accessibility) Activity (activity) Auditing / Logging (admin_audit) Cloud Federation API (cloud_federation_api) Comments (comments) WebDAV (dav) Federated file sharing (federatedfilesharing) Federation (federation) Files (files) PDF viewer (files_pdfviewer) File sharing (files_sharing) Text editor (files_texteditor) Deleted files (files_trashbin) Versions (files_versions) Video player (files_videoplayer) First run wizard (firstrunwizard) Gallery (gallery) Log Reader (logreader) Lookup Server Connector (lookup_server_connector) Nextcloud announcements (nextcloud_announcements) Notifications (notifications) OAuth 2.0 (oauth2) Password policy (password_policy) Provisioning API (provisioning_api) Monitoring (serverinfo) Share by mail (sharebymail) Usage survey (survey_client) Collaborative tags (systemtags) Theming (theming) Two factor backup codes (twofactor_backupcodes) Update notification (updatenotification) Files workflow engine (workflowengine) These incompatible apps will be disabled: Calendar (calendar) External sites (external) ``` If you have access to your command line run e.g.: sudo -u www-data php occ app:list from within your Nextcloud installation folder ```

Nextcloud configuration:

Config report ``` { "system": { "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "***REMOVED SENSITIVE VALUE***" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "dbtype": "mysql", "version": "15.0.7.0", "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "oc_", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "mysql.utf8mb4": true, "maintenance": false, "updater.secret": "***REMOVED SENSITIVE VALUE***", "theme": "", "loglevel": 2 } } ```

Client configuration

Browser: Firefox

Operating system: Win 10 x64

Logs

Nextcloud log (data/nextcloud.log)

Nextcloud log ``` Update to 16.0.1 Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'CREATE TABLE oc_login_flow_v2 (id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, timestamp BIGINT UNSIGNED NOT NULL, started SMALLINT UNSIGNED DEFAULT 0 NOT NULL, poll_token VARCHAR(255) NOT NULL, login_token VARCHAR(255) NOT NULL, public_key TEXT NOT NULL, private_key TEXT NOT NULL, client_name VARCHAR(255) NOT NULL, login_name VARCHAR(255) DEFAULT NULL, server VARCHAR(255) DEFAULT NULL, app_password VARCHAR(1024) DEFAULT NULL, UNIQUE INDEX poll_token (poll_token), UNIQUE INDEX login_token (login_token), INDEX timestamp (timestamp), 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 Detailed logs Preparing update Set log level to debug Turned on maintenance mode Repair step: Repair MySQL collation Repair info: Change row format for oc_addressbooks ... Repair info: Change collation for oc_addressbooks ... Repair info: Change row format for oc_appconfig ... Repair info: Change collation for oc_appconfig ... Repair info: Change row format for oc_authtoken ... Repair info: Change collation for oc_authtoken ... Repair info: Change row format for oc_bruteforce_attempts ... Repair info: Change collation for oc_bruteforce_attempts ... Repair info: Change row format for oc_calendar_invitations ... Repair info: Change collation for oc_calendar_invitations ... Repair info: Change row format for oc_calendar_resources ... Repair info: Change collation for oc_calendar_resources ... Repair info: Change row format for oc_calendar_rooms ... Repair info: Change collation for oc_calendar_rooms ... Repair info: Change row format for oc_calendarchanges ... Repair info: Change collation for oc_calendarchanges ... Repair info: Change row format for oc_calendarobjects ... Repair info: Change collation for oc_calendarobjects ... Repair info: Change row format for oc_calendarobjects_props ... Repair info: Change collation for oc_calendarobjects_props ... Repair info: Change row format for oc_calendars ... Repair info: Change collation for oc_calendars ... Repair info: Change row format for oc_calendarsubscriptions ... Repair info: Change collation for oc_calendarsubscriptions ... Repair info: Change row format for oc_cards ... Repair info: Change collation for oc_cards ... Repair info: Change row format for oc_cards_properties ... Repair info: Change collation for oc_cards_properties ... Repair info: Change row format for oc_comments ... Repair info: Change collation for oc_comments ... Repair info: Change row format for oc_comments_read_markers ... Repair info: Change collation for oc_comments_read_markers ... Repair info: Change row format for oc_credentials ... Repair info: Change collation for oc_credentials ... Repair info: Change row format for oc_dav_shares ... Repair info: Change collation for oc_dav_shares ... Repair info: Change row format for oc_directlink ... Repair info: Change collation for oc_directlink ... Repair info: Change row format for oc_e2e_encryption_lock ... Repair info: Change collation for oc_e2e_encryption_lock ... Repair info: Change row format for oc_file_locks ... Repair info: Change collation for oc_file_locks ... Repair info: Change row format for oc_filecache ... Repair info: Change collation for oc_filecache ... Repair info: Change row format for oc_files_trash ... Repair info: Change collation for oc_files_trash ... Repair info: Change row format for oc_flow_checks ... Repair info: Change collation for oc_flow_checks ... Repair info: Change row format for oc_flow_operations ... Repair info: Change collation for oc_flow_operations ... Repair info: Change row format for oc_group_admin ... Repair info: Change collation for oc_group_admin ... Repair info: Change row format for oc_group_user ... Repair info: Change collation for oc_group_user ... Repair info: Change row format for oc_groups ... Repair info: Change collation for oc_groups ... Repair info: Change row format for oc_jobs ... Repair info: Change collation for oc_jobs ... Repair info: Change row format for oc_migrations ... Repair info: Change collation for oc_migrations ... Repair info: Change row format for oc_mimetypes ... Repair info: Change collation for oc_mimetypes ... Repair info: Change row format for oc_mounts ... Repair info: Change collation for oc_mounts ... Repair info: Change row format for oc_notes_meta ... Repair info: Change collation for oc_notes_meta ... Repair info: Change row format for oc_notifications ... Repair info: Change collation for oc_notifications ... Repair info: Change row format for oc_notifications_pushtokens ... Repair info: Change collation for oc_notifications_pushtokens ... Repair info: Change row format for oc_oauth2_access_tokens ... Repair info: Change collation for oc_oauth2_access_tokens ... Repair info: Change row format for oc_oauth2_clients ... Repair info: Change collation for oc_oauth2_clients ... Repair info: Change row format for oc_preferences ... Repair info: Change collation for oc_preferences ... Repair info: Change row format for oc_properties ... Repair info: Change collation for oc_properties ... Repair info: Change row format for oc_schedulingobjects ... Repair info: Change collation for oc_schedulingobjects ... Repair info: Change row format for oc_share ... Repair info: Change collation for oc_share ... Repair info: Change row format for oc_share_external ... Repair info: Change collation for oc_share_external ... Repair info: Change row format for oc_storages ... Repair info: Change collation for oc_storages ... Repair info: Change row format for oc_systemtag ... Repair info: Change collation for oc_systemtag ... Repair info: Change row format for oc_systemtag_group ... Repair info: Change collation for oc_systemtag_group ... Repair info: Change row format for oc_systemtag_object_mapping ... Repair info: Change collation for oc_systemtag_object_mapping ... Repair info: Change row format for oc_trusted_servers ... Repair info: Change collation for oc_trusted_servers ... Repair info: Change row format for oc_twofactor_backupcodes ... Repair info: Change collation for oc_twofactor_backupcodes ... Repair info: Change row format for oc_twofactor_providers ... Repair info: Change collation for oc_twofactor_providers ... Repair info: Change row format for oc_users ... Repair info: Change collation for oc_users ... Repair info: Change row format for oc_vcategory ... Repair info: Change collation for oc_vcategory ... Repair info: Change row format for oc_vcategory_to_object ... Repair info: Change collation for oc_vcategory_to_object ... Repair info: Change row format for oc_whats_new ... Repair info: Change collation for oc_whats_new ... Repair info: Change row format for oc_federated_reshares ... Repair info: Change collation for oc_federated_reshares ... Repair step: Repair SQLite autoincrement Repair step: Copy data from accounts table when migrating from ownCloud Repair step: Drop account terms table when migrating from ownCloud Updating database schema Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'CREATE TABLE oc_login_flow_v2 (id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, timestamp BIGINT UNSIGNED NOT NULL, started SMALLINT UNSIGNED DEFAULT 0 NOT NULL, poll_token VARCHAR(255) NOT NULL, login_token VARCHAR(255) NOT NULL, public_key TEXT NOT NULL, private_key TEXT NOT NULL, client_name VARCHAR(255) NOT NULL, login_name VARCHAR(255) DEFAULT NULL, server VARCHAR(255) DEFAULT NULL, app_password VARCHAR(1024) DEFAULT NULL, UNIQUE INDEX poll_token (poll_token), UNIQUE INDEX login_token (login_token), INDEX timestamp (timestamp), 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 The update was unsuccessful. Please report this issue to the Nextcloud community. ```
kesselb commented 5 years ago

Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

Looks like utf8mb4 is enabled but your database server is not properly setup. Mind to check the documentation? https://docs.nextcloud.com/server/16/admin_manual/configuration_database/mysql_4byte_support.html

Duplicate of #15058

Manchichi commented 5 years ago

Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

Looks like utf8mb4 is enabled but your database server is not properly setup. Mind to check the documentation? https://docs.nextcloud.com/server/16/admin_manual/configuration_database/mysql_4byte_support.html

Duplicate of #15058

Thanks for your quick reply. Since the link didn't load (seems like I can't reach docs.nextcloud.com atm) i searched elsewhere and got to solve the issue using following two commands in ssh server console:

Solution

sudo -u www-data php occ config:system:set mysql.utf8mb4 --type boolean --value="false"
sudo -u www-data php occ maintenance:repair
kesselb commented 5 years ago

Documentation is also on github. Here is the link: https://github.com/nextcloud/documentation/blob/master/admin_manual/configuration_database/mysql_4byte_support.rst

Manchichi commented 5 years ago

I actually used that guide before, because the Nextcloud WebUI Overview (which shows system health and configuration suggestions) told me to do these steps in order to optimize my configuration.

Particulary the following step

sudo -u www-data php occ config:system:set mysql.utf8mb4 --type boolean --value="true"

led to the issue stated in my opening post. When I set the value to true, I get a database error. But by setting the value to false and using the php occ maintenance:repair command the update was able to finish itself within the next minute.

kesselb commented 5 years ago

If you are running into "Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes" your database server (eg. mariadb or mysql) is not ready for utf8mb4. Change the configuration like suggested in the docs.

JarbyDev commented 5 years ago

Same Issue here, I have to set the value to false, in order to finish the update.