Skip to content

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

Closed

Description

@XueSheng-GIT

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)

Activity

  1. VicDeo commented on Jul 10, 2013

    @VicDeo
    Contributor
  2. karlitschek commented on Jul 10, 2013

    @karlitschek
    Contributor

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

  3. georgehrke commented on Jul 10, 2013

    @georgehrke
    Contributor

    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?

  4. XueSheng-GIT commented on Jul 10, 2013

    @XueSheng-GIT
    Author

    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?

  5. georgehrke commented on Jul 10, 2013

    @georgehrke
    Contributor

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

  6. VicDeo commented on Jul 10, 2013

    @VicDeo
    Contributor

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

  7. XueSheng-GIT commented on Jul 10, 2013

    @XueSheng-GIT
    Author

    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)
    
  8. georgehrke commented on Jul 10, 2013

    @georgehrke
    Contributor

    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?

  9. XueSheng-GIT commented on Jul 10, 2013

    @XueSheng-GIT
    Author

    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 (#999 (comment))
    Any relation to this database issue?

  10. VicDeo commented on Jul 10, 2013

    @VicDeo
    Contributor

    [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)

  11. XueSheng-GIT commented on Jul 11, 2013

    @XueSheng-GIT
    Author

    @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?

  12. georgehrke commented on Jul 11, 2013

    @georgehrke
    Contributor

    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)

  13. XueSheng-GIT commented on Jul 11, 2013

    @XueSheng-GIT
    Author

    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 (comment)

    Maybe the cause is the same!?

  14. georgehrke commented on Jul 11, 2013

    @georgehrke
    Contributor

    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

  15. omarwllorente commented on Jul 11, 2013

    @omarwllorente

    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

  16. 10 remaining items

  17. eggithub commented on Jul 17, 2013

    @eggithub

    hi there,

    I'm having the issues that the calendar app couldnt update. Now I did some renaming (from calendar to cldnr) in phpmyadmin. strange thing with my DB is that it is missing the oc_calendar_share_calendar table.

    Should I be worried?

  18. georgehrke commented on Jul 17, 2013

    @georgehrke
    Contributor

    I'm having the issues that the calendar app couldnt update. Now I did some renaming (from calendar to cldnr) in phpmyadmin. strange thing with my DB is that it is missing the oc_calendar_share_calendar table.

    Should I be worried?

    Did you had problems with stucking in maintenance mode with earlier versions of owncloud?

  19. eggithub commented on Jul 17, 2013

    @eggithub

    I can remember one maybe two times.not sure it was in 4 or 5. however I am able to share calendars...

  20. georgehrke commented on Jul 17, 2013

    @georgehrke
    Contributor

    That's probably the reason why the table was missing.
    If you created oc_calendar_share_calendar for now, there should be no problems with future updates.

  21. eggithub commented on Jul 17, 2013

    @eggithub

    but shouldnt it be named oc_clndr_share_calendar now? or do you mean, first create then rename to new convention?

    oh and perhaps do you have the query for me? my pretty much a noob at this

  22. georgehrke commented on Jul 17, 2013

    @georgehrke
    Contributor

    but shouldnt it be named oc_clndr_share_calendar now?

    yes, it should

  23. eggithub commented on Jul 17, 2013

    @eggithub

    Is the content of the table of any concern or can I just use the "create table" in my phpadmin tool to create a table with only one column called "id" (since every table needs to have one column it says).

    thanx

  24. georgehrke commented on Jul 17, 2013

    @georgehrke
    Contributor

    Is the content of the table of any concern or can I just use the "create table" in my phpadmin tool to create a table with only one column called "id" (since every table needs to have one column it says).

    If the database structure is not correct the next update will most certainly fail

  25. eggithub commented on Jul 17, 2013

    @eggithub

    could you provide me with the query to create the table with the right content?

  26. georgehrke commented on Jul 17, 2013

    @georgehrke
    Contributor
    CREATE TABLE "oc_clndr_share_calendar" ("owner" VARCHAR(255) DEFAULT ' ' NOT NULL, "share" VARCHAR(255) DEFAULT ' ' NOT NULL, "sharetype" VARCHAR(6) DEFAULT ' ' NOT NULL, "calendarid" BIGINT UNSIGNED DEFAULT 0 NOT NULL, "permissions" SMALLINT DEFAULT 0 NOT NULL, "active" INTEGER DEFAULT 1 NOT NULL);
  27. eggithub commented on Jul 17, 2013

    @eggithub

    Thanx mate, didnt work at first but figured it out (had to lose the double quotes).

    you're an angel.

  28. diederikdehaas commented on Dec 12, 2013

    @diederikdehaas

    The query for creating the oc_calendar_repeat table on MySQL is:

    CREATE TABLE oc_calendar_repeat (id INTEGER AUTO_INCREMENT, 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', PRIMARY KEY (id));

    And if you get an error about multiple primary keys defined, you probably have to change the query to:

    ALTER TABLE oc_calendar_repeat RENAME TO oc_clndr_repeat, CHANGE id id INT UNSIGNED NOT NULL AUTO_INCREMENT;

    HTH

  29. jancborchardt commented on Feb 26, 2014

    @jancborchardt
    Contributor

    I’m closing this issue because it has been inactive for a few months. This probably means that the issue is not reproducible or it has been fixed in a newer version.

    Please reopen if you still encounter this issue with the latest stable version and then please use the issue template. You an also contribute directly by providing a patch – see the developer manual. :)

    Thank you!

  30. locked as resolved and limited conversation to collaborators on Aug 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions