Update fails with MySql error 1878 on Database Migration


Steps to reproduce

  1. Updating OC 8.2.7 to 8.2.11 via Web-Frontend
  2. Trying to update 8.2.11 to 9.0.11 via Web-Frontend

Expected behaviour

updating the database

Actual behaviour

Update stops with message

OC\DB\MigrationException: An exception occurred while executing 'ALTER TABLE oc_oc_filecache_opulluws00dme ADD `checksum` VARCHAR(255) DEFAULT NULL': SQLSTATE[HY000]: General error: 1878 Temporary file write failure.

Server configuration

Operating system: Debian 6

Web server: Apache

Database: Mysql

PHP version: 5.5.11

ownCloud version: between 8.2.11 and 9.0.11

Updated from an older ownCloud or fresh install: between 8.2.11 and 9.0.11

Where did you install ownCloud from: official

Signing status (ownCloud 9.0 and above): cannot login

The content of config/config.php: cannot login

List of activated apps: cannot login


Web server error log

nothing relevant found

PHP error log

[28-Oct-2018 05:18:00 UTC] {"reqId":"W9VGiFQmQzYAADpeiTQAAAAH","remoteAddr":"","app":"core","message":"starting upgrade from to","level":0,"time":"2018-10-28T05:18:00+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=BDthLxEEIWk4DCc3dwZ8Xg43EjceJ38bKhlmKT4NGHM%3D%3AMn%2BIiBlYpcwTOA2lGDBzOt9ROKVsIJR1KZNhAT7o5hM%3D","user":"--"}
[28-Oct-2018 05:18:03 UTC] {"reqId":"W9VGiFQmQzYAADpeiTQAAAAH","remoteAddr":"","app":"core","message":"Simulated database structure update failed (exception 'OC\\DB\\MigrationException' with message 'An exception occurred while executing 'ALTER TABLE oc_oc_filecache_iq6yjdf4cx51a ADD `checksum` VARCHAR(255) DEFAULT NULL':\n\nSQLSTATE[HY000]: General error: 1878 Temporary file write failure.' in \/home\/owncloud\/owncloud\/lib\/private\/db\/migrator.php:152\nStack trace:\n#0 \/home\/owncloud\/owncloud\/lib\/private\/db\/migrator.php(110): OC\\DB\\Migrator->checkTableMigrate(Object(Doctrine\\DBAL\\Schema\\Table))\n#1 \/home\/owncloud\/owncloud\/lib\/private\/db\/mdb2schemamanager.php(129): OC\\DB\\Migrator->checkMigrate(Object(Doctrine\\DBAL\\Schema\\Schema))\n#2 \/home\/owncloud\/owncloud\/lib\/private\/db.php(202): OC\\DB\\MDB2SchemaManager->simulateUpdateDbFromStructure('\/home\/owncloud\/...')\n#3 \/home\/owncloud\/owncloud\/lib\/private\/updater.php(365): OC_DB::simulateUpdateDbFromStructure('\/home\/owncloud\/...')\n#4 \/home\/owncloud\/owncloud\/lib\/private\/updater.php(315): OC\\Updater->checkCoreUpgrade()\n#5 \/home\/owncloud\/owncloud\/lib\/private\/updater.php(212): OC\\Updater->doUpgrade('', '')\n#6 \/home\/owncloud\/owncloud\/core\/ajax\/update.php(120): OC\\Updater->upgrade()\n#7 {main})","level":4,"time":"2018-10-28T05:18:03+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=BDthLxEEIWk4DCc3dwZ8Xg43EjceJ38bKhlmKT4NGHM%3D%3AMn%2BIiBlYpcwTOA2lGDBzOt9ROKVsIJR1KZNhAT7o5hM%3D","user":"--"}
[28-Oct-2018 05:18:03 UTC] {"reqId":"W9VGiFQmQzYAADpeiTQAAAAH","remoteAddr":"","app":"core","message":"Exception: {\"Exception\":\"OC\\\\DB\\\\MigrationException\",\"Message\":\"An exception occurred while executing 'ALTER TABLE oc_oc_filecache_iq6yjdf4cx51a ADD `checksum` VARCHAR(255) DEFAULT NULL':\\n\\nSQLSTATE[HY000]: General error: 1878 Temporary file write failure.\",\"Code\":0,\"Trace\":\"#0 \\\/home\\\/owncloud\\\/owncloud\\\/lib\\\/private\\\/db\\\/migrator.php(110): OC\\\\DB\\\\Migrator->checkTableMigrate(Object(Doctrine\\\\DBAL\\\\Schema\\\\Table))\\n#1 \\\/home\\\/owncloud\\\/owncloud\\\/lib\\\/private\\\/db\\\/mdb2schemamanager.php(129): OC\\\\DB\\\\Migrator->checkMigrate(Object(Doctrine\\\\DBAL\\\\Schema\\\\Schema))\\n#2 \\\/home\\\/owncloud\\\/owncloud\\\/lib\\\/private\\\/db.php(202): OC\\\\DB\\\\MDB2SchemaManager->simulateUpdateDbFromStructure('\\\/home\\\/owncloud\\\/...')\\n#3 \\\/home\\\/owncloud\\\/owncloud\\\/lib\\\/private\\\/updater.php(365): OC_DB::simulateUpdateDbFromStructure('\\\/home\\\/owncloud\\\/...')\\n#4 \\\/home\\\/owncloud\\\/owncloud\\\/lib\\\/private\\\/updater.php(315): OC\\\\Updater->checkCoreUpgrade()\\n#5 \\\/home\\\/owncloud\\\/owncloud\\\/lib\\\/private\\\/updater.php(212): OC\\\\Updater->doUpgrade('', '')\\n#6 \\\/home\\\/owncloud\\\/owncloud\\\/core\\\/ajax\\\/update.php(120): OC\\\\Updater->upgrade()\\n#7 {main}\",\"File\":\"\\\/home\\\/owncloud\\\/owncloud\\\/lib\\\/private\\\/db\\\/migrator.php\",\"Line\":152}","level":3,"time":"2018-10-28T05:18:03+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=BDthLxEEIWk4DCc3dwZ8Xg43EjceJ38bKhlmKT4NGHM%3D%3AMn%2BIiBlYpcwTOA2lGDBzOt9ROKVsIJR1KZNhAT7o5hM%3D","user":"--"}

ownCloud log (data/owncloud.log)

{"reqId":"W7n7QlQmQzYAADEYHvwAAAAH","remoteAddr":"","app":"core","message":"starting upgrade from to","level":0,"time":"2018-10-07T12:25:38+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=CiptBAM6OBczTBlwMjgONh8MGDp%2BEGJYST82MFZC%3AyhYK5NBdjgO7QSMG4MOcNZ7o9KBAar"}

So I found that the error means that there might not be enough space for executing the command and copying the table. But that is odd because the table “filecache” is only around 16MB.
Any ideas where to start?

Thanks in Adavance!



Make sure that this upgrade path is supported.
I recommend a manual update, as described in the docs.
Do not use the Web-Frontend.


Hi Alfred,

thanks for the comment.

Tried again manually with console command … result seems to be the same
From what I understand from the doc the upgrade path should be alright because the two versions are the latest between the major releases 8.2 and 9.0

So I downloaded 9.0.11 again unpacked it an copied config.php as necessary
Then I ran

./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
Set log level to debug
Turned on maintenance mode
Checking whether the database schema can be updated (this can take a long time depending on the database size)
OC\DB\MigrationException: An exception occurred while executing 'ALTER TABLE oc_oc_filecache_b37jzipmsu47p ADD `checksum` VARCHAR(255) DEFAULT NULL':

SQLSTATE[HY000]: General error: 1878 Temporary file write failure.
Update failed
Maintenance mode is kept active
Reset log level

Is there a way to reduce the size of the tables?
For now I have the problem with “oc_filecache” but “oc_activity” is even bigger.
Sure this would not actually solve the problem, but seems like a workaround for now. I actually want to upgrade the machine, startet with Owncloud and grinding my teeth about it already.


I don’t know how to reduce the size of those tables, unless to empty them.

Are you running out of disk space?



there was a discussion around this recently in Upgraded from 8.1 to 8.2 which came to the conclusion that it seems you’re able to go directly from 8.2.11 to the latest 10.0.10: Upgraded from 8.1 to 8.2



yes and no.
Apparently /tmp is being used for the altering command by mysql.
There was a very small partition mounted on /tmp.
So I created a new /temp somewhere and pointed to it in my.cnf
What is odd is that the update before worked just fine.

Then there have been some hickups with the occ script due to permission settings. Fixed.

Now the upgrade has been successfull but the calendar not working anymore :frowning:
But thats a project for another day.

Thanks, even if it was a problem with the machine.