Core: 10.0.4 upgrade error utf8mb4 key was too long

Created on 17 Jan 2018  路  10Comments  路  Source: owncloud/core

I'm on a relatively new setup using the owncloud docker system.
https://github.com/owncloud-docker/server/issues/39#issuecomment-358310234

I started with 10.0.1 (or 2) just a few months ago, then upgraded to 10.0.3. The upgrade to 10.0.4 didn't go through without errors. The system stayed in maintenance mode. Here's the error I'm seeing:

$ sudo docker-compose exec owncloud occ upgrade
ownCloud 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
2018-01-17T12:39:20+00:00 Set log level to debug
2018-01-17T12:39:20+00:00 Repair step: Repair MySQL database engine
2018-01-17T12:39:20+00:00 Repair step: Repair MySQL collation
2018-01-17T12:39:20+00:00 Repair info: Change collation for oc_accounts ...
2018-01-17T12:39:20+00:00 Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'ALTER TABLE `oc_accounts` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;':

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
2018-01-17T12:39:20+00:00 Update failed
2018-01-17T12:39:20+00:00 Maintenance mode is kept active
2018-01-17T12:39:20+00:00 Reset log level

How can we solve this for me and others?

Bug server

Most helpful comment

Just remove https://github.com/owncloud-docker/server/blob/master/docker-compose.yml#L22 and also make sure that your config.php doesn't contain mysql.utf8mb, than you should be safe for the upgrade. Sorry for moving you into the wrong direction initially.

In the meantime I will check how to auto migrate an instance if this option is enabled.

All 10 comments

What is your mysql version?

I think this is the main cause: https://github.com/owncloud-docker/base/pull/9

(Since the rest of the - dependent - PRs for the 4-byte support: https://github.com/owncloud-docker/base/issues/4#issuecomment-336499477 were merged without this one)

In the meantime you can try to switch OWNCLOUD_UTF8MB4_ENABLED to false on your docker-compose.yml (ref. https://github.com/owncloud-docker/server/pull/22/files#diff-4e5e90c6228fd48698d074241c2ba760R22)

cc/ @tboerger

You can not directly connect it to your issue @SamuAlfageme. If the owncloud instance have been installed with the flag enabled there is no need to execute the occ command. If somebody has enabled the utf8mb4 option afterwards you have to execute the occ command on your own.

@tboerger I did not set any special settings. The whole point in using the docker system was to NOT maintain my own set of special settings any more 馃槄
I went back to 10.0.3 because this is my production system. Please let me know if there is anything I can do or if you need me to test anything. (didn't become clear in your message) Otherwise I'll wait for 10.0.5 and try upgrading again...

@DeepDiver1975 maybe @tboerger can answer your question.

@deepdiver1975 it looks like the occ upgrade command tries to use utf8mb4 even without enabling it, is that possible?

@deepdiver1975 scratch that.

@ThomDietrich have you also updated the docker-compose config? Or have you only changed the used docker image? If you have updated the docker-compose config you have to remove the utf8mb4 environment variable because there is no automated way to enable it afterwards.

Not sure what you mean. My process was to set VERSION=10.0.4 in .env and to replace docker-compose.yml by the latest version. By what you said I suppose the latter was wrong!? Thanks for your help!

remove the utf8mb4 environment variable

how/where/what? 馃槃

Just remove https://github.com/owncloud-docker/server/blob/master/docker-compose.yml#L22 and also make sure that your config.php doesn't contain mysql.utf8mb, than you should be safe for the upgrade. Sorry for moving you into the wrong direction initially.

In the meantime I will check how to auto migrate an instance if this option is enabled.

@tboerger it worked. I honestly didn't see that option when I tried to do what you said in the answer before that 馃憮 Thanks for your help! I'll close this issue as I believe this is https://github.com/owncloud-docker/server/issues/39 after all? Best!

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rehoehle picture rehoehle  路  4Comments

PVince81 picture PVince81  路  4Comments

jnweiger picture jnweiger  路  4Comments

ho4ho picture ho4ho  路  3Comments

gxgani picture gxgani  路  5Comments