owncloud / core

:cloud: ownCloud web server core (Files, DAV, etc.)
https://owncloud.com
GNU Affero General Public License v3.0
8.38k stars 2.05k forks source link

General error: 1 table "oc_addressbooks" already exists #22959

Closed pejakm closed 8 years ago

pejakm commented 8 years ago

Steps to reproduce

  1. first i started upgrade process, but it hanged, I had to refresh the page
  2. maintenance mode was on, I disabled it manually in config file
  3. I start the upgrade again, this (https://lut.im/yrBSG0H25R/FQOImRD2eqY16NQE.png) happens

    Expected behaviour

Upgrade should pass

Actual behaviour

Upgrade fails

Server configuration

Operating system: Arch Linux

Web server: nginx

Database: sqlite3

PHP version: 7.0.4

ownCloud version: 9.0.0

Updated from an older ownCloud or fresh install: upgrade from 8.2.2

Where did you install ownCloud from: Arch Linux official packages

Signing status (ownCloud 9.0 and above):

List of activated apps:

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
Enabled:
  - activity: 2.2.1
  - dav: true
  - external: 1.2
  - federatedfilesharing: 0.1.0
  - files: 1.4.4
  - files_external: 0.5.2
  - files_pdfviewer: 0.8
  - files_sharing: 0.9.1
  - files_texteditor: 2.1
  - files_trashbin: 0.8.0
  - files_versions: 1.2.0
  - firstrunwizard: 1.1
  - provisioning_api: 0.4.1
  - systemtags: 0.2
  - templateeditor: 0.1
  - updatenotification: 0.1.0
Disabled:
  - admin_migrate
  - apptemplate
  - bookmarks
  - calendar
  - comments
  - contacts
  - django_auth
  - documents
  - emoji
  - encryption
  - encryption_dummy
  - federation
  - files_archive
  - files_odfviewer
  - files_sgfviewer
  - files_svgedit
  - files_videoviewer
  - fluxx_compensator
  - impress
  - imprint
  - notes
  - ownpad_lite
  - pong
  - pushnotifications
  - reader
  - search
  - tasks
  - tattoo
  - testing
  - user_external
  - user_ldap
  - user_migrate
  - user_oauth
  - user_openid_provider
  - user_persona
  - user_saml
  - user_vd
  - user_webfinger

The content of config/config.php:

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
{
    "system": {
        "instanceid": "ocvyvjhkby4x",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "mydomain"
        ],
        "datadirectory": "\/usr\/share\/webapps\/owncloud\/data",
        "overwrite.cli.url": "https:\/\/mydomain\/owncloud",
        "dbtype": "sqlite3",
        "version": "8.2.2.2",
        "installed": true,
        "forcessl": true,
        "theme": "",
        "maintenance": true,
        "loglevel": 0,
        "trashbin_retention_obligation": "auto"
    }
}

Are you using external storage, if yes which one: no

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

Logs

Web server error log

Insert your webserver log here

ownCloud log (data/owncloud.log)

{"reqId":"sAsXhdPlWsKpGMhSX\/tG","remoteAddr":"192.168.1.3","app":"core","message":"Exception: {\"Exception\":\"Doctrine\\\\DBAL\\\\Exception\\\\TableExistsException\",\"Message\":\"An exception occurred while executing 'CREATE TABLE \\\"oc_addressbooks\\\" (\\\"id\\\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, \\\"principaluri\\\" VARCHAR(255) DEFAULT NULL, \\\"displayname\\\" VARCHAR(255) DEFAULT NULL, \\\"uri\\\" VARCHAR(255) DEFAULT NULL, \\\"description\\\" VARCHAR(255) DEFAULT NULL, \\\"synctoken\\\" INTEGER UNSIGNED DEFAULT 1 NOT NULL)':\\n\\nSQLSTATE[HY000]: General error: 1 table \\\"oc_addressbooks\\\" already exists\",\"Code\":0,\"Trace\":\"#0 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/DBALException.php(116): Doctrine\\\\DBAL\\\\Driver\\\\AbstractSQLiteDriver->convertException('An exception oc...', Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException))\\n#1 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(945): Doctrine\\\\DBAL\\\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOSqlite\\\\Driver), Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException), 'CREATE TABLE \\\"o...')\\n#2 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/db\\\/mdb2schemamanager.php(167): Doctrine\\\\DBAL\\\\Connection->query('CREATE TABLE \\\"o...')\\n#3 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/db\\\/mdb2schemamanager.php(70): OC\\\\DB\\\\MDB2SchemaManager->executeSchemaChange(Object(Doctrine\\\\DBAL\\\\Schema\\\\Schema))\\n#4 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/db.php(172): OC\\\\DB\\\\MDB2SchemaManager->createDbFromStructure('\\\/usr\\\/share\\\/weba...')\\n#5 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/installer.php(567): OC_DB::createDbFromStructure('\\\/usr\\\/share\\\/weba...')\\n#6 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/installer.php(546): OC_Installer::installShippedApp('dav')\\n#7 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/updater.php(336): OC_Installer::installShippedApps()\\n#8 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/updater.php(215): OC\\\\Updater->doUpgrade('9.0.0.19', '8.2.2.2')\\n#9 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/core\\\/ajax\\\/update.php(120): OC\\\\Updater->upgrade()\\n#10 {main}\",\"File\":\"\\\/usr\\\/share\\\/webapps\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/AbstractSQLiteDriver.php\",\"Line\":62}","level":3,"time":"2016-03-08T16:22:03+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=ABEOUhcEBRQgQyYWJTt0TjEPBGoFPwAnbTtCETczDVA%3D%3AXsweu4hAuhAtAtAyblq3TiZk7p5yxJYdmoHZgHPs6qo%3D"}
{"reqId":"HvPcwVlCFrxxaPfemD7S","remoteAddr":"192.168.1.3","app":"core","message":"starting upgrade from 8.2.2.2 to 9.0.0.19","level":0,"time":"2016-03-08T16:23:01+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=MVtSTUlYCxliQiYXFghsZzdaQm5mPhUJCH0lUDs8M34%3D%3Ai9%2Bz%2BhfL7iAurGYPd9777hOER6R8tEgJhgyY8EZXoSA%3D"}
{"reqId":"HvPcwVlCFrxxaPfemD7S","remoteAddr":"192.168.1.3","app":"core","message":"Exception: {\"Exception\":\"Doctrine\\\\DBAL\\\\Exception\\\\TableExistsException\",\"Message\":\"An exception occurred while executing 'CREATE TABLE \\\"oc_addressbooks\\\" (\\\"id\\\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, \\\"principaluri\\\" VARCHAR(255) DEFAULT NULL, \\\"displayname\\\" VARCHAR(255) DEFAULT NULL, \\\"uri\\\" VARCHAR(255) DEFAULT NULL, \\\"description\\\" VARCHAR(255) DEFAULT NULL, \\\"synctoken\\\" INTEGER UNSIGNED DEFAULT 1 NOT NULL)':\\n\\nSQLSTATE[HY000]: General error: 1 table \\\"oc_addressbooks\\\" already exists\",\"Code\":0,\"Trace\":\"#0 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/DBALException.php(116): Doctrine\\\\DBAL\\\\Driver\\\\AbstractSQLiteDriver->convertException('An exception oc...', Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException))\\n#1 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(945): Doctrine\\\\DBAL\\\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOSqlite\\\\Driver), Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException), 'CREATE TABLE \\\"o...')\\n#2 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/db\\\/mdb2schemamanager.php(167): Doctrine\\\\DBAL\\\\Connection->query('CREATE TABLE \\\"o...')\\n#3 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/db\\\/mdb2schemamanager.php(70): OC\\\\DB\\\\MDB2SchemaManager->executeSchemaChange(Object(Doctrine\\\\DBAL\\\\Schema\\\\Schema))\\n#4 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/db.php(172): OC\\\\DB\\\\MDB2SchemaManager->createDbFromStructure('\\\/usr\\\/share\\\/weba...')\\n#5 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/installer.php(567): OC_DB::createDbFromStructure('\\\/usr\\\/share\\\/weba...')\\n#6 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/installer.php(546): OC_Installer::installShippedApp('dav')\\n#7 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/updater.php(336): OC_Installer::installShippedApps()\\n#8 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/updater.php(215): OC\\\\Updater->doUpgrade('9.0.0.19', '8.2.2.2')\\n#9 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/core\\\/ajax\\\/update.php(120): OC\\\\Updater->upgrade()\\n#10 {main}\",\"File\":\"\\\/usr\\\/share\\\/webapps\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/AbstractSQLiteDriver.php\",\"Line\":62}","level":3,"time":"2016-03-08T16:23:02+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=MVtSTUlYCxliQiYXFghsZzdaQm5mPhUJCH0lUDs8M34%3D%3Ai9%2Bz%2BhfL7iAurGYPd9777hOER6R8tEgJhgyY8EZXoSA%3D"}
{"reqId":"qqq324ZY4lKTCrkI2j8R","remoteAddr":"192.168.1.3","app":"core","message":"starting upgrade from 8.2.2.2 to 9.0.0.19","level":0,"time":"2016-03-08T16:27:38+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=FBcOchFXGActTjEqNS1kHCkiJQ49PggNKTI%2BLwINMXc%3D%3ALuwEsguRxeVHQbQ%2BzAPWlhRAsyIGMteC7p9fNCQ2S1A%3D"}
{"reqId":"qqq324ZY4lKTCrkI2j8R","remoteAddr":"192.168.1.3","app":"core","message":"Exception: {\"Exception\":\"Doctrine\\\\DBAL\\\\Exception\\\\TableExistsException\",\"Message\":\"An exception occurred while executing 'CREATE TABLE \\\"oc_addressbooks\\\" (\\\"id\\\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, \\\"principaluri\\\" VARCHAR(255) DEFAULT NULL, \\\"displayname\\\" VARCHAR(255) DEFAULT NULL, \\\"uri\\\" VARCHAR(255) DEFAULT NULL, \\\"description\\\" VARCHAR(255) DEFAULT NULL, \\\"synctoken\\\" INTEGER UNSIGNED DEFAULT 1 NOT NULL)':\\n\\nSQLSTATE[HY000]: General error: 1 table \\\"oc_addressbooks\\\" already exists\",\"Code\":0,\"Trace\":\"#0 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/DBALException.php(116): Doctrine\\\\DBAL\\\\Driver\\\\AbstractSQLiteDriver->convertException('An exception oc...', Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException))\\n#1 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(945): Doctrine\\\\DBAL\\\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOSqlite\\\\Driver), Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException), 'CREATE TABLE \\\"o...')\\n#2 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/db\\\/mdb2schemamanager.php(167): Doctrine\\\\DBAL\\\\Connection->query('CREATE TABLE \\\"o...')\\n#3 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/db\\\/mdb2schemamanager.php(70): OC\\\\DB\\\\MDB2SchemaManager->executeSchemaChange(Object(Doctrine\\\\DBAL\\\\Schema\\\\Schema))\\n#4 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/db.php(172): OC\\\\DB\\\\MDB2SchemaManager->createDbFromStructure('\\\/usr\\\/share\\\/weba...')\\n#5 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/installer.php(567): OC_DB::createDbFromStructure('\\\/usr\\\/share\\\/weba...')\\n#6 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/installer.php(546): OC_Installer::installShippedApp('dav')\\n#7 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/updater.php(336): OC_Installer::installShippedApps()\\n#8 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/lib\\\/private\\\/updater.php(215): OC\\\\Updater->doUpgrade('9.0.0.19', '8.2.2.2')\\n#9 \\\/usr\\\/share\\\/webapps\\\/owncloud\\\/core\\\/ajax\\\/update.php(120): OC\\\\Updater->upgrade()\\n#10 {main}\",\"File\":\"\\\/usr\\\/share\\\/webapps\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/AbstractSQLiteDriver.php\",\"Line\":62}","level":3,"time":"2016-03-08T16:27:38+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=FBcOchFXGActTjEqNS1kHCkiJQ49PggNKTI%2BLwINMXc%3D%3ALuwEsguRxeVHQbQ%2BzAPWlhRAsyIGMteC7p9fNCQ2S1A%3D"}
pejakm commented 8 years ago

I used sqlitebrowser to remove oc_addressbooks table as well as other conflicting tables, and triggered upgrade again, this is what happened after a while:

https://lut.im/43NKVSrD5S/71Avk8bzE9RDr9PH.png

Looking at data folder, the file owncloud.db-wal continued to grow to some 30 MB (the database file itself is 4,5 MB).

pejakm commented 8 years ago

It appears that upgrade process timed out:

PHP message: PHP Warning:  flock() expects parameter 1 to be resource, boolean given in /usr/share/webapps/owncloud/lib/private/config.php on line 197
PHP message: PHP Fatal error:  Uncaught Error: Call to a member function getRequest() on null in /usr/share/webapps/owncloud/lib/private/response.php:77
Stack trace:
#0 /usr/share/webapps/owncloud/status.php(51): OC_Response::setStatus(500)
#1 {main}
  thrown in /usr/share/webapps/owncloud/lib/private/response.php on line 77" while reading response header from upstream, client: 192.168.1.3, server: daimonion.eu.org, request: "GET /owncloud/status.php HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "daimonion.eu.org"
2016/03/08 18:15:36 [error] 11882#0: *42 upstream timed out (110: Connection timed out) while reading upstream, client: 192.168.1.3, server: daimonion.eu.org, request: "GET /owncloud/core/ajax/update.php?requesttoken=EHMxIgM5IzsxJCxKCVQfCCE0LRsqHBAvAjBfegcWd3M%3D%3AiJCKIaIIVtz298hLLSFsCEDBdE9%2BjQ1C6vpMj1QDNOs%3D HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "daimonion.eu.org"
LukasReschke commented 8 years ago

first i started upgrade process, but it hanged, I had to refresh the page

Can you define "hanged"? At which step was that?

pejakm commented 8 years ago

Perhaps it was related to low script execution time. I have no idea what and how it happened, but after some time I can log in again to my ownCloud. It appears the upgrade succeeded after all. However, I'm facing a lot of other problems right now (with calendar, contacts and tasks modules), so for now I will revert to 8.2.2.

ghost commented 8 years ago

@pejakm For timeout issues its always the best to run the upgrade from command line via occ.

Its also really advised that you switch from SQLite to MySQL/PostgreSQL for the reason described in the documentation.

pejakm commented 8 years ago

I tried once again, and the same happened: this error, but I could see owncloud.db-wal file getting bigger, and sometime when it reached ~32MB it disappeared. After that I could log into my upgraded ownCloud.

nickvergessen commented 8 years ago

Between two upgrade attempts you have to reset your DB to the 8.2.2 version. That means delete all tables and then restore the backup.

corbindavenport commented 8 years ago

I just wanted to report that I got this same exact error with ownCloud on my Raspberry Pi 2 Model B. Here's the error if this will help at all:

Doctrine\DBAL\Exception\TableExistsException: An exception occurred while executing 'CREATE TABLE "oc_addressbooks" ("id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "principaluri" VARCHAR(255) DEFAULT NULL, "displayname" VARCHAR(255) DEFAULT NULL, "uri" VARCHAR(255) DEFAULT NULL, "description" VARCHAR(255) DEFAULT NULL, "synctoken" INTEGER UNSIGNED DEFAULT 1 NOT NULL)': SQLSTATE[HY000]: General error: 1 table "oc_addressbooks" already exists

nickvergessen commented 8 years ago

Between two upgrade attempts you have to reset your DB to the 8.2.2 version. That means delete all tables and then restore the backup.

Closing as such. If you update page hangs, you can not simply refresh, you need to reset atm. Also when you are on a raspberrypi, you should have access to the console. In which case ./occ upgrade is the recommended way to update, to avoid timeouts.

ckujau commented 8 years ago

Happened here as well, trying to upgrade from 8.2.2-1.1 to 9.0.0-1.1 (Debian/Jessie packages):

$ sudo -u www-data php ./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
Checking whether the database schema can be updated (this can take a long time depending on the database size)
Checked database schema update
Checking updates of apps
Checking whether the database schema for  can be updated (this can take a long time depending on the database size)
Checking whether the database schema for  can be updated (this can take a long time depending on the database size)
Checking whether the database schema for  can be updated (this can take a long time depending on the database size)
Checked database schema update for apps
Updating database schema
Updated database
Disabled 3rd-party app: bookmarks
Disabled incompatible app: calendar
Disabled 3rd-party app: calendar
Disabled incompatible app: contacts
Disabled 3rd-party app: contacts
Disabled 3rd-party app: files_videoviewer
Disabled 3rd-party app: updater
Updating  ...
Updated  to 0.8
Updating  ...
Updated  to 2.1
Updating  ...
Updated  to 14.5.0
Updating  ...
Updated  to 1.4.4
Updating  ...
Updated  to 2.2.1
Updating  ...
Updated  to 0.9.1
Updating  ...
Updated  to 0.8.0
Updating  ...
Updated  to 1.2.0
Update 3rd-party app: calendar
Update 3rd-party app: contacts
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred while executing 'PRAGMA journal_mode = WAL':
SQLSTATE[HY000]: General error: 10 disk I/O error
Update failed
Maintenance mode is kept active
Reset log level
PHP Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 10 disk I/O error' in /var/www/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:77
Stack trace:
#0 /var/www/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(77): PDO->prepare('UPDATE "oc_file...', Array)
#1 /var/www/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(984): Doctrine\DBAL\Driver\PDOConnection->prepare('UPDATE "oc_file...')
#2 /var/www/owncloud/lib/private/db/connection.php(205): Doctrine\DBAL\Connection->executeUpdate('UPDATE "oc_file...', Array, Array)
#3 /var/www/owncloud/lib/private/lock/dblockingprovider.php(263): OC\DB\Connection->executeUpdate('UPDATE `*PREFIX...', Array)
#4 [internal function]: OC\Lock\DBLockingProvider->releaseAll()
#5 {main}
Next exception 'Doctrine\DBAL\Driver\PDOException' with message 'SQLSTATE[HY000]: General error: 10 disk I/O error' in /var/www/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:7 in /var/www/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php on line 85

The occ command did not "hang" but returned rather quickly. Successive runs of the same command come back in under a second with the "oc_addressbooks already exists" error:

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
Checking whether the database schema can be updated (this can take a long time depending on the database size)
Checked database schema update
Checking updates of apps
Checked database schema update for apps
Updating database schema
Updated database
Doctrine\DBAL\Exception\TableExistsException: An exception occurred while executing 'CREATE TABLE "oc_addressbooks" ("id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "principaluri" VARCHAR(255) DEFAULT NULL, "displayname" VARCHAR(255) DEFAULT NULL, "uri" VARCHAR(255) DEFAULT NULL, "description" VARCHAR(255) DEFAULT NULL, "synctoken" INTEGER UNSIGNED DEFAULT 1 NOT NULL)':
SQLSTATE[HY000]: General error: 1 table "oc_addressbooks" already exists
Update failed
Maintenance mode is kept active
Reset log level
ckujau commented 8 years ago

For whatever reason, the oc_addressbooks was empty, even though the Contacts application is used. After dropping it, occ upgrade progressed but hit the same error for other tables:

SQLSTATE[HY000]: General error: 1 table "oc_addressbooks" already exists
SQLSTATE[HY000]: General error: 1 table "oc_cards" already exists
SQLSTATE[HY000]: General error: 1 table "oc_addressbookchanges" already exists
SQLSTATE[HY000]: General error: 1 table "oc_calendarobjects" already exists
SQLSTATE[HY000]: General error: 1 table "oc_calendars" already exists
SQLSTATE[HY000]: General error: 1 table "oc_calendarchanges" already exists
SQLSTATE[HY000]: General error: 1 table "oc_calendarsubscriptions" already exists
SQLSTATE[HY000]: General error: 1 table "oc_schedulingobjects" already exists
SQLSTATE[HY000]: General error: 1 table "oc_cards_properties" already exists
SQLSTATE[HY000]: General error: 1 table "oc_dav_shares" already exists

Every table was empty (maybe the upgrade process stored its data in a backup table?) and dropping each table made occ upgrade finally complete, with all the data restored to the respective tables.

The only other riddle to solve after the upgrade to OC 9 is:

$ curl -sI https://www.example.org/owncloud/ | grep HTTP
HTTP/1.1 404 Not Found
$ curl -sI https://www.example.org/owncloud/index.php | grep HTTP
HTTP/1.1 200 OK

But that's material for another report :)

ryannix123 commented 8 years ago

We use MySQL as OC's backend database and I got the same error as those that use SQLite.

[root@owncloud html]# sudo -u apache php 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 Checking whether the database schema can be updated (this can take a long time depending on the database size) Checked database schema update Checking updates of apps Checked database schema update for apps Updating database schema Updated database Doctrine\DBAL\Exception\TableExistsException: An exception occurred while executing 'CREATE TABLE oc_addressbooks (id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, principaluri VARCHAR(255) DEFAULT NULL, displayname VARCHAR(255) DEFAULT NULL, uri VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, synctoken INT UNSIGNED DEFAULT 1 NOT NULL, UNIQUE INDEX addressbook_index (principaluri, uri), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin ENGINE = InnoDB':

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'oc_addressbooks' already exists Update failed Maintenance mode is kept active Reset log level

ryannix123 commented 8 years ago

I forgot to ask in my last post: Is there a fix on this, or is the fix to drop all affected database tables?

nickvergessen commented 8 years ago

The fix is to delete all tables, before restoring a backup when you want to retry the update.

ryannix123 commented 8 years ago

And will this be fixed in a future version?

farvardin commented 8 years ago

I got this as well, migrating from 8.2.3 to the current 9.0 version on linux mint 17.3 (same General error: 10 disk I/O error) I used the occ upgrade command.

ryannix123 commented 8 years ago

I tried dumping all the tables as a fix, but it didn't work.

farvardin commented 8 years ago

For my part, as I've backed up my owncloud folder, I've just gone back to the 8.2.3 version... (I like also using the sqlite backend for this reason, it's easy to go back to a previous database)

diman82 commented 7 years ago

I'm facing the very same issue on the latest 9.1.3 version. Any suggestions how can I resolve this?

lock[bot] commented 5 years ago

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.