Failed to update Calendar app (Upgrade 5.0.7 -> 5.0.8)
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_objectsRENAME TOoc_clndr_objects, CHANGEididINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, CHANGEcalendaridcalendaridINT UNSIGNED DEFAULT 0 NOT NULL, CHANGEstartdatestartdateDATETIME DEFAULT '1970-01-01 00:00:00', CHANGEenddateenddateDATETIME 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 please update your report according to issue template https://raw.github.com/owncloud/core/master/issue_template.md
@georgehrke Do you have any idea? any DB schema changes?
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?
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?
Strange I use Debian wheezy with MySQL and Apache 2.2.22 and my upgrade worked just fine
@XueSheng-GIT do you have any other tables besides owncloud in that particular database?
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)
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?
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?
[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)
@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?
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)
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!?
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
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
Hi @omarwllorente, would you mind posting a list of your database tables?
@omarwllorente It looks like there is a database table missing in your ownCloud instance.
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>
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
@omarwllorente BTW, did you had problems with stucking in maintenance mode with earlier versions of owncloud?