Nextcloud version (eg, 12.0.2): 14.0.3
Operating system and version (eg, Ubuntu 17.04): Ubuntu Server 18.04.1
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.29
PHP version (eg, 7.1): 7.2.10
DB: MariaDB 10.1.34
The issue you are facing:
The short version is that an index of one (or more, not sure) of the database tables got corrupted. As to how that might have happened, a few days ago I found out that my entire filesystem was read-only. I used fsck
to fix the issues and that’s probably how the index became corrupted. Here is the error from Apache2’s error.log:
PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1712 Index oc_file_locks is corrupted in /var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:105\nStack trace:\n#0 /var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php(105): PDOStatement->execute(NULL)\n#1 /var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1006): Doctrine\\DBAL\\Driver\\PDOStatement->execute()\n#2 /var/www/html/lib/private/DB/Connection.php(216): Doctrine\\DBAL\\Connection->executeUpdate('UPDATE `oc_file...', Array, Array)\n#3 /var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php(208): OC\\DB\\Connection->executeUpdate('UPDATE `oc_file...', Array, Array)\n#4 /var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php(214): Doctrine\\DBAL\\Query\\QueryBuilder->execute()\n#5 /var/www/html/lib/private/Lock/DBLockingProvider.php(310): OC\\DB\\QueryBuilder\\QueryBuilder->execute()\n#6 [internal function]: OC\\Lock\\DBLockingProvider->releaseAll()\n#7 {main}\n\nNext Doctrine\\D in /var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php on line 115
The same error comes when I try to do mysqldump
:
mysqldump: Error 1712: Index oc_file_locks is corrupted when dumping table `oc_file_locks` at row: 0
What options do I have? Is it possible to recreate the index? If so, how? Or I could restore a mysqldump from a few days ago, before it happened. Will I be able to update the database with the new files?
Another option I see is to replace the current virtual machine with a backup from before 3 weeks (the nextcloud is running inside a VM with a local mariadb). Data folder is on another physical hard disk drive, so it shouldn’t be corrupted. Is there a way to update the database with the new files that the users have uploaded/changed in those 3 weeks?
Any hints are appreciated.
Is this the first time you’ve seen this error? (Y/N): Y
Steps to replicate it: Probably not, the original cause of issue might be a failing HDD
The output of your Nextcloud log in Admin > Logging: I cannot log in, all requests end up on Nextcloud’s “Internal Server Error” page. I have added logging to config.php
and the error message is the same as above: index of oc_file_locks is corrupted.
The output of your config.php file in /path/to/nextcloud
(make sure you remove any identifiable information!):
<?php
$CONFIG = array (
'instanceid' => 'censored',
'passwordsalt' => 'censored',
'secret' => 'censored',
'trusted_domains' =>
array (
0 => 'cloud.domain1',
1 => 'cloud.domain2'
),
'trusted_proxies' =>
array (
0 =>
array (
0 => 'reverse proxy IP',
),
),
'forwarded_for_headers' =>
array (
0 => 'HTTP_X_FORWARDED',
1 => 'HTTP_FORWARDED_FOR',
),
'datadirectory' => '/mnt/cloud-data/',
'overwrite.cli.url' => 'https://cloud.domain1',
'dbtype' => 'mysql',
'version' => '14.0.3.0',
'dbname' => 'nextcloud',
'dbhost' => 'localhost',
'dbport' => '',
'dbtableprefix' => 'oc_',
'dbuser' => 'censored',
'dbpassword' => 'censored',
'installed' => true,
'memcache.local' => '\\OC\\Memcache\\APCu',
'mail_domain' => 'cloud.domain1',
'mail_from_address' => 'nextcloud',
'mail_smtpmode' => 'sendmail',
'mail_smtpauthtype' => 'LOGIN',
'maintenance' => false,
'theme' => '',
'loglevel' => 2,
'updater.secret' => 'censored',
);
The output of your Apache/nginx/system log in /var/log/____
:
No new error entries in /var/logs/apache2/errors.log