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

Error while migrating from Owncloud 10.1.0 to Nextcloud 12.0.13 #14549

Open
Addy771 opened this issue Mar 5, 2019 · 17 comments

Comments

@Addy771
Copy link

commented Mar 5, 2019

I ran into an error while attempting to migrate from Owncloud 10.1.0 to Nextcloud. I had read that the proper migration path for Owncloud 10.0.x was to migrate to Nextcloud 12.0.x, so I downloaded Nextcloud 12.0.13. Since I have backups of my data, configuration and database I attempted the migration.

I followed the manual migration instructions at: https://docs.nextcloud.com/server/15/admin_manual/maintenance/manual_upgrade.html

To start the upgrade process I first edited version.php to allow upgrading from Owncloud 10.1.0.
When I ran the upgrade command:
sudo -u www-data php occ upgrade

the upgrade fails because of this exception:

An exception occurred while executing 'DROP TABLE oc_accounts':
1217 Cannot delete or update a parent row: a foreign key constraint fails

To solve this, I needed to remove the foreign key constraints.
To find all foreign keys of the oc_accounts table, I ran this query in the mysql terminal:

select
	table_name,column_name,constraint_name,referenced_table_name,referenced_column_name
	from
	information_schema.key_column_usage
	where
	referenced_table_schema = 'frontier_cloud' and
	referenced_table_name = 'oc_accounts';

The output was:

+---------------------+------------------+---------------------+-----------------------+------------------------+
| table_name          | column_name      | constraint_name     | referenced_table_name | referenced_column_name |
+---------------------+------------------+---------------------+-----------------------+------------------------+
| oc_persistent_locks | owner_account_id | FK_F0C3D55BC901C6FF | oc_accounts           | id                     |
+---------------------+------------------+---------------------+-----------------------+------------------------+

Next, I looked at the oc_persistent_locks table by doing:
show create table oc_persistent_locks

In this table there were two constraints. The first was:

CONSTRAINT `FK_F0C3D55BC901C6FF` FOREIGN KEY (`owner_account_id`) REFERENCES `oc_accounts` (`id`) ON DELETE CASCADE

To remove the constraint and key I used the following:

alter table oc_persistent_locks
	drop foreign key FK_F0C3D55BC901C6FF,
	drop owner_account_id;

I used the same method to remove the second constraint and key (oc_filecache). It seems this same error was detailed in this issue, which helped point me in the right direction.

After this I was able to complete the upgrade process successfully.

Server configuration

Operating system: Ubuntu 18.04.2

Web server: Apache2

Database: MySQL

PHP version: 7.1.26

Nextcloud version: 12.0.13

Updated from an older Nextcloud/ownCloud or fresh install: Updated from Owncloud 10.1.0

Where did you install Nextcloud from: Archive

Signing status:

Results
=======
- core
	- INVALID_HASH
		- version.php

I had to edit version.php to add owncloud 10.1.0 to the supported versions

List of activated apps:

App list
Enabled:
  - bruteforcesettings: 1.3.0
  - comments: 1.2.0
  - dav: 1.3.1
  - federatedfilesharing: 1.2.0
  - federation: 1.2.0
  - files: 1.7.2
  - files_external: 1.3.0
  - files_trashbin: 1.2.0
  - files_versions: 1.5.0
  - files_videoplayer: 1.1.0
  - firstrunwizard: 2.1
  - logreader: 2.0.0
  - lookup_server_connector: 1.0.0
  - nextcloud_announcements: 1.1
  - notifications: 2.0.0
  - oauth2: 1.0.6
  - password_policy: 1.2.2
  - provisioning_api: 1.2.0
  - serverinfo: 1.2.0
  - sharebymail: 1.2.0
  - survey_client: 1.0.0
  - systemtags: 1.2.0
  - theming: 1.3.0
  - twofactor_backupcodes: 1.1.1
  - updatenotification: 1.2.0
  - workflowengine: 1.2.0
Disabled:
  - activity
  - admin_audit
  - encryption
  - files_pdfviewer
  - files_sharing
  - files_texteditor
  - gallery
  - user_external
  - user_ldap

Nextcloud configuration:

Config report
{
    "system": {
        "instanceid": "oc6ehmsu4frn",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "192.168.1.50",
            "fsi.us.to"
        ],
        "datadirectory": "\/data\/cloud\/",
        "overwrite.cli.url": "http:\/\/fsi.us.to\/nextcloud",
        "dbtype": "mysql",
        "version": "12.0.13.2",
        "dbname": "frontier_cloud",
        "dbhost": "localhost",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "UTC",
        "installed": true,
        "loglevel": 2,
        "maintenance": false,
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    }
}

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

Client configuration

Browser: Google Chrome Version 72.0.3626.119

Operating system: Windows 7 64-bit

@Chsbrgr

This comment has been minimized.

Copy link

commented Mar 27, 2019

Thank you, this helped me also upgrade from owncloud 10.1.0 to nextcloud 12.0.13.

@rroseselavy42

This comment has been minimized.

Copy link

commented Mar 27, 2019

I have also successfully used instructions here. +

@Addy771

This comment has been minimized.

Copy link
Author

commented Mar 27, 2019

Thanks for the feedback, it's good to know this method is working for other people too.

@sixtyfive

This comment has been minimized.

Copy link

commented May 9, 2019

FWIW, the same method seems to still be working with the combination of owncloud 10.1.1.1 / nextcloud 12.0.13.2. Thank you very much, @Addy771!

@bobvandevijver

This comment has been minimized.

Copy link

commented May 21, 2019

This also worked for me, and I've also successfully upgraded to later versions. This should be added to the actual migration manual!

@embexx

This comment has been minimized.

Copy link

commented Jun 4, 2019

the following helped me to migrate owncloud 10.2.0.5 to nextcloud:

  • Stopping apache
  • Install Nextcloud (nextcloud-12.0.13)
  • take /config and /data from owncloud installation
  • Changing version.php by adding '10.2.0.5' => true in section owncloud.
  • Copying owncloud-db to nextcloud via phpMyAdmin with unchecking Add constraints.
  • Changing config to point to nextcloud-db
  • Start migation
@skjnldsv

This comment has been minimized.

Copy link
Member

commented Jun 5, 2019

Closing as it works with provided steps and info on this thread! Thanks everyone!! 🤗

@skjnldsv skjnldsv closed this Jun 5, 2019

@MarkusNeviadomski

This comment has been minimized.

Copy link

commented Aug 26, 2019

Hi @ALL, tried out to update along the above scenario here and get stuck....
I tried to upgrade from OC 10.2.1.4 and want to ask if anyone has done this with success? Post above describes only for OC 10.2.0

@sixtyfive

This comment has been minimized.

Copy link

commented Aug 27, 2019

You'll have to give some info where you get stuck, provide some error messages or logs or any kind of info if you want people to be able to help you.

@embexx

This comment has been minimized.

Copy link

commented Aug 27, 2019

So you did: Changing version.php by adding '10.2.1.4' => true in section owncloud?

@EgbertW

This comment has been minimized.

Copy link

commented Sep 15, 2019

Any clue when this will be supported without the hack? I ran into the same problem trying to migrate from ownCloud 10.2.1 to Nextcloud. I'll stick with ownCloud until this is supported without manually modifying the database.

@sixtyfive

This comment has been minimized.

Copy link

commented Sep 15, 2019

@EgbertW, the Issue has been closed by @skjnldsv. Perhaps better to open a new one requesting support for a specific combination of releases?

@EgbertW

This comment has been minimized.

Copy link

commented Sep 15, 2019

I noticed it has been closed, but I don't see any actual resolution. And I don't expect it to come from the NextCloud 12 release, actually, as that is an unmaintained release. The main problem is that the update server of NextCloud states that to migrate from OwnCloud 10.1.x or 10.2.x, you need to download NextCloud release 12. But NextCloud 12 doesn't support upgrading from these newer versions of OwnCloud, so I guess this migration feature needs to be updated in the current release of NextCloud and the update server needs to start suggesting a newer release.

I'm fine with starting a new issue, but the contents will be the same as no actual fix has been implemented, except for doing more manual work.

Or is the official stance of NextCloud: migrating from OwnCloud >= 10.1.0 is not supported without manually editting version.php file and manually modifying the database? In that case, maybe the guide on https://nextcloud.com/migration/ should be updated to reflect that.

@kesselb

This comment has been minimized.

Copy link
Contributor

commented Sep 15, 2019

I guess there is no upgrade path from OwnCloud 10.1.x or 10.2.x to Nextcloud without manual steps. Your summorized the current state quite well. Nextcloud 12 is EOL so another release is unlikely but a direct migration to Nextcloud 15 is not possible.

@nextcloud/server-triage what do you suggest? Sure the migration is a one-time action but there should be some kind of documentation or automation for this case.

@kesselb kesselb reopened this Sep 15, 2019

@kesselb kesselb added the needs info label Sep 15, 2019

@nickvergessen

This comment has been minimized.

Copy link
Member

commented Sep 15, 2019

It's on my todo to look for a solution that allows migrating to a newer nextcloud. Unluckily this involves a lot of testing and risk for the data, also basically we need to run the upgrade steps from nc12 to nc17, although you are on 17. That makes it a bit complicated.

Also we have to check for the database and php versions on the way. Because making a migration where you have to replace the database or php version is not the best idea.

@EgbertW

This comment has been minimized.

Copy link

commented Sep 15, 2019

@nickvergessen That does sound like it makes it a lot more complicated. It really all depends on the desire to keep supporting migration paths from ownCloud. Currently it seems that it is a recommended / supported migration, but it currently fails when you come from an up-to-date ownCloud version.

In my case, it's slightly more painful as I'd thought: let me do the migration to NextCloud today. I should probably first start with upgrading ownCloud to the latest version. I was coming from 1.0.2 from which the migration to NextCloud seems to be supported. Only after I verified that the upgrade to 10.2.1 succeeded and removed the backups I found out that I'd be better of not having done that.

Anyway. Given the complexity of supporting the migration from OC in NC17, is it totally unthinkable to consider doing another minor upgrade to NC12, with the only change adding migration support from OC >= 10.1.0? And if it is, maybe it can be considered to update the script linked to in the migration guide ( https://download.nextcloud.com/server/installer/migrator/index.php ) to automate these steps when OC >= 10.1.0 is detected?

@sixtyfive

This comment has been minimized.

Copy link

commented Sep 15, 2019

Is it not in many cases required to upgrade PHP an DB to be able to run NC17 in the first place, anyways?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.