Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1091 Can't DROP 'PRIMARY' with upgrade 8.1.6->8.1.9 #25590

Closed
TrapperPhD opened this issue Jul 24, 2016 · 5 comments
Closed

1091 Can't DROP 'PRIMARY' with upgrade 8.1.6->8.1.9 #25590

TrapperPhD opened this issue Jul 24, 2016 · 5 comments
Milestone

Comments

@TrapperPhD
Copy link

TrapperPhD commented Jul 24, 2016

Dear all,

I face the following error message, and after spending days on Github and forums, I am stuck.

When trying to update 8.1.6 to 8.1.9, I get an error message concerning oc_appconfig in the database.

What I tried without success ...

  • MySQL not corrupt
  • DB Backup successfully restored
  • Owncloud user has all rights to owncloud DB
  • sudo -u www-data php occ maintenance:repair
  • no duplicate entries in database tables or other diverse stuff reported with similar issues on Github

Steps to reproduce

  1. download and extract owncloud 8.1.9 file from owncloud repos
  2. copy all files to /var/www/owncloud
  3. chown root:root /var/www/owncloud/occrights.sh && chmod u+x /var/www/owncloud/occrights.sh && sh /var/www/owncloud/occrights.sh
  4. sudo -u www-data php /var/www/owncloud/occ upgrade or sudo -u www-data php /var/www/owncloud/occ upgrade --skip-migration-test

*Expected behaviou
Upgrade should proceed and finish.

Actual behaviour
Error message ..

Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'ALTER TABLE oc_appconfig DROP PRIMARY KEY':

SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'PRIMARY'; check that column/key exists

Update failed

Server configuration
Operating system: Ubuntu 14.04.1
Web server: apache2
Database: Mysql 5.5.50, SQLite 3.8.2
PHP version: 5.6
ownCloud version: 8.1.6
Updated from an older ownCloud or fresh install: continuously updated since v6 via SUSE repos http://download.opensuse.org/repositories/isv:/ownCloud:/community/xUbuntu_14.04/

ownCloud log:

{"reqId":"jPKaRZr0kFDLNWqHQydo","remoteAddr":"","app":"PHP","message":"file_put_contents(\/var\/www\/owncloud\/data\/.htaccess): failed to open stream: Permission denied at \/var\/www\/owncloud\/lib\/private\/setup.php#435","level":3,"time":"2016-07-24T12:19:26+00:00","method":"--","url":"--"}
{"reqId":"jPKaRZr0kFDLNWqHQydo","remoteAddr":"","app":"core","message":"Failed to update database structure (exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'PRIMARY'; check that column\/key exists' in \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/PDOConnection.php:104\nStack trace:\n#0 \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/PDOConnection.php(104): PDO->query('ALTER TABLE oc_...')\n#1 \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(935): Doctrine\\DBAL\\Driver\\PDOConnection->query('ALTER TABLE oc_...')\n#2 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(219): Doctrine\\DBAL\\Connection->query('ALTER TABLE oc_...')\n#3 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(69): OC\\DB\\Migrator->applySchema(Object(Doctrine\\DBAL\\Schema\\Schema))\n#4 \/var\/www\/owncloud\/lib\/private\/db\/mdb2schemamanager.php(121): OC\\DB\\Migrator->migrate(Object(Doctrine\\DBAL\\Schema\\Schema))\n#5 \/var\/www\/owncloud\/lib\/private\/db.php(231): OC\\DB\\MDB2SchemaManager->updateDbFromStructure('\/var\/www\/ownclo...')\n#6 \/var\/www\/owncloud\/lib\/private\/updater.php(354): OC_DB::updateDbFromStructure('\/var\/www\/ownclo...')\n#7 \/var\/www\/owncloud\/lib\/private\/updater.php(322): OC\\Updater->doCoreUpgrade()\n#8 \/var\/www\/owncloud\/lib\/private\/updater.php(205): OC\\Updater->doUpgrade('8.1.9.2', '8.1.6.2')\n#9 \/var\/www\/owncloud\/core\/command\/upgrade.php(187): OC\\Updater->upgrade()\n#10 \/var\/www\/owncloud\/3rdparty\/symfony\/console\/Symfony\/Component\/Console\/Command\/Command.php(253): OC\\Core\\Command\\Upgrade->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#11 \/var\/www\/owncloud\/3rdparty\/symfony\/console\/Symfony\/Component\/Console\/Application.php(874): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#12 \/var\/www\/owncloud\/3rdparty\/symfony\/console\/Symfony\/Component\/Console\/Application.php(195): Symfony\\Component\\Console\\Application->doRunCommand(Object(OC\\Core\\Command\\Upgrade), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#13 \/var\/www\/owncloud\/3rdparty\/symfony\/console\/Symfony\/Component\/Console\/Application.php(126): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#14 \/var\/www\/owncloud\/lib\/private\/console\/application.php(96): Symfony\\Component\\Console\\Application->run(NULL, NULL)\n#15 \/var\/www\/owncloud\/console.php(68): OC\\Console\\Application->run()\n#16 \/var\/www\/owncloud\/occ(11): require_once('\/var\/www\/ownclo...')\n#17 {main}\n\nNext exception 'Doctrine\\DBAL\\Driver\\PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'PRIMARY'; check that column\/key exists' in \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/PDOConnection.php:106\nStack trace:\n#0 \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(935): Doctrine\\DBAL\\Driver\\PDOConnection->query('ALTER TABLE oc_...')\n#1 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(219): Doctrine\\DBAL\\Connection->query('ALTER TABLE oc_...')\n#2 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(69): OC\\DB\\Migrator->applySchema(Object(Doctrine\\DBAL\\Schema\\Schema))\n#3 \/var\/www\/owncloud\/lib\/private\/db\/mdb2schemamanager.php(121): OC\\DB\\Migrator->migrate(Object(Doctrine\\DBAL\\Schema\\Schema))\n#4 \/var\/www\/owncloud\/lib\/private\/db.php(231): OC\\DB\\MDB2SchemaManager->updateDbFromStructure('\/var\/www\/ownclo...')\n#5 \/var\/www\/owncloud\/lib\/private\/updater.php(354): OC_DB::updateDbFromStructure('\/var\/www\/ownclo...')\n#6 \/var\/www\/owncloud\/lib\/
private\/updater.php(322): OC\\Updater->doCoreUpgrade()\n#7 \/var\/www\/owncloud\/lib\/private\/updater.php(205): OC\\Updater->doUpgrade('8.1.9.2', '8.1.6.2')\n#8 \/var\/www\/owncloud\/core\/command\/upgrade.php(187): OC\\Updater->upgrade()\n#9 \/var\/www\/owncloud\/3rdparty\/symfony\/console\/Symfony\/Component\/Console\/Command\/Command.php(253): OC\\Core\\Command\\Upgrade->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#10 \/var\/www\/owncloud\/3rdparty\/symfony\/console\/Symfony\/Component\/Console\/Application.php(874): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#11 \/var\/www\/owncloud\/3rdparty\/symfony\/console\/Symfony\/Component\/Console\/Application.php(195): Symfony\\Component\\Console\\Application->doRunCommand(Object(OC\\Core\\Command\\Upgrade), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#12 \/var\/www\/owncloud\/3rdparty\/symfony\/console\/Symfony\/Component\/Console\/Application.php(126): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#13 \/var\/www\/owncloud\/lib\/private\/console\/application.php(96): Symfony\\Component\\Console\\Application->run(NULL, NULL)\n#14 \/var\/www\/owncloud\/console.php(68): OC\\Console\\Application->run()\n#15 \/var\/www\/owncloud\/occ(11): require_once('\/var\/www\/ownclo...')\n#16 {main}\n\nNext exception 'Doctrine\\DBAL\\Exception\\DriverException' with message 'An exception occurred while executing 'ALTER TABLE oc_appconfig DROP PRIMARY KEY':\n\nSQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'PRIMARY'; check that column\/key exists' in \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/AbstractMySQLDriver.php:115\nStack trace:\n#0 \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php(116): Doctrine\\DBAL\\Driver\\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\\DBAL\\Driver\\PDOException))\n#1 \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(945): Doctrine\\DBAL\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\DBAL\\Driver\\PDOMySql\\Driver), Object(Doctrine\\DBAL\\Driver\\PDOException), 'ALTER TABLE oc_...')\n#2 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(219): Doctrine\\DBAL\\Connection->query('ALTER TABLE oc_...')\n#3 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(69): OC\\DB\\Migrator->applySchema(Object(Doctrine\\DBAL\\Schema\\Schema))\n#4 \/var\/www\/owncloud\/lib\/private\/db\/mdb2schemamanager.php(121): OC\\DB\\Migrator->migrate(Object(Doctrine\\DBAL\\Schema\\Schema))\n#5 \/var\/www\/owncloud\/lib\/private\/db.php(231): OC\\DB\\MDB2SchemaManager->updateDbFromStructure('\/var\/www\/ownclo...')\n#6 \/var\/www\/owncloud\/lib\/private\/updater.php(354): OC_DB::updateDbFromStructure('\/var\/www\/ownclo...')\n#7 \/var\/www\/owncloud\/lib\/private\/updater.php(322): OC\\Updater->doCoreUpgrade()\n#8 \/var\/www\/owncloud\/lib\/private\/updater.php(205): OC\\Updater->doUpgrade('8.1.9.2', '8.1.6.2')\n#9 \/var\/www\/owncloud\/core\/command\/upgrade.php(187): OC\\Updater->upgrade()\n#10 \/var\/www\/owncloud\/3rdparty\/symfony\/console\/Symfony\/Component\/Console\/Command\/Command.php(253): OC\\Core\\Command\\Upgrade->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#11 \/var\/www\/owncloud\/3rdparty\/symfony\/console\/Symfony\/Component\/Console\/Application.php(874): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#12 \/var\/www\/owncloud\/3rdparty\/symfony\/console\/Symfony\/Component\/Console\/Application.php(195): Symfony\\Component\
\Console\\Application->doRunCommand(Object(OC\\Core\\Command\\Upgrade), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#13 \/var\/www\/owncloud\/3rdparty\/symfony\/console\/Symfony\/Component\/Console\/Application.php(126): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#14 \/var\/www\/owncloud\/lib\/private\/console\/application.php(96): Symfony\\Component\\Console\\Application->run(NULL, NULL)\n#15 \/var\/www\/owncloud\/console.php(68): OC\\Console\\Application->run()\n#16 \/var\/www\/owncloud\/occ(11): require_once('\/var\/www\/ownclo...')\n#17 {main})","level":4,"time":"2016-07-24T12:19:28+00:00","method":"--","url":"--"}
{"reqId":"jPKaRZr0kFDLNWqHQydo","remoteAddr":"","app":"update","message":"Exception: {\"Exception\":\"Doctrine\\\\DBAL\\\\Exception\\\\DriverException\",\"Message\":\"An exception occurred while executing 'ALTER TABLE oc_appconfig DROP PRIMARY KEY':\\n\\nSQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'PRIMARY'; check that column\\\/key exists\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/DBALException.php(116): Doctrine\\\\DBAL\\\\Driver\\\\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException))\\n#1 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(945): Doctrine\\\\DBAL\\\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOMySql\\\\Driver), Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException), 'ALTER TABLE oc_...')\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/db\\\/migrator.php(219): Doctrine\\\\DBAL\\\\Connection->query('ALTER TABLE oc_...')\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/db\\\/migrator.php(69): OC\\\\DB\\\\Migrator->applySchema(Object(Doctrine\\\\DBAL\\\\Schema\\\\Schema))\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/db\\\/mdb2schemamanager.php(121): OC\\\\DB\\\\Migrator->migrate(Object(Doctrine\\\\DBAL\\\\Schema\\\\Schema))\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/db.php(231): OC\\\\DB\\\\MDB2SchemaManager->updateDbFromStructure('\\\/var\\\/www\\\/ownclo...')\\n#6 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/updater.php(354): OC_DB::updateDbFromStructure('\\\/var\\\/www\\\/ownclo...')\\n#7 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/updater.php(322): OC\\\\Updater->doCoreUpgrade()\\n#8 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/updater.php(205): OC\\\\Updater->doUpgrade('8.1.9.2', '8.1.6.2')\\n#9 \\\/var\\\/www\\\/owncloud\\\/core\\\/command\\\/upgrade.php(187): OC\\\\Updater->upgrade()\\n#10 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Symfony\\\/Component\\\/Console\\\/Command\\\/Command.php(253): OC\\\\Core\\\\Command\\\\Upgrade->execute(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#11 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Symfony\\\/Component\\\/Console\\\/Application.php(874): Symfony\\\\Component\\\\Console\\\\Command\\\\Command->run(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#12 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Symfony\\\/Component\\\/Console\\\/Application.php(195): Symfony\\\\Component\\\\Console\\\\Application->doRunCommand(Object(OC\\\\Core\\\\Command\\\\Upgrade), Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#13 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Symfony\\\/Component\\\/Console\\\/Application.php(126): Symfony\\\\Component\\\\Console\\\\Application->doRun(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#14 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/console\\\/application.php(96): Symfony\\\\Component\\\\Console\\\\Application->run(NULL, NULL)\\n#15 \\\/var\\\/www\\\/owncloud\\\/console.php(68): OC\\\\Console\\\\Application->run()\\n#16 \\\/var\\\/www\\\/owncloud\\\/occ(11): require_once('\\\/var\\\/www\\\/ownclo...')\\n#17 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/AbstractMySQLDriver.php\",\"Line\":115}","level":4,"time":"2016-07-24T12:19:28+00:00","method":"--","url":"--"}
{"reqId":"TA26ie4BJYFJNjvjY7pm","remoteAddr":"","app":"PHP","message":"file_put_contents(\/var\/www\/owncloud\/data\/.htaccess): failed to open stream: Permission denied at \/var\/www\/owncloud\/lib\/private\/setup.php#435","level":3,"time":"2016-07-24T12:23:29+00:00","method":"--","url":"--"}
{"reqId":"TA26ie4BJYFJNjvjY7pm","remoteAddr":"","app":"core","message":"Simulated database structure update failed (exception 'OC\\DB\\MigrationException' with message 'An exception occurred while executing 'ALTER TABLE oc_oc_appconfig_rs8xe82z444ua DROP PRIMARY KEY':\n\nSQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'PRIMARY'; check that column\/key exists' in \/var\/www\/owncloud\/lib\/private\/db\/migrator.php:152\nStack trace:\n#0 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(110): OC\\DB\\Migrator->checkTableMigrate(Object(Doctrine\\DBAL\\Schema\\Table))\n#1 \/var\/www\/owncloud\/lib\/private\/db\/mdb2schemamanager.php(133): OC\\DB\\Migrator->checkMigrate(Object(Doctrine\\DBAL\\Schema\\Schema))\n#2 \/var\/www\/owncloud\/lib\/private\/db.php(248): OC\\DB\\MDB2SchemaManager->simulateUpdateDbFromStructure('\/var\/www\/ownclo...')\n#3 \/var\/www\/owncloud\/lib\/private\/updater.php(347): OC_DB::simulateUpdateDbFromStructure('\/var\/www\/ownclo...')\n#4 \/var\/www\/owncloud\/lib\/private\/updater.php(314): OC\\Updater->checkCoreUpgrade()\n#5 \/var\/www\/owncloud\/lib\/private\/updater.php(205): OC\\Updater->doUpgrade('8.1.9.2', '8.1.6.2')\n#6 \/var\/www\/owncloud\/core\/command\/upgrade.php(187): OC\\Updater->upgrade()\n#7 \/var\/www\/owncloud\/3rdparty\/symfony\/console\/Symfony\/Component\/Console\/Command\/Command.php(253): OC\\Core\\Command\\Upgrade->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#8 \/var\/www\/owncloud\/3rdparty\/symfony\/console\/Symfony\/Component\/Console\/Application.php(874): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#9 \/var\/www\/owncloud\/3rdparty\/symfony\/console\/Symfony\/Component\/Console\/Application.php(195): Symfony\\Component\\Console\\Application->doRunCommand(Object(OC\\Core\\Command\\Upgrade), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#10 \/var\/www\/owncloud\/3rdparty\/symfony\/console\/Symfony\/Component\/Console\/Application.php(126): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#11 \/var\/www\/owncloud\/lib\/private\/console\/application.php(96): Symfony\\Component\\Console\\Application->run(NULL, NULL)\n#12 \/var\/www\/owncloud\/console.php(68): OC\\Console\\Application->run()\n#13 \/var\/www\/owncloud\/occ(11): require_once('\/var\/www\/ownclo...')\n#14 {main})","level":4,"time":"2016-07-24T12:23:31+00:00","method":"--","url":"--"}
{"reqId":"TA26ie4BJYFJNjvjY7pm","remoteAddr":"","app":"update","message":"Exception: {\"Exception\":\"OC\\\\DB\\\\MigrationException\",\"Message\":\"An exception occurred while executing 'ALTER TABLE oc_oc_appconfig_rs8xe82z444ua DROP PRIMARY KEY':\\n\\nSQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'PRIMARY'; check that column\\\/key exists\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/db\\\/migrator.php(110): OC\\\\DB\\\\Migrator->checkTableMigrate(Object(Doctrine\\\\DBAL\\\\Schema\\\\Table))\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/db\\\/mdb2schemamanager.php(133): OC\\\\DB\\\\Migrator->checkMigrate(Object(Doctrine\\\\DBAL\\\\Schema\\\\Schema))\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/db.php(248): OC\\\\DB\\\\MDB2SchemaManager->simulateUpdateDbFromStructure('\\\/var\\\/www\\\/ownclo...')\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/updater.php(347): OC_DB::simulateUpdateDbFromStructure('\\\/var\\\/www\\\/ownclo...')\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/updater.php(314): OC\\\\Updater->checkCoreUpgrade()\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/updater.php(205): OC\\\\Updater->doUpgrade('8.1.9.2', '8.1.6.2')\\n#6 \\\/var\\\/www\\\/owncloud\\\/core\\\/command\\\/upgrade.php(187): OC\\\\Updater->upgrade()\\n#7 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Symfony\\\/Component\\\/Console\\\/Command\\\/Command.php(253): OC\\\\Core\\\\Command\\\\Upgrade->execute(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#8 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Symfony\\\/Component\\\/Console\\\/Application.php(874): Symfony\\\\Component\\\\Console\\\\Command\\\\Command->run(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#9 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Symfony\\\/Component\\\/Console\\\/Application.php(195): Symfony\\\\Component\\\\Console\\\\Application->doRunCommand(Object(OC\\\\Core\\\\Command\\\\Upgrade), Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#10 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Symfony\\\/Component\\\/Console\\\/Application.php(126): Symfony\\\\Component\\\\Console\\\\Application->doRun(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#11 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/console\\\/application.php(96): Symfony\\\\Component\\\\Console\\\\Application->run(NULL, NULL)\\n#12 \\\/var\\\/www\\\/owncloud\\\/console.php(68): OC\\\\Console\\\\Application->run()\\n#13 \\\/var\\\/www\\\/owncloud\\\/occ(11): require_once('\\\/var\\\/www\\\/ownclo...')\\n#14 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/db\\\/migrator.php\",\"Line\":152}","level":4,"time":"2016-07-24T12:23:31+00:00","method":"--","url":"--"}
{"reqId":"q3Q7yNkRhNZ5TF9Hzfuf","remoteAddr":"192.168.1.22","app":"index","message":"Exception: {\"Exception\":\"OC\\\\NeedsUpdateException\",\"Message\":\"\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/app.php(98): OC_App::loadApp('files')\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/util.php(127): OC_App::loadApps(Array)\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/base.php(876): OC_Util::setupFS()\\n#3 \\\/var\\\/www\\\/owncloud\\\/index.php(48): OC::handleRequest()\\n#4 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/app.php\",\"Line\":118}","level":4,"time":"2016-07-24T12:39:53+00:00"}

config.php:

<?php
$CONFIG = array (
  'instanceid' => 'oc3a41047555',
  'passwordsalt' => '*** removed for security reasons',
  'datadirectory' => '/var/www/owncloud/data',
  'dbtype' => 'sqlite3',
  'dbname' => 'ownclouddb',
  'dbhost' => 'localhost',
  'version' => '8.1.6.2',
  'installed' => true,
  'forcessl' => true,
  'theme' => '',
  'maintenance' => false,
  'trusted_domains' => 
  array (
    0 => '192.168.1.1',
    1 => 'localhost',
    2 => 'home.hyomain.de',
  ),
  'forceSSLforSubdomains' => true,
  'appcodechecker' => false,
  'xframe_restriction' => false,
  'cache_path' => '',
  'quota_include_external_storage' => false,
  'filesystem_check_changes' => 0,
  'appstore.experimental.enabled' => false,
  'updatechecker' => false,
);

php -m

[PHP Modules]
apc
apcu
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
igbinary
imap
intl
json
ldap
libsmbclient
libxml
mbstring
mcrypt
memcache
memcached
mhash
msgpack
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
pspell
readline
Reflection
session
shmop
SimpleXML
smbclient
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
wddx
xdebug
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Xdebug
Zend OPcache

Any ideas would be greatly appreciated.

Best
Chris

@DeepDiver1975 DeepDiver1975 added this to the 8.1.10 milestone Jul 25, 2016
@DeepDiver1975
Copy link
Member

Can I ask you to submit a mysql schema dump?
http://stackoverflow.com/questions/6175473/mysql-export-schema-without-data

@TrapperPhD
Copy link
Author

TrapperPhD commented Jul 25, 2016

OK!
Find attached, please.
owncloud-schema.zip

Beyond that ... I am not sure if the issue is related to the database at all.

Yesterday evening I recovered an 3-months-old backup of owncloud and the mysql database. At that time (end of April) ...

    • owncloud was just running perfectly smoothly and stable
    • there had been no updates downloaded or initiated

But, with this recovered old version and database (which were proven to be functional) I now also get the same error status:
occ -V ...

ownCloud or one of the apps require upgrade - only a limited number of commands are available
ownCloud version 8.1.6

... where I expected "ownCloud is already latest version".

occ status ...

ownCloud or one of the apps require upgrade - only a limited number of commands are available

  • installed: true
  • version: 8.1.6.2
  • versionstring: 8.1.6
  • edition:

occ upgrade (just a try) ...

ownCloud or one of the apps require upgrade - only a limited number of commands are available
Set log level to debug - current level: 'Error'
Turned on maintenance mode
OC\DB\MigrationException: An exception occurred while executing 'ALTER TABLE oc_oc_appconfig_cdwr0tru86tuv DROP PRIMARY KEY':

SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'PRIMARY'; check that column/key exists
Update failed
Maintenance mode is kept active
Reset log level to 'Error'

My gut feeling is that the issue is coming from somewhere else. Anything I should check e.g. with php5.6 configuration?

Best
Chris

@TrapperPhD
Copy link
Author

TrapperPhD commented Jul 29, 2016

It looks like that the database was (is?) not in MySQL but in SQLite3. My fault, my sincere apologies!!!

On the system there is an (older) MySQL database (from an ancient installation) and but the most recent data seem to be in a SQLite database (at least SQlite was specified in config.php of the backup). The existence of the MySQL database confused me.

So, I assume that the issue reported above was due to MySQL trying to read a SQLite database.

As a consequence, I close this issue, and reopen a new one. Sorry for taking your time.

Best
Chris

@ownclouders
Copy link
Contributor

Hey, this issue has been closed because the label needs info is set and there were no updates for 14 days. Feel free to reopen this issue if you deem it appropriate.

(This is an automated comment from GitMate.io.

@lock
Copy link

lock bot commented Jul 31, 2019

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.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants