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

OC 6.04 -> 7.0.0 upgrade fails with "Failed to upgrade "files_sharing"" #9810

Closed
HackintoshHD opened this issue Jul 23, 2014 · 91 comments
Closed
Labels

Comments

@HackintoshHD
Copy link

The upgrade of an ownCloud 6.0.4 instance to ownCloud 7.0.0 fails with the error message "Failed to upgrade 'files_sharing'":

screenshot

This had obviously already been reported here five days before the OC7 release.

From the instance's owncloud.log:

{"reqId":"[anonymised]","app":"core","message":"starting upgrade from 6.0.4.1 to 7.0.0.8","level":0,"time":"2014-07-23T18:04:07+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=[anonymised]"}
{"reqId":"[anonymised]","app":"files","message":"starting app upgrade from 1.1.7 to 1.1.9","level":0,"time":"2014-07-23T18:05:57+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=[anonymised]"}
{"reqId":"[anonymised]","app":"activity","message":"starting app upgrade from 1.1.2 to 1.1.23","level":0,"time":"2014-07-23T18:05:57+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=[anonymised]"}
{"reqId":"[anonymised]","app":"activity","message":"starting app upgrade from 1.1.2 to 1.1.23","level":0,"time":"2014-07-23T18:06:02+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"core","message":"Failed to update database structure (exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name 'activity_filter_app'' in \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php:742\nStack trace:\n#0 [internal function]: PDO->query('CREATE INDEX ac...')\n#1 \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(742): call_user_func_array(Array, Array)\n#2 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(179): Doctrine\\DBAL\\Connection->query('CREATE INDEX ac...')\n#3 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(35): OC\\DB\\Migrator->applySchema(Object(Doctrine\\DBAL\\Schema\\Schema))\n#4 \/var\/www\/owncloud\/lib\/private\/db\/mdb2schemamanager.php(98): OC\\DB\\Migrator->migrate(Object(Doctrine\\DBAL\\Schema\\Schema))\n#5 \/var\/www\/owncloud\/lib\/private\/db.php(320): OC\\DB\\MDB2SchemaManager->updateDbFromStructure('\/var\/www\/ownclo...')\n#6 \/var\/www\/owncloud\/lib\/private\/app.php(1172): OC_DB::updateDbFromStructure('\/var\/www\/ownclo...')\n#7 \/var\/www\/owncloud\/lib\/private\/app.php(980): OC_App::updateApp('activity')\n#8 \/var\/www\/owncloud\/lib\/private\/app.php(87): OC_App::checkUpgrade('activity')\n#9 \/var\/www\/owncloud\/lib\/private\/app.php(72): OC_App::loadApp('activity')\n#10 \/var\/www\/owncloud\/remote.php(39): OC_App::loadApps(Array)\n#11 {main}\n\nNext exception 'Doctrine\\DBAL\\DBALException' with message 'An exception occurred while executing 'CREATE INDEX activity_filter_app ON `oc_activity` (`affecteduser`, `app`, `timestamp`)':\n\nSQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name 'activity_filter_app'' in \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php:47\nStack trace:\n#0 \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(744): Doctrine\\DBAL\\DBALException::driverExceptionDuringQuery(Object(PDOException), 'CREATE INDEX ac...')\n#1 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(179): Doctrine\\DBAL\\Connection->query('CREATE INDEX ac...')\n#2 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(35): OC\\DB\\Migrator->applySchema(Object(Doctrine\\DBAL\\Schema\\Schema))\n#3 \/var\/www\/owncloud\/lib\/private\/db\/mdb2schemamanager.php(98): OC\\DB\\Migrator->migrate(Object(Doctrine\\DBAL\\Schema\\Schema))\n#4 \/var\/www\/owncloud\/lib\/private\/db.php(320): OC\\DB\\MDB2SchemaManager->updateDbFromStructure('\/var\/www\/ownclo...')\n#5 \/var\/www\/owncloud\/lib\/private\/app.php(1172): OC_DB::updateDbFromStructure('\/var\/www\/ownclo...')\n#6 \/var\/www\/owncloud\/lib\/private\/app.php(980): OC_App::updateApp('activity')\n#7 \/var\/www\/owncloud\/lib\/private\/app.php(87): OC_App::checkUpgrade('activity')\n#8 \/var\/www\/owncloud\/lib\/private\/app.php(72): OC_App::loadApp('activity')\n#9 \/var\/www\/owncloud\/remote.php(39): OC_App::loadApps(Array)\n#10 {main})","level":4,"time":"2014-07-23T18:06:06+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"remote","message":"Konnte \"activity\" nicht aktualisieren.","level":4,"time":"2014-07-23T18:06:06+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"calendar","message":"starting app upgrade from 0.6.3 to 0.6.4","level":0,"time":"2014-07-23T18:06:09+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=[anonymised]"}
{"reqId":"[anonymised]","app":"contacts","message":"starting app upgrade from 0.3 to 0.3.0.17","level":0,"time":"2014-07-23T18:06:11+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=[anonymised]"}
{"reqId":"[anonymised]","app":"files_sharing","message":"starting app upgrade from 0.3.5 to 0.5.3","level":0,"time":"2014-07-23T18:06:13+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"files_pdfviewer","message":"starting app upgrade from 0.3 to 0.5","level":0,"time":"2014-07-23T18:06:16+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=[anonymised]"}
{"reqId":"[anonymised]","app":"files_sharing","message":"starting app upgrade from 0.3.5 to 0.5.3","level":0,"time":"2014-07-23T18:06:16+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=[anonymised]"}
{"reqId":"[anonymised]","app":"files_versions","message":"starting app upgrade from 1.0.3 to 1.0.5","level":0,"time":"2014-07-23T18:06:17+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"files_sharing","message":"starting app upgrade from 0.3.5 to 0.5.3","level":0,"time":"2014-07-23T18:06:18+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"files_versions","message":"starting app upgrade from 1.0.3 to 1.0.5","level":0,"time":"2014-07-23T18:06:20+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=[anonymised]"}
{"reqId":"[anonymised]","app":"gallery","message":"starting app upgrade from 0.5.3 to 0.5.4","level":0,"time":"2014-07-23T18:06:21+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"files_versions","message":"starting app upgrade from 1.0.3 to 1.0.5","level":0,"time":"2014-07-23T18:06:23+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"core","message":"Failed to update database structure (exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'owncloud.oc_files_versions' doesn't exist' in \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php:742\nStack trace:\n#0 [internal function]: PDO->query('ALTER TABLE `oc...')\n#1 \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(742): call_user_func_array(Array, Array)\n#2 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(179): Doctrine\\DBAL\\Connection->query('ALTER TABLE `oc...')\n#3 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(35): OC\\DB\\Migrator->applySchema(Object(Doctrine\\DBAL\\Schema\\Schema))\n#4 \/var\/www\/owncloud\/lib\/private\/db\/mdb2schemamanager.php(98): OC\\DB\\Migrator->migrate(Object(Doctrine\\DBAL\\Schema\\Schema))\n#5 \/var\/www\/owncloud\/lib\/private\/db.php(320): OC\\DB\\MDB2SchemaManager->updateDbFromStructure('\/var\/www\/ownclo...')\n#6 \/var\/www\/owncloud\/lib\/private\/app.php(1172): OC_DB::updateDbFromStructure('\/var\/www\/ownclo...')\n#7 \/var\/www\/owncloud\/lib\/private\/app.php(980): OC_App::updateApp('files_versions')\n#8 \/var\/www\/owncloud\/lib\/private\/app.php(87): OC_App::checkUpgrade('files_versions')\n#9 \/var\/www\/owncloud\/lib\/private\/app.php(72): OC_App::loadApp('files_versions')\n#10 \/var\/www\/owncloud\/lib\/private\/util.php(72): OC_App::loadApps(Array)\n#11 \/var\/www\/owncloud\/lib\/private\/files\/filesystem.php(800): OC_Util::setupFS()\n#12 \/var\/www\/owncloud\/lib\/autoloader.php(142): require_once('\/var\/www\/ownclo...')\n#13 [internal function]: OC\\Autoloader->load('OC\\Files\\Filesy...')\n#14 \/var\/www\/owncloud\/apps\/files_sharing\/appinfo\/update.php(90): spl_autoload_call('OC\\Files\\Filesy...')\n#15 \/var\/www\/owncloud\/apps\/files_sharing\/appinfo\/update.php(10): removeSharedFolder()\n#16 \/var\/www\/owncloud\/lib\/private\/app.php(1179): include('\/var\/www\/ownclo...')\n#17 \/var\/www\/owncloud\/lib\/private\/app.php(980): OC_App::updateApp('files_sharing')\n#18 \/var\/www\/owncloud\/lib\/private\/app.php(87): OC_App::checkUpgrade('files_sharing')\n#19 \/var\/www\/owncloud\/lib\/private\/app.php(72): OC_App::loadApp('files_sharing')\n#20 \/var\/www\/owncloud\/lib\/private\/updater.php(222): OC_App::loadApps()\n#21 \/var\/www\/owncloud\/lib\/private\/updater.php(137): OC\\Updater->doUpgrade('7.0.0.8', '6.0.4.1')\n#22 \/var\/www\/owncloud\/core\/ajax\/update.php(35): OC\\Updater->upgrade()\n#23 {main}\n\nNext exception 'Doctrine\\DBAL\\DBALException' with message 'An exception occurred while executing 'ALTER TABLE `oc_files_versions` ADD `user` VARCHAR(64) DEFAULT '' NOT NULL, ADD `size` VARCHAR(50) DEFAULT '' NOT NULL':\n\nSQLSTATE[42S02]: Base table or view not found: 1146 Table 'owncloud.oc_files_versions' doesn't exist' in \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php:47\nStack trace:\n#0 \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(744): Doctrine\\DBAL\\DBALException::driverExceptionDuringQuery(Object(PDOException), 'ALTER TABLE `oc...')\n#1 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(179): Doctrine\\DBAL\\Connection->query('ALTER TABLE `oc...')\n#2 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(35): OC\\DB\\Migrator->applySchema(Object(Doctrine\\DBAL\\Schema\\Schema))\n#3 \/var\/www\/owncloud\/lib\/private\/db\/mdb2schemamanager.php(98): OC\\DB\\Migrator->migrate(Object(Doctrine\\DBAL\\Schema\\Schema))\n#4 \/var\/www\/owncloud\/lib\/private\/db.php(320): OC\\DB\\MDB2SchemaManager->updateDbFromStructure('\/var\/www\/ownclo...')\n#5 \/var\/www\/owncloud\/lib\/private\/app.php(1172): OC_DB::updateDbFromStructure('\/var\/www\/ownclo...')\n#6 \/var\/www\/owncloud\/lib\/private\/app.php(980): OC_App::updateApp('files_versions')\n#7 \/var\/www\/owncloud\/lib\/private\/app.php(87): OC_App::checkUpgrade('files_versions')\n#8 \/var\/www\/owncloud\/lib\/private\/app.php(72): OC_App::loadApp('files_versions')\n#9 \/var\/www\/owncloud\/lib\/private\/util.php(72): OC_App::loadApps(Array)\n#10 \/var\/www\/owncloud\/lib\/private\/files\/filesystem.php(800): OC_Util::setupFS()\n#11 \/var\/www\/owncloud\/lib\/autoloader.php(142): require_once('\/var\/www\/ownclo...')\n#12 [internal function]: OC\\Autoloader->load('OC\\Files\\Filesy...')\n#13 \/var\/www\/owncloud\/apps\/files_sharing\/appinfo\/update.php(90): spl_autoload_call('OC\\Files\\Filesy...')\n#14 \/var\/www\/owncloud\/apps\/files_sharing\/appinfo\/update.php(10): removeSharedFolder()\n#15 \/var\/www\/owncloud\/lib\/private\/app.php(1179): include('\/var\/www\/ownclo...')\n#16 \/var\/www\/owncloud\/lib\/private\/app.php(980): OC_App::updateApp('files_sharing')\n#17 \/var\/www\/owncloud\/lib\/private\/app.php(87): OC_App::checkUpgrade('files_sharing')\n#18 \/var\/www\/owncloud\/lib\/private\/app.php(72): OC_App::loadApp('files_sharing')\n#19 \/var\/www\/owncloud\/lib\/private\/updater.php(222): OC_App::loadApps()\n#20 \/var\/www\/owncloud\/lib\/private\/updater.php(137): OC\\Updater->doUpgrade('7.0.0.8', '6.0.4.1')\n#21 \/var\/www\/owncloud\/core\/ajax\/update.php(35): OC\\Updater->upgrade()\n#22 {main})","level":4,"time":"2014-07-23T18:06:25+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=[anonymised]"}
{"reqId":"[anonymised]","app":"gallery","message":"starting app upgrade from 0.5.3 to 0.5.4","level":0,"time":"2014-07-23T18:06:27+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"webdav","message":"Sabre\\DAV\\Exception\\ServiceUnavailable: ","level":4,"time":"2014-07-23T18:06:28+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"remote","message":"Konnte \"files_sharing\" nicht aktualisieren.","level":4,"time":"2014-07-23T18:06:29+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"OC\\Files\\Cache\\Scanner","message":"!!! No reuse of etag for 'files' !!! \ncache: Array\n(\n    [fileid] => 3\n    [storage] => local::\/var\/www\/owncloud\/data\/[anonymised]\/\n    [path] => files\n    [parent] => -1\n    [name] => files\n    [mimetype] => httpd\/unix-directory\n    [mimepart] => httpd\n    [size] => 0\n    [mtime] => 1360182326\n    [storage_mtime] => 1360182326\n    [encrypted] => \n    [unencrypted_size] => 0\n    [etag] => \n    [permissions] => 0\n)\n \ndata: Array\n(\n    [mimetype] => httpd\/unix-directory\n    [mtime] => 1406138787\n    [size] => -1\n    [etag] => 53cff9abede3e\n    [storage_mtime] => 1406138787\n    [permissions] => 31\n)\n","level":0,"time":"2014-07-23T18:06:36+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"OC\\Files\\Cache\\Scanner","message":"!!! No reuse of etag for 'files' !!! \ncache: Array\n(\n    [fileid] => 2\n    [storage] => local::\/var\/www\/owncloud\/data\/[anonymised]\/\n    [path] => files\n    [parent] => -1\n    [name] => files\n    [mimetype] => httpd\/unix-directory\n    [mimepart] => httpd\n    [size] => 1942513298\n    [mtime] => 1406124002\n    [storage_mtime] => 1403563950\n    [encrypted] => \n    [unencrypted_size] => 0\n    [etag] => 53cfc972c6e91\n    [permissions] => 0\n)\n \ndata: Array\n(\n    [mimetype] => httpd\/unix-directory\n    [mtime] => 1406138787\n    [size] => -1\n    [etag] => 53cff9b9af112\n    [storage_mtime] => 1406138787\n    [permissions] => 31\n)\n","level":0,"time":"2014-07-23T18:06:49+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"files_texteditor","message":"starting app upgrade from 0.3 to 0.4","level":0,"time":"2014-07-23T18:09:28+00:00","method":"GET","url":"\/owncloud\/"}
@LukasReschke
Copy link
Member

I believe this might have to do with the activity app:

Syntax error or access violation: 1061 Duplicate key name 'activity_filter_app'' in 

This bug was reported multiple times on Twitter and the forum. @karlitschek @nickvergessen

@DeepDiver1975
Copy link
Member

An exception occurred while executing 'ALTER TABLEoc_files_versionsADDuserVARCHAR(64) DEFAULT '' NOT NULL, ADDsizeVARCHAR(50) DEFAULT '' NOT NULL':\n\nSQLSTATE[42S02]: Base table or view not found: 1146 Table 'owncloud.oc_files_versions' doesn't exist'

this one is of interest as well

@DeepDiver1975
Copy link
Member

in addition: the upgrade procedure is triggered by a webdav request - we should not do this from my understanding

@icewind1991 @PVince81 @karlitschek

@PVince81
Copy link
Contributor

@DeepDiver1975 it shouldn't, I explicitly disabled that in remote.php recently.

@PVince81
Copy link
Contributor

@DeepDiver1975
Copy link
Member

@DeepDiver1975 it shouldn't, I explicitly disabled that in remote.php recently.

you are right - sorry for the noise

@polaris20
Copy link

Experienced this too, and server is now down (though just a non-crucial test server). Will this/can this be fixed with a patch, or is there a manual method of correction?

@DeepDiver1975
Copy link
Member

@PVince81 and webdav does upgrade apps:

Next exception 'Doctrine\\DBAL\\DBALException' with message 'An exception occurred while executing 'CREATE INDEX activity_filter_app ON `oc_activity` (`affecteduser`, `app`, `timestamp`)':\n\nSQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name 'activity_filter_app'' in \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php:47\nStack trace:\n
#0 \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(744): Doctrine\\DBAL\\DBALException::driverExceptionDuringQuery(Object(PDOException), 'CREATE INDEX ac...')\n
#1 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(179): Doctrine\\DBAL\\Connection->query('CREATE INDEX ac...')\n
#2 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(35): OC\\DB\\Migrator->applySchema(Object(Doctrine\\DBAL\\Schema\\Schema))\n
#3 \/var\/www\/owncloud\/lib\/private\/db\/mdb2schemamanager.php(98): OC\\DB\\Migrator->migrate(Object(Doctrine\\DBAL\\Schema\\Schema))\n
#4 \/var\/www\/owncloud\/lib\/private\/db.php(320): OC\\DB\\MDB2SchemaManager->updateDbFromStructure('\/var\/www\/ownclo...')\n
#5 \/var\/www\/owncloud\/lib\/private\/app.php(1172): OC_DB::updateDbFromStructure('\/var\/www\/ownclo...')\n
#6 \/var\/www\/owncloud\/lib\/private\/app.php(980): OC_App::updateApp('activity')\n
#7 \/var\/www\/owncloud\/lib\/private\/app.php(87): OC_App::checkUpgrade('activity')\n
#8 \/var\/www\/owncloud\/lib\/private\/app.php(72): OC_App::loadApp('activity')\n
#9 \/var\/www\/owncloud\/remote.php(39): OC_App::loadApps(Array)\n
#10 {main})","level":4,"time":"2014-07-23T18:06:06+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}

@DeepDiver1975
Copy link
Member

@PVince81 looks like core migration is finished but not the app upgrade

@PVince81
Copy link
Contributor

I think it might be explained as follows: normally the update itself consists of "core update" and "apps update".

In the case of @HackintoshHD it seems the "core update" went through but not "apps update".
When core was updated, needsUpgrade() returns false because now only apps might need update.
Usually apps update themselves at load time, from what I saw in the code.
Which means that if core was updated, then any access on those apps might trigger their update.

@DeepDiver1975
Copy link
Member

can this duplicate key be caused by multiple updateApp() calls in parallel?

@polaris20 @HackintoshHD please ensure that no webdav client is connected during upgrade - hopefully this helps - THX

@PVince81
Copy link
Contributor

Hmmm... I suppose that could happen, yes.

We can probably prevent app upgrades as well when the original call comes from remote.php, cron.php and only allow them to run over then web UI. But this means version checking needs to be done early because it might be more risky to "jump out" of the app loading code at a later stage with an exception.

I'll make a ticket to continue this discussion.

@DeepDiver1975
Copy link
Member

I'll make a ticket to continue this discussion.

good point - thx

@PVince81
Copy link
Contributor

Here it is: #9817

@HackintoshHD
Copy link
Author

@polaris20 @HackintoshHD please ensure that no webdav client is connected during upgrade - hopefully this helps - THX

@DeepDiver1975 The ownCloud instance for which I reported the issue above is no longer in maintenance mode and now reports its version number as "7.0.0", so I can't re-run the upgrade (the only way to do that now would involve going back to my 6.0.4 backup and the corresponding MySQL dump, what I'd rather avoid as this is a productive system).

@PVince81
Copy link
Contributor

@polaris20 @HackintoshHD @Grobwiefein @RobBentley did you all have the files_sharing update issue ? Maybe we can find a common fix to solve the already broken install.

I've posted a patch in #9817 that should prevent setting the version to 7.0.0 if the upgrade of apps didn't go well and prevent further potential breakage.

Let me have a quick look at the logs posted here. Do you all have similar entries ?

@RobBentley
Copy link

@PVince81 It was the files_sharing update issue I had for sure. As per the other thread, if someone can point me in the direction of a new tar thats patched, i'll give the upgrade a whirl again.

@PVince81
Copy link
Contributor

From reading the log I understand how the PROPFIND sneaked in to update the activity app in parallel to the regular update. The second row with Starting files app update tells us that the core update was already done, so the version 7.0.0 was already in the DB, which means needsUpgrade() was returning false and didn't block anything in remote.php.
Way to go, the patch should prevent that at least.

Let's look further.

@jerquiaga
Copy link

I have the same upgrade issue, server is now down.

SIDENOTE: Not sure where to address this, but is OC 7.0 considered stable, or some sort of testing build? Seems a ton of issues have popped up this morning, more than should be there for a stable build.

@PVince81
Copy link
Contributor

Still, the PROPFIND shouldn't be able to trigger an update at this point because we are still in maintenance mode. Really strange.

@enoch85
Copy link
Member

enoch85 commented Jul 23, 2014

I got something similar. The updgrade was a success but this was in my owncloud.log after the upgrade

Fatal   remote  Misslyckades med att uppgradera "files_sharing".    2014-07-23T23:00:34+00:00
Fatal   core     Failed to update database structure (exception 'PDOException' with message 'SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'auto_id'' in /var/www/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:742 Stack trace: #0 [internal function]: PDO->query('ALTER TABLE `oc...')
#1 /var/www/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(742): call_user_func_array(Array, Array)
#2 /var/www/owncloud/lib/private/db/migrator.php(179): Doctrine\DBAL\Connection->query('ALTER TABLE `oc...')
#3 /var/www/owncloud/lib/private/db/migrator.php(35): OC\DB\Migrator->applySchema(Object(Doctrine\DBAL\Schema\Schema))
#4 /var/www/owncloud/lib/private/db/mdb2schemamanager.php(98): OC\DB\Migrator->migrate(Object(Doctrine\DBAL\Schema\Schema))
#5 /var/www/owncloud/lib/private/db.php(320): OC\DB\MDB2SchemaManager->updateDbFromStructure('/var/www/ownclo...')
#6 /var/www/owncloud/lib/private/app.php(1172): OC_DB::updateDbFromStructure('/var/www/ownclo...')
#7 /var/www/owncloud/lib/private/app.php(980): OC_App::updateApp('files_trashbin')
#8 /var/www/owncloud/lib/private/app.php(87): OC_App::checkUpgrade('files_trashbin')
#9 /var/www/owncloud/lib/private/app.php(72): OC_App::loadApp('files_trashbin')
#10 /var/www/owncloud/lib/private/util.php(72): OC_App::loadApps(Array)
#11 /var/www/owncloud/lib/private/files/filesystem.php(800): OC_Util::setupFS()
#12 /var/www/owncloud/lib/autoloader.php(142): require_once('/var/www/ownclo...')
#13 [internal function]: OC\Autoloader->load('OC\Files\Filesy...')
#14 /var/www/owncloud/apps/files_sharing/appinfo/update.php(90): spl_autoload_call('OC\Files\Filesy...')
#15 /var/www/owncloud/apps/files_sharing/appinfo/update.php(10): removeSharedFolder()
#16 /var/www/owncloud/lib/private/app.php(1179): include('/var/www/ownclo...')
#17 /var/www/owncloud/lib/private/app.php(980): OC_App::updateApp('files_sharing')
#18 /var/www/owncloud/lib/private/app.php(87): OC_App::checkUpgrade('files_sharing')
#19 /var/www/owncloud/lib/private/app.php(72): OC_App::loadApp('files_sharing')
#20 /var/www/owncloud/remote.php(39): OC_App::loadApps(Array)
#21 {main}
Next exception 'Doctrine\DBAL\DBALException' with message 'An exception occurred while executing 'ALTER TABLE `oc_files_trash` ADD `auto_id` INT AUTO_INCREMENT NOT NULL, CHANGE `type` `type` VARCHAR(4) DEFAULT NULL, CHANGE `mime` `mime` VARCHAR(255) DEFAULT NULL, ADD PRIMARY KEY(`auto_id`)': SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'auto_id'' in /var/www/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:47 Stack trace:
#0 /var/www/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(744): Doctrine\DBAL\DBALException::driverExceptionDuringQuery(Object(PDOException), 'ALTER TABLE `oc...')
#1 /var/www/owncloud/lib/private/db/migrator.php(179): Doctrine\DBAL\Connection->query('ALTER TABLE `oc...') 
#2 /var/www/owncloud/lib/private/db/migrator.php(35): OC\DB\Migrator->applySchema(Object(Doctrine\DBAL\Schema\Schema))
#3 /var/www/owncloud/lib/private/db/mdb2schemamanager.php(98): OC\DB\Migrator->migrate(Object(Doctrine\DBAL\Schema\Schema)) 
#4 /var/www/owncloud/lib/private/db.php(320): OC\DB\MDB2SchemaManager->updateDbFromStructure('/var/www/ownclo...') 
#5 /var/www/owncloud/lib/private/app.php(1172): OC_DB::updateDbFromStructure('/var/www/ownclo...') #6 /var/www/owncloud/lib/private/app.php(980): OC_App::updateApp('files_trashbin') 
#7 /var/www/owncloud/lib/private/app.php(87): OC_App::checkUpgrade('files_trashbin') 
#8 /var/www/owncloud/lib/private/app.php(72): OC_App::loadApp('files_trashbin') 
#9 /var/www/owncloud/lib/private/util.php(72): OC_App::loadApps(Array) 
#10 /var/www/owncloud/lib/private/files/filesystem.php(800): OC_Util::setupFS() 
#11 /var/www/owncloud/lib/autoloader.php(142): require_once('/var/www/ownclo...')
#12 [internal function]: OC\Autoloader->load('OC\Files\Filesy...') 
#13 /var/www/owncloud/apps/files_sharing/appinfo/update.php(90): spl_autoload_call('OC\Files\Filesy...') 
#14 /var/www/owncloud/apps/files_sharing/appinfo/update.php(10): removeSharedFolder() 
#15 /var/www/owncloud/lib/private/app.php(1179): include('/var/www/ownclo...') 
#16 /var/www/owncloud/lib/private/app.php(980): OC_App::updateApp('files_sharing') 
#17 /var/www/owncloud/lib/private/app.php(87): OC_App::checkUpgrade('files_sharing') 
#18 /var/www/owncloud/lib/private/app.php(72): OC_App::loadApp('files_sharing') 
#19 /var/www/owncloud/remote.php(39): OC_App::loadApps(Array) #20 {main})

Edit: reformatted stack trace

@nickvergessen
Copy link
Contributor

Interesting, seems like it tries to create the key a second time. I guess thats due to some migrations issue? And I guess activity app is the first one (alphabetic order) in most cases so that's why it's reported the most.

@PVince81
Copy link
Contributor

I have reformatted the log from @HackintoshHD for better readability here:

{"reqId":"[anonymised]","app":"core","message":"starting upgrade from 6.0.4.1 to 7.0.0.8","level":0,"time":"2014-07-23T18:04:07+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=[anonymised]"}
{"reqId":"[anonymised]","app":"files","message":"starting app upgrade from 1.1.7 to 1.1.9","level":0,"time":"2014-07-23T18:05:57+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=[anonymised]"}
{"reqId":"[anonymised]","app":"activity","message":"starting app upgrade from 1.1.2 to 1.1.23","level":0,"time":"2014-07-23T18:05:57+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=[anonymised]"}
{"reqId":"[anonymised]","app":"activity","message":"starting app upgrade from 1.1.2 to 1.1.23","level":0,"time":"2014-07-23T18:06:02+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"core","message":"Failed to update database structure (exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name 'activity_filter_app'' in \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php:742
Stack trace:
#0 [internal function]: PDO->query('CREATE INDEX ac...')
#1 \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(742): call_user_func_array(Array, Array)
#2 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(179): Doctrine\\DBAL\\Connection->query('CREATE INDEX ac...')
#3 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(35): OC\\DB\\Migrator->applySchema(Object(Doctrine\\DBAL\\Schema\\Schema))
#4 \/var\/www\/owncloud\/lib\/private\/db\/mdb2schemamanager.php(98): OC\\DB\\Migrator->migrate(Object(Doctrine\\DBAL\\Schema\\Schema))
#5 \/var\/www\/owncloud\/lib\/private\/db.php(320): OC\\DB\\MDB2SchemaManager->updateDbFromStructure('\/var\/www\/ownclo...')
#6 \/var\/www\/owncloud\/lib\/private\/app.php(1172): OC_DB::updateDbFromStructure('\/var\/www\/ownclo...')
#7 \/var\/www\/owncloud\/lib\/private\/app.php(980): OC_App::updateApp('activity')
#8 \/var\/www\/owncloud\/lib\/private\/app.php(87): OC_App::checkUpgrade('activity')
#9 \/var\/www\/owncloud\/lib\/private\/app.php(72): OC_App::loadApp('activity')
#10 \/var\/www\/owncloud\/remote.php(39): OC_App::loadApps(Array)
#11 {main}

Next exception 'Doctrine\\DBAL\\DBALException' with message 'An exception occurred while executing 'CREATE INDEX activity_filter_app ON `oc_activity` (`affecteduser`, `app`, `timestamp`)':

SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name 'activity_filter_app'' in \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php:47
Stack trace:
#0 \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(744): Doctrine\\DBAL\\DBALException::driverExceptionDuringQuery(Object(PDOException), 'CREATE INDEX ac...')
#1 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(179): Doctrine\\DBAL\\Connection->query('CREATE INDEX ac...')
#2 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(35): OC\\DB\\Migrator->applySchema(Object(Doctrine\\DBAL\\Schema\\Schema))
#3 \/var\/www\/owncloud\/lib\/private\/db\/mdb2schemamanager.php(98): OC\\DB\\Migrator->migrate(Object(Doctrine\\DBAL\\Schema\\Schema))
#4 \/var\/www\/owncloud\/lib\/private\/db.php(320): OC\\DB\\MDB2SchemaManager->updateDbFromStructure('\/var\/www\/ownclo...')
#5 \/var\/www\/owncloud\/lib\/private\/app.php(1172): OC_DB::updateDbFromStructure('\/var\/www\/ownclo...')
#6 \/var\/www\/owncloud\/lib\/private\/app.php(980): OC_App::updateApp('activity')
#7 \/var\/www\/owncloud\/lib\/private\/app.php(87): OC_App::checkUpgrade('activity')
#8 \/var\/www\/owncloud\/lib\/private\/app.php(72): OC_App::loadApp('activity')
#9 \/var\/www\/owncloud\/remote.php(39): OC_App::loadApps(Array)
#10 {main})","level":4,"time":"2014-07-23T18:06:06+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"remote","message":"Konnte \"activity\" nicht aktualisieren.","level":4,"time":"2014-07-23T18:06:06+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"calendar","message":"starting app upgrade from 0.6.3 to 0.6.4","level":0,"time":"2014-07-23T18:06:09+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=[anonymised]"}
{"reqId":"[anonymised]","app":"contacts","message":"starting app upgrade from 0.3 to 0.3.0.17","level":0,"time":"2014-07-23T18:06:11+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=[anonymised]"}
{"reqId":"[anonymised]","app":"files_sharing","message":"starting app upgrade from 0.3.5 to 0.5.3","level":0,"time":"2014-07-23T18:06:13+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"files_pdfviewer","message":"starting app upgrade from 0.3 to 0.5","level":0,"time":"2014-07-23T18:06:16+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=[anonymised]"}
{"reqId":"[anonymised]","app":"files_sharing","message":"starting app upgrade from 0.3.5 to 0.5.3","level":0,"time":"2014-07-23T18:06:16+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=[anonymised]"}
{"reqId":"[anonymised]","app":"files_versions","message":"starting app upgrade from 1.0.3 to 1.0.5","level":0,"time":"2014-07-23T18:06:17+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"files_sharing","message":"starting app upgrade from 0.3.5 to 0.5.3","level":0,"time":"2014-07-23T18:06:18+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"files_versions","message":"starting app upgrade from 1.0.3 to 1.0.5","level":0,"time":"2014-07-23T18:06:20+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=[anonymised]"}
{"reqId":"[anonymised]","app":"gallery","message":"starting app upgrade from 0.5.3 to 0.5.4","level":0,"time":"2014-07-23T18:06:21+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"files_versions","message":"starting app upgrade from 1.0.3 to 1.0.5","level":0,"time":"2014-07-23T18:06:23+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"core","message":"Failed to update database structure (exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'owncloud.oc_files_versions' doesn't exist' in \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php:742
Stack trace:
#0 [internal function]: PDO->query('ALTER TABLE `oc...')
#1 \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(742): call_user_func_array(Array, Array)
#2 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(179): Doctrine\\DBAL\\Connection->query('ALTER TABLE `oc...')
#3 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(35): OC\\DB\\Migrator->applySchema(Object(Doctrine\\DBAL\\Schema\\Schema))
#4 \/var\/www\/owncloud\/lib\/private\/db\/mdb2schemamanager.php(98): OC\\DB\\Migrator->migrate(Object(Doctrine\\DBAL\\Schema\\Schema))
#5 \/var\/www\/owncloud\/lib\/private\/db.php(320): OC\\DB\\MDB2SchemaManager->updateDbFromStructure('\/var\/www\/ownclo...')
#6 \/var\/www\/owncloud\/lib\/private\/app.php(1172): OC_DB::updateDbFromStructure('\/var\/www\/ownclo...')
#7 \/var\/www\/owncloud\/lib\/private\/app.php(980): OC_App::updateApp('files_versions')
#8 \/var\/www\/owncloud\/lib\/private\/app.php(87): OC_App::checkUpgrade('files_versions')
#9 \/var\/www\/owncloud\/lib\/private\/app.php(72): OC_App::loadApp('files_versions')
#10 \/var\/www\/owncloud\/lib\/private\/util.php(72): OC_App::loadApps(Array)
#11 \/var\/www\/owncloud\/lib\/private\/files\/filesystem.php(800): OC_Util::setupFS()
#12 \/var\/www\/owncloud\/lib\/autoloader.php(142): require_once('\/var\/www\/ownclo...')
#13 [internal function]: OC\\Autoloader->load('OC\\Files\\Filesy...')
#14 \/var\/www\/owncloud\/apps\/files_sharing\/appinfo\/update.php(90): spl_autoload_call('OC\\Files\\Filesy...')
#15 \/var\/www\/owncloud\/apps\/files_sharing\/appinfo\/update.php(10): removeSharedFolder()
#16 \/var\/www\/owncloud\/lib\/private\/app.php(1179): include('\/var\/www\/ownclo...')
#17 \/var\/www\/owncloud\/lib\/private\/app.php(980): OC_App::updateApp('files_sharing')
#18 \/var\/www\/owncloud\/lib\/private\/app.php(87): OC_App::checkUpgrade('files_sharing')
#19 \/var\/www\/owncloud\/lib\/private\/app.php(72): OC_App::loadApp('files_sharing')
#20 \/var\/www\/owncloud\/lib\/private\/updater.php(222): OC_App::loadApps()
#21 \/var\/www\/owncloud\/lib\/private\/updater.php(137): OC\\Updater->doUpgrade('7.0.0.8', '6.0.4.1')
#22 \/var\/www\/owncloud\/core\/ajax\/update.php(35): OC\\Updater->upgrade()
#23 {main}

Next exception 'Doctrine\\DBAL\\DBALException' with message 'An exception occurred while executing 'ALTER TABLE `oc_files_versions` ADD `user` VARCHAR(64) DEFAULT '' NOT NULL, ADD `size` VARCHAR(50) DEFAULT '' NOT NULL':

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'owncloud.oc_files_versions' doesn't exist' in \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php:47
Stack trace:
#0 \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(744): Doctrine\\DBAL\\DBALException::driverExceptionDuringQuery(Object(PDOException), 'ALTER TABLE `oc...')
#1 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(179): Doctrine\\DBAL\\Connection->query('ALTER TABLE `oc...')
#2 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(35): OC\\DB\\Migrator->applySchema(Object(Doctrine\\DBAL\\Schema\\Schema))
#3 \/var\/www\/owncloud\/lib\/private\/db\/mdb2schemamanager.php(98): OC\\DB\\Migrator->migrate(Object(Doctrine\\DBAL\\Schema\\Schema))
#4 \/var\/www\/owncloud\/lib\/private\/db.php(320): OC\\DB\\MDB2SchemaManager->updateDbFromStructure('\/var\/www\/ownclo...')
#5 \/var\/www\/owncloud\/lib\/private\/app.php(1172): OC_DB::updateDbFromStructure('\/var\/www\/ownclo...')
#6 \/var\/www\/owncloud\/lib\/private\/app.php(980): OC_App::updateApp('files_versions')
#7 \/var\/www\/owncloud\/lib\/private\/app.php(87): OC_App::checkUpgrade('files_versions')
#8 \/var\/www\/owncloud\/lib\/private\/app.php(72): OC_App::loadApp('files_versions')
#9 \/var\/www\/owncloud\/lib\/private\/util.php(72): OC_App::loadApps(Array)
#10 \/var\/www\/owncloud\/lib\/private\/files\/filesystem.php(800): OC_Util::setupFS()
#11 \/var\/www\/owncloud\/lib\/autoloader.php(142): require_once('\/var\/www\/ownclo...')
#12 [internal function]: OC\\Autoloader->load('OC\\Files\\Filesy...')
#13 \/var\/www\/owncloud\/apps\/files_sharing\/appinfo\/update.php(90): spl_autoload_call('OC\\Files\\Filesy...')
#14 \/var\/www\/owncloud\/apps\/files_sharing\/appinfo\/update.php(10): removeSharedFolder()
#15 \/var\/www\/owncloud\/lib\/private\/app.php(1179): include('\/var\/www\/ownclo...')
#16 \/var\/www\/owncloud\/lib\/private\/app.php(980): OC_App::updateApp('files_sharing')
#17 \/var\/www\/owncloud\/lib\/private\/app.php(87): OC_App::checkUpgrade('files_sharing')
#18 \/var\/www\/owncloud\/lib\/private\/app.php(72): OC_App::loadApp('files_sharing')
#19 \/var\/www\/owncloud\/lib\/private\/updater.php(222): OC_App::loadApps()
#20 \/var\/www\/owncloud\/lib\/private\/updater.php(137): OC\\Updater->doUpgrade('7.0.0.8', '6.0.4.1')
#21 \/var\/www\/owncloud\/core\/ajax\/update.php(35): OC\\Updater->upgrade()
#22 {main})","level":4,"time":"2014-07-23T18:06:25+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=[anonymised]"}
{"reqId":"[anonymised]","app":"gallery","message":"starting app upgrade from 0.5.3 to 0.5.4","level":0,"time":"2014-07-23T18:06:27+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"webdav","message":"Sabre\\DAV\\Exception\\ServiceUnavailable: ","level":4,"time":"2014-07-23T18:06:28+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"remote","message":"Konnte \"files_sharing\" nicht aktualisieren.","level":4,"time":"2014-07-23T18:06:29+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"OC\\Files\\Cache\\Scanner","message":"!!! No reuse of etag for 'files' !!! 
cache: Array
(
    [fileid] => 3
    [storage] => local::\/var\/www\/owncloud\/data\/XXX\/
    [path] => files
    [parent] => -1
    [name] => files
    [mimetype] => httpd\/unix-directory
    [mimepart] => httpd
    [size] => 0
    [mtime] => 1360182326
    [storage_mtime] => 1360182326
    [encrypted] => 
    [unencrypted_size] => 0
    [etag] => 
    [permissions] => 0
)

data: Array
(
    [mimetype] => httpd\/unix-directory
    [mtime] => 1406138787
    [size] => -1
    [etag] => 53cff9abede3e
    [storage_mtime] => 1406138787
    [permissions] => 31
)
","level":0,"time":"2014-07-23T18:06:36+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"OC\\Files\\Cache\\Scanner","message":"!!! No reuse of etag for 'files' !!! 
cache: Array
(
    [fileid] => 2
    [storage] => local::\/var\/www\/owncloud\/data\/XXX\/
    [path] => files
    [parent] => -1
    [name] => files
    [mimetype] => httpd\/unix-directory
    [mimepart] => httpd
    [size] => 1942513298
    [mtime] => 1406124002
    [storage_mtime] => 1403563950
    [encrypted] => 
    [unencrypted_size] => 0
    [etag] => 53cfc972c6e91
    [permissions] => 0
)

data: Array
(
    [mimetype] => httpd\/unix-directory
    [mtime] => 1406138787
    [size] => -1
    [etag] => 53cff9b9af112
    [storage_mtime] => 1406138787
    [permissions] => 31
)
","level":0,"time":"2014-07-23T18:06:49+00:00","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/"}
{"reqId":"[anonymised]","app":"files_texteditor","message":"starting app upgrade from 0.3 to 0.4","level":0,"time":"2014-07-23T18:09:28+00:00","method":"GET","url":"\/owncloud\/"}

@HackintoshHD
Copy link
Author

I went back to my ownCloud 6.0.4 backup, extracted the ownCloud 7.0.0 files and tested @PVince81 's patch from tracker issue #9817:

root@RaspberryPi /home/Administrator # sudo wget https://github.com/owncloud/core/commit/6f329dcb6cc535113fb45dd07f60a075a97a6db0.patch
--2014-07-24 10:22:03--  https://github.com/owncloud/core/commit/6f329dcb6cc535113fb45dd07f60a075a97a6db0.patch
Auflösen des Hostnamen »github.com (github.com)«... 192.30.252.130
Verbindungsaufbau zu github.com (github.com)|192.30.252.130|:443... verbunden.
HTTP-Anforderung gesendet, warte auf Antwort... 200 OK
Länge: 1611 (1,6K) [text/plain]
In »»6f329dcb6cc535113fb45dd07f60a075a97a6db0.patch«« speichern.

100%[===================================================================================================================>] 1.611       --.-K/s   in 0,002s

2014-07-24 10:22:09 (695 KB/s) - »»6f329dcb6cc535113fb45dd07f60a075a97a6db0.patch«« gespeichert [1611/1611]

root@RaspberryPi /home/Administrator # more 6f329dcb6cc535113fb45dd07f60a075a97a6db0.patch
From 6f329dcb6cc535113fb45dd07f60a075a97a6db0 Mon Sep 17 00:00:00 2001
From: Vincent Petry <pvince81@owncloud.com>
Date: Wed, 23 Jul 2014 23:38:17 +0200
Subject: [PATCH] Set version AFTER a successful update

If an app upgrade failed, the core version will not be increased either
in the database. This will re-display the update page and make it
possible to redo the apps upgrade.

Note that any core repair routine must take into account that an update
might need to be redone again even though the core's DB state is already
the one of the new version.
---
 lib/private/updater.php | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/private/updater.php b/lib/private/updater.php
index d50c255..7acd644 100644
--- a/lib/private/updater.php
+++ b/lib/private/updater.php
@@ -212,8 +212,6 @@ private function doUpgrade($currentVersion, $installedVersion) {
                        \OC_DB::updateDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml');
                        $this->emit('\OC\Updater', 'dbUpgrade');

-                       // TODO: why not do this at the end ?
-                       \OC_Config::setValue('version', implode('.', \OC_Util::getVersion()));
                        $disabledApps = \OC_App::checkAppsRequirements();
                        if (!empty($disabledApps)) {
                                $this->emit('\OC\Updater', 'disabledApps', array($disabledApps));
@@ -227,6 +225,9 @@ private function doUpgrade($currentVersion, $installedVersion) {

                        //Invalidate update feed
                        \OC_Appconfig::setValue('core', 'lastupdatedat', 0);
+
+                       // only set the final version if everything went well
+                       \OC_Config::setValue('version', implode('.', \OC_Util::getVersion()));
                }
        }
 }
--
1.9.3

root@RaspberryPi /home/Administrator # cd /var/www/owncloud
root@RaspberryPi /var/www/owncloud # patch -p1 < /home/Administrator/6f329dcb6cc535113fb45dd07f60a075a97a6db0.patch
patching file lib/private/updater.php
root@RaspberryPi /var/www/owncloud # root@RaspberryPi /home/Administrator #

Result: Now the upgrade went through flawlessly. I have to say I stopped all ownCloud Desktop Clients from running this time, so admittedly, it may not have been exactly the test you had ask for.

@HackintoshHD
Copy link
Author

@PVince81 Could you still anonymise the two names at [storage] => local::\/var\/www\/owncloud\/data\/_XXX_\/ in my data above? I had missed the two entries. - Thanks!

@nickvergessen
Copy link
Contributor

Removed the names

@PVince81
Copy link
Contributor

I tried simulating the broken situation locally:

  1. Let the core code update itself and set the version in the DB too early
  2. Add a sleep(180) in the code before app upgrades
  3. During that sleep, try making remote.php calls

The remote.php calls were blocked by the maintenance mode.

@HackintoshHD do you think there is any possibility that maybe the PHP process could not write the config.php file ? Because if maintenance mode cannot be set automatically in config.php it will not be able to block clients.

@dradux
Copy link

dradux commented Jul 25, 2014

@dyioulos , I am unsure what your issue could be, perhaps @PVince81 could shed some light on this?

I (and several others) are in the same boat as you in not having backups, to be honest, it is a bit easy to skip it when you do an upgrade of OC from a package manager as you are not going out and looking for an OC upgrade; however, that is not an excuse as there really is not one for creating a backup!

@dradux
Copy link

dradux commented Jul 25, 2014

@eehmke, I am unclear what your issue is. If you rolled back (database and files) you should be able to use @PVince81 patch and the upgrade should work. The process I outlined above is for the case when you do not have a backup.

@atelierscym
Copy link

@dradux Thank you, it worked for me ! I'll script the backup of my owncloud.db as soon as tonite ;-)

@sunweaver
Copy link

I experienced the same error message. Obviously with other reasons. I have the PosgreSQL DB backend in use.

I fixed the upgrade process with these commands in psql:

postgres=# \c owncloud
You are now connected to database "owncloud" as user "postgres".
owncloud=# ALTER TABLE oc_ldap_user_mapping DROP CONSTRAINT owncloud_name_users;
ALTER TABLE
owncloud=# ALTER TABLE oc_ldap_group_mapping DROP CONSTRAINT ldap_dn_groups;
ALTER TABLE
owncloud=# ALTER TABLE oc_ldap_group_members DROP CONSTRAINT ldap_group_members_index;
ALTER TABLE

@McNetic
Copy link
Contributor

McNetic commented Aug 7, 2014

I also had the problem, coming from 6.0.2 to 7.0.1. The patch could not be applied (2 rejected hunks). I fixed it afterwards by the described method exporting, droping, reimporting the shares.

@vengefulpunk
Copy link

Is this patch supposed to work in 7.0.1 or is it built into it perhaps?

@PVince81
Copy link
Contributor

The patch #9819 should be in 7.0.1 already.
Did you get log messages about apps updating themselves twice ?

@PVince81
Copy link
Contributor

@schiesbn any idea what could go wrong if update.php from the sharing app is run multiple times in parallel ?

@ulysse68
Copy link

Same problem from 6.0.2.2 to 7.0.1. Ubuntu server (installation of owncloud by apt-get install owncloud), using sqlite: fails upgrading files_sharing.

I still don't know what to do... Any help?

@PVince81
Copy link
Contributor

Most importantly it would be good to know whether the entry "Upgrading files_sharing" appears TWICE for you in the log.
If it does, then the issue is due to having clients connecting to OC during the upgrade. This should be fixed in 7.0.1 with a more robust fix upcoming in 7.0.2.

If you only see that message ONCE, then it is likely to be a different issue.
Then second question: did you upgrade from the web UI ? If yes, do you think you got a timeout error, did it take an hour or so to upgrade ?
If yes, restore your backups then try again with the CLI upgrade: ./occ upgrade.

If you didn't experience a timeout issue, then we'll need to look at your logs and/or DB to find out what kind of situation lead to having the files_sharing app's migration fail.

Note: the upgrade code for the files_sharing app is mostly converting the old "Shared" folder to the new structure that allows for flexible / freely movable shared files/folders.

Hope this helps a bit.

@PVince81
Copy link
Contributor

With "for you" I meant, all you guys in the thread, especially the ones who said "me too", so please check 😄

@McNetic
Copy link
Contributor

McNetic commented Aug 20, 2014

I've got no "Upgrading..." messages at all in my owncloud.log, but I have loglevel 0, so it might be due to that. Or there's a log location I don't know of.
I did upgrade from web UI, I did not get a timeout error, and it did not take more than a few seconds to do the upgrade.

@PVince81
Copy link
Contributor

@McNetic hmmm log level 0 is DEBUG so you should see such messages in owncloud.log, like in the first post #9810 (comment)

But this would only happen during the first upgrade try. If the apps were already upgraded, even with an error, it might not try to upgrade again the second time you try. (just guessing)

@McNetic
Copy link
Contributor

McNetic commented Aug 20, 2014

Ok, sorry. I grepped for "Upgrading files_sharing", which is different from what was posted above. I took a closer look, and found I also don't have messages like above (containing "starting app upgrade"). Maybe because I came from 6.0.2.
Anyways, I got an error message:

{"app":"core","message":"Failed to update database structure (exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 6 database table is locked' in \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php:742\nStack trace:\n#0 [internal function]: PDO->query('DROP INDEX ldap...')\n#1 \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(742): call_user_func_array(Array, Array)\n#2 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(181): Doctrine\\DBAL\\Connection->query('DROP INDEX ldap...')\n#3 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(35): OC\\DB\\Migrator->applySchema(Object(Doctrine\\DBAL\\Schema\\Schema))\n#4 \/var\/www\/owncloud\/lib\/private\/db\/mdb2schemamanager.php(99): OC\\DB\\Migrator->migrate(Object(Doctrine\\DBAL\\Schema\\Schema))\n#5 \/var\/www\/owncloud\/lib\/private\/db.php(320): OC\\DB\\MDB2SchemaManager->updateDbFromStructure('\/var\/www\/ownclo...')\n#6 \/var\/www\/owncloud\/lib\/private\/app.php(1172): OC_DB::updateDbFromStructure('\/var\/www\/ownclo...')\n#7 \/var\/www\/owncloud\/lib\/private\/app.php(980): OC_App::updateApp('user_ldap')\n#8 \/var\/www\/owncloud\/lib\/private\/app.php(87): OC_App::checkUpgrade('user_ldap')\n#9 \/var\/www\/owncloud\/lib\/private\/app.php(72): OC_App::loadApp('user_ldap')\n#10 \/var\/www\/owncloud\/apps\/files_sharing\/appinfo\/update.php(67): OC_App::loadApps(Array)\n#11 \/var\/www\/owncloud\/apps\/files_sharing\/appinfo\/update.php(10): removeSharedFolder()\n#12 \/var\/www\/owncloud\/lib\/private\/app.php(1179): include('\/var\/www\/ownclo...')\n#13 \/var\/www\/owncloud\/lib\/private\/app.php(980): OC_App::updateApp('files_sharing')\n#14 \/var\/www\/owncloud\/lib\/private\/app.php(87): OC_App::checkUpgrade('files_sharing')\n#15 \/var\/www\/owncloud\/lib\/private\/app.php(72): OC_App::loadApp('files_sharing')\n#16 \/var\/www\/owncloud\/lib\/private\/updater.php(220): OC_App::loadApps()\n#17 \/var\/www\/owncloud\/lib\/private\/updater.php(137): OC\\Updater->doUpgrade('7.0.1.1', '6.0.2.2')\n#18 \/var\/www\/owncloud\/core\/ajax\/update.php(35): OC\\Updater->upgrade()\n#19 {main}\n\nNext exception 'Doctrine\\DBAL\\DBALException' with message 'An exception occurred while executing 'DROP INDEX ldap_dn_users':\n\nSQLSTATE[HY000]: General error: 6 database table is locked' in \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php:47\nStack trace:\n#0 \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(744): Doctrine\\DBAL\\DBALException::driverExceptionDuringQuery(Object(PDOException), 'DROP INDEX ldap...')\n#1 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(181): Doctrine\\DBAL\\Connection->query('DROP INDEX ldap...')\n#2 \/var\/www\/owncloud\/lib\/private\/db\/migrator.php(35): OC\\DB\\Migrator->applySchema(Object(Doctrine\\DBAL\\Schema\\Schema))\n#3 \/var\/www\/owncloud\/lib\/private\/db\/mdb2schemamanager.php(99): OC\\DB\\Migrator->migrate(Object(Doctrine\\DBAL\\Schema\\Schema))\n#4 \/var\/www\/owncloud\/lib\/private\/db.php(320): OC\\DB\\MDB2SchemaManager->updateDbFromStructure('\/var\/www\/ownclo...')\n#5 \/var\/www\/owncloud\/lib\/private\/app.php(1172): OC_DB::updateDbFromStructure('\/var\/www\/ownclo...')\n#6 \/var\/www\/owncloud\/lib\/private\/app.php(980): OC_App::updateApp('user_ldap')\n#7 \/var\/www\/owncloud\/lib\/private\/app.php(87): OC_App::checkUpgrade('user_ldap')\n#8 \/var\/www\/owncloud\/lib\/private\/app.php(72): OC_App::loadApp('user_ldap')\n#9 \/var\/www\/owncloud\/apps\/files_sharing\/appinfo\/update.php(67): OC_App::loadApps(Array)\n#10 \/var\/www\/owncloud\/apps\/files_sharing\/appinfo\/update.php(10): removeSharedFolder()\n#11 \/var\/www\/owncloud\/lib\/private\/app.php(1179): include('\/var\/www\/ownclo...')\n#12 \/var\/www\/owncloud\/lib\/private\/app.php(980): OC_App::updateApp('files_sharing')\n#13 \/var\/www\/owncloud\/lib\/private\/app.php(87): OC_App::checkUpgrade('files_sharing')\n#14 \/var\/www\/owncloud\/lib\/private\/app.php(72): OC_App::loadApp('files_sharing')\n#15 \/var\/www\/owncloud\/lib\/private\/updater.php(220): OC_App::loadApps()\n#16 \/var\/www\/owncloud\/lib\/private\/updater.php(137): OC\\Updater->doUpgrade('7.0.1.1', '6.0.2.2')\n#17 \/var\/www\/owncloud\/core\/ajax\/update.php(35): OC\\Updater->upgrade()\n#18 {main})","level":4,"time":"2014-08-07T14:17:29+00:00"}

That's the only message containing "files_sharing" in the log. I suppose this is maybe a different issue than mentioned above. I got this message only once per try to upgrade (went back with db backup several times).

@PVince81
Copy link
Contributor

Any more luck with 7.0.3 ?

@ulysse68
Copy link

No problem with the upgrade (from 7.0.1). But I made sure to have a full backup first :)

@PVince81
Copy link
Contributor

Has this still been observed when upgrading from OC 6 to OC 7.0.4 ?

@PVince81
Copy link
Contributor

PVince81 commented Mar 9, 2015

Anyone still having issues with this ? (Upgrading from OC 6 to OC 7.0.4)

@maethor
Copy link

maethor commented Mar 9, 2015

Nope. I did the upgrade few weeks ago, it works.

@PVince81
Copy link
Contributor

Thanks a lot.
I'm closing this now.

If anyone is still having issues with 7.0.5 or 8.0.2, feel free to reopen.
Thanks.

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

No branches or pull requests