profile
viewpoint

Ask questionsError while migrating from Owncloud 10.1.0 to Nextcloud 12.0.13

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: <details> <summary>App list</summary>

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

</details>

Nextcloud configuration: <details> <summary>Config report</summary>

{
    "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***"
    }
}

</details>

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

nextcloud/server

Answer questions AlexandreBonneau

For info, following the initial post from @Addy771 (and running the additional alter table oc_persistent_locks drop foreign key FK_F0C3D55B93CB796C, drop file_id; sql statement at the end), I was able to migrate from the latest owncloud stable version 10.4.1.3 to Nextcloud 12.

Do note that you need to add the '10.4.1.3' => true, line in the owncloud array (not the nextcloud one) in version.php.

useful!

Related questions

NextCloud update to 16.0.1 failed, Database issue hot 2
Install deletes .user.ini file and breaks .htaccess hot 2
AH01630: client denied by server configuration: /var/www/nextcloud/config hot 2
Unable to delete User hot 2
Authenticating with ZimbraDrive results &#34;Call to a member function inGroup() on null&#34; - server hot 2
Update to 16.0.0: The table with name 'nextcloud.oc_login_flow_v2' already exists. hot 1
stable16: upgrade failes with "UnexpectedValueException: The files of the app "activity" were not correctly replaced before running the update hot 1
"An unknown error has occurred" when upload any files with extensions. hot 1
Unable to transfer file ownership away from deleted ldap user hot 1
"CONVERT TO CHARACTER SET utf8mb4" hot 1
Problem Sharing files (NextCloud 16 - Debian 8.11) - Invalid query, please check the syntax. API specifications are here: http://www.freedesktop.org/wiki/Specifications/open-collaboration-services sharing hot 1
ClamAV Webdav Nextcloud 15.02 not working hot 1
15.0.2: No sharing settings in sidebar hot 1
Sabre\DAV\Exception\ServiceUnavailable: TypeError: Argument 1 passed to OCA\User_LDAP\Group_LDAP::walkNestedGroups() must be of the type string, null given hot 1
"Undefined index:" for several things (owner, quota especially. hot 1
source:https://uonfu.com/
Github User Rank List