core icon indicating copy to clipboard operation
core copied to clipboard

Failed to update Calendar app (Upgrade 5.0.7 -> 5.0.8)

Open XueSheng-GIT opened this issue 13 years ago • 38 comments

While upgrading from 5.0.7 to 5.0.8 I got the following error msg. I didn't have any issues with calendar app so far. How to fix it?

Aktualisiere ownCloud auf Version 5.0.8. Dies könnte eine Weile dauern.

Turned on maintenance mode Updated database Failed to update Calendar app: Failed to update database structure (MDB2 Error: unknown error, _doQuery: [Error message: Could not execute statement] [Last executed query: ALTER TABLE oc_calendar_objects RENAME TO oc_clndr_objects, CHANGE id id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, CHANGE calendarid calendarid INT UNSIGNED DEFAULT 0 NOT NULL, CHANGE startdate startdate DATETIME DEFAULT '1970-01-01 00:00:00', CHANGE enddate enddate DATETIME DEFAULT '1970-01-01 00:00:00'] [Native code: 1068] [Native message: Multiple primary key defined] )

The update was unsuccessful. Please report this issue to the ownCloud community.

Server configuration:

Operating system: Ubuntu 12.04 Web server: Server version: Apache/2.2.22 (Ubuntu), Server built: Mar 8 2013 15:53:13 Database: mysql PHP version: PHP 5.3.10-1ubuntu3.6 ownCloud version: 5.0.7 (in progress of update to 5.0.8)

XueSheng-GIT avatar Jul 10 '13 20:07 XueSheng-GIT

@XueSheng-GIT please update your report according to issue template https://raw.github.com/owncloud/core/master/issue_template.md

VicDeo avatar Jul 10 '13 20:07 VicDeo

@georgehrke Do you have any idea? any DB schema changes?

karlitschek avatar Jul 10 '13 21:07 karlitschek

we renamed the database table from oc_calendar_objects to oc_clndr_objects, so it's compatible with oracleDB.

@XueSheng-GIT what db do you use?

georgehrke avatar Jul 10 '13 21:07 georgehrke

I've updated the report with my server configuration. I'm using mysql database. Expected behaviour/Actual behaviour should be obvious.

@georgehrke so I have to repair the database? How to do that?

XueSheng-GIT avatar Jul 10 '13 21:07 XueSheng-GIT

Strange I use Debian wheezy with MySQL and Apache 2.2.22 and my upgrade worked just fine

georgehrke avatar Jul 10 '13 21:07 georgehrke

@XueSheng-GIT do you have any other tables besides owncloud in that particular database?

VicDeo avatar Jul 10 '13 21:07 VicDeo

I've owncloud running in its own guest system. mysql is only used for owncloud (no other databases). Database setup was done according to: http://doc.owncloud.org/server/5.0/admin_manual/configuration/configuration_database.html

mysql> show tables;
+------------------------------+
| Tables_in_owncloud           |
+------------------------------+
| oc_appconfig                 |
| oc_calendar_calendars        |
| oc_calendar_objects          |
| oc_calendar_repeat           |
| oc_calendar_share_calendar   |
| oc_calendar_share_event      |
| oc_contacts_addressbooks     |
| oc_contacts_cards            |
| oc_contacts_cards_properties |
| oc_file_map                  |
| oc_filecache                 |
| oc_files_trash               |
| oc_files_trashsize           |
| oc_files_versions            |
| oc_gallery_sharing           |
| oc_group_admin               |
| oc_group_user                |
| oc_groups                    |
| oc_locks                     |
| oc_lucene_status             |
| oc_media_albums              |
| oc_media_artists             |
| oc_media_sessions            |
| oc_media_songs               |
| oc_media_users               |
| oc_mimetypes                 |
| oc_permissions               |
| oc_pictures_images_cache     |
| oc_preferences               |
| oc_properties                |
| oc_queuedtasks               |
| oc_share                     |
| oc_storages                  |
| oc_users                     |
| oc_vcategory                 |
| oc_vcategory_to_object       |
+------------------------------+
36 rows in set (0.00 sec)

XueSheng-GIT avatar Jul 10 '13 21:07 XueSheng-GIT

How to do that?

You have to rename all owncloud calendar tables from oc_calendar_* to oc_clndr_*. Afterwords you have to update the oc_appconfig table and set configvalue to 0.6.4 where appid is calendar and configkey is installed_version

Is there anything special in your ownCloud.log or apache's error log?

georgehrke avatar Jul 10 '13 21:07 georgehrke

The posted error msg is the only error msg in ownCloud.log since last week. apache error.log also does not contain more errors than usual:

[Wed Jul 10 22:30:40 2013] [error] [client 127.0.0.1] client denied by server configuration: /var/www/owncloud/data/htaccesstest.txt
[Wed Jul 10 22:30:40 2013] [error] [client 127.0.0.1] File does not exist: /var/www/core
[Wed Jul 10 22:41:24 2013] [error] [client 192.168.5.70] File does not exist: /var/www/favicon.ico
[Wed Jul 10 22:41:24 2013] [error] [client 192.168.5.70] File does not exist: /var/www/favicon.ico

Thanks for providing the necessary database changes. Although I'll have to look closer into the mysql documentation because I've no clue how to do these "simple" changes. I wouldn't mind if someone could post copy'n'paste commands.

Thanks for all your help! I'll report back as soon as possible.

May one last note: I was also hit by issue 999 and did the following commands to solve upgrade issues from 5.0.5 to 5.0.6 (https://github.com/owncloud/core/issues/999#issuecomment-16778131) Any relation to this database issue?

XueSheng-GIT avatar Jul 10 '13 21:07 XueSheng-GIT

[Wed Jul 10 22:30:40 2013] [error] [client 127.0.0.1] client denied by server configuration: /var/www/owncloud/data/htaccesstest.txt [Wed Jul 10 22:30:40 2013] [error] [client 127.0.0.1] File does not exist: /var/www/core [Wed Jul 10 22:41:24 2013] [error] [client 192.168.5.70] File does not exist: /var/www/favicon.ico [Wed Jul 10 22:41:24 2013] [error] [client 192.168.5.70] File does not exist: /var/www/favicon.ico

Nothing to worry about. Automatic data folder protection works and your host has no favicon.ico in the root directory (it is in core/img/favicon.png)

VicDeo avatar Jul 10 '13 22:07 VicDeo

@georgehrke I did the manual database changes as mentioned by you. At least I tried ;) That's what I did:

mysql> RENAME TABLE oc_calendar_calendars TO oc_clndr_calendars;
mysql> RENAME TABLE oc_calendar_objects TO oc_clndr_objects;
mysql> RENAME TABLE oc_calendar_repeat TO oc_clndr_repeat;
mysql> RENAME TABLE oc_calendar_share_calendar TO oc_clndr_share_calendar;
mysql> RENAME TABLE oc_calendar_share_event TO oc_clndr_share_event;

mysql> UPDATE oc_appconfig SET configvalue = "0.6.4" WHERE appid = "calendar" AND configkey = "installed_version";

After doing that, I was able to access the webfrontend of owncloud again! On the first view, I would also say that nothing is lost. Thanks again for your quick response and help!!!

The only question which remains is: Why did the update fail in the first step? Why was I able to do a manual database update, but the updater itself failed? Doesn't the updater itself do the same steps?

XueSheng-GIT avatar Jul 11 '13 07:07 XueSheng-GIT

Your initial post shows the error message "Multiple primary key defined". I've no clue where this error message comes from. Let's see if our DB experts have an idea why this error occurred (ping @DeepDiver1975 @butonic)

georgehrke avatar Jul 11 '13 07:07 georgehrke

Maybe I'm repeating myself and I know nothing about mysql, but issue 999 seems to be also related to "Multiple primary key defined". See for example: https://github.com/owncloud/core/issues/999#issuecomment-15780942

Maybe the cause is the same!?

XueSheng-GIT avatar Jul 11 '13 08:07 XueSheng-GIT

Maybe I'm repeating myself and I know nothing about mysql, but issue 999 seems to be also related to "Multiple primary key defined". See for example: #999

Maybe the cause is the same!?

You are right. It looks like there is most certainly a connection between those two bugs

georgehrke avatar Jul 11 '13 08:07 georgehrke

Hi!

We had the same issue when updating from 5.0.7 to 5.0.8 using sqlite over ubuntu 12.04 64 bits.

The messages were the following:

Actualizando ownCloud a la versión 5.0.8, esto puede demorar un tiempo.

Turned on maintenance mode Updated database Updating filecache, this may take really long... ... 9% done ... ... 18% done ... ... 27% done ... ... 36% done ... ... 45% done ... ... 54% done ... ... 63% done ... ... 72% done ... ... 81% done ... ... 90% done ... ... 100% done ... Updated filecache Failed to update Calendar app: Failed to update database structure (MDB2_Schema Error: invalid, it was specified a previous table name ("oc_calendar_repeat") for table "oc_clndr_repeat" that does not exist)

The update was unsuccessful. Please report this issue to the ownCloud community.

I had to roll back to 5.0.7 with the db file used for the update, so please, if maybe we have problems in that side, tell me about them. It seems to work correctly.

Thanks for the efforts.

Omar

omarwllorente avatar Jul 11 '13 10:07 omarwllorente

Hi @omarwllorente, would you mind posting a list of your database tables?

georgehrke avatar Jul 11 '13 10:07 georgehrke

@omarwllorente It looks like there is a database table missing in your ownCloud instance.

georgehrke avatar Jul 11 '13 10:07 georgehrke

Hi @georgehrke, thanks for your response. Table listing below:

sqlite> .databases seq name file


0 main /var/www/owncloud/data/owncloud.db
1 temp
sqlite> .tables oc_appconfig oc_bookmarks oc_bookmarks_tags oc_calendar_calendars oc_calendar_objects oc_calendar_share_calendar oc_calendar_share_event oc_contacts_addressbooks oc_contacts_cards oc_contacts_cards_properties oc_dlstcharts oc_dlstcharts_uconf oc_file_map oc_filecache oc_files_antivirus oc_files_trash oc_files_trashsize oc_files_versions oc_fscache oc_gallery_sharing oc_group_admin oc_group_user oc_groups oc_internal_bookmarks oc_ldap_group_mapping oc_ldap_group_members oc_ldap_user_mapping oc_locks oc_log oc_lucene_status oc_media_albums oc_media_artists oc_media_sessions oc_media_songs oc_media_users oc_mimetypes oc_permissions oc_pictures_images_cache oc_preferences oc_properties oc_queuedtasks oc_share oc_sharing oc_storages oc_users oc_vcategory oc_vcategory_to_object sqlite>

omarwllorente avatar Jul 11 '13 11:07 omarwllorente

Indeed, the table oc_calendar_repeat is missing for some reason.

sqlite> .schema oc_clndr_repeat
CREATE TABLE "oc_calendar_repeat" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "eventid" INTEGER UNSIGNED DEFAULT 0 NOT NULL, "calid" INTEGER UNSIGNED DEFAULT 0 NOT NULL, "startdate" DATETIME DEFAULT '1970-01-01 00:00:00', "enddate" DATETIME DEFAULT '1970-01-01 00:00:00');
sqlite>

The update should work afterwords

georgehrke avatar Jul 11 '13 11:07 georgehrke

@omarwllorente BTW, did you had problems with stucking in maintenance mode with earlier versions of owncloud?

georgehrke avatar Jul 11 '13 11:07 georgehrke