Articles in this section

Unable to migrate domain via Plesk Migrator: Integrity constraint violation Duplicate entry

Plesk for Linux kb: technical ext: migrator

Applicable to:

  • Plesk for Linux

Symptoms

  • Plesk Obsidian running on a Linux-based operating system
  • During a Plesk to Plesk migration, the Plesk migrator extension shows an error that is similar to the following:

    CONFIG_TEXT: Unable to create subscription 'one.example.com'.
    Command execution failed on the local server with non-zero exit code.
    command: /opt/psa/bin/subscription --create one.example.com -hosting true -hst_type phys -login jdoe -passwd '' -ip 203.0.113.2 -do-not-apply-skeleton -notify false -service_plan Unlimited -force -guid d8789f58-15dd-4339-b6f3-db1b0b2cea37 -creation-date 2020-02-13 -mail_service true -ignore-nonexistent-options
    exit code: 1
    stdout:
    stderr: [2023-03-08 11:11:16.750] 2517065:64085f42d5e62 ERR [panel] Unable to load object of type PhDomain with id=66: Unable to update domain data: DB query failed: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'd8789f58-15dd-4339-b6f3-db1b0b2cea37' for key 'guid', query was: UPDATE `domains` SET `id` = ?, `cr_date` = ?, `name` = ?, `displayName` = ?, `dns_zone_id` = ?, `status` = ?, `htype` = ?, `real_size` = ?, `cl_id` = ?, `cert_rep_id` = ?, `limits_id` = ?, `params_id` = ?, `guid` = ?, `overuse` = ?, `vendor_id` = ?, `webspace_id` = ?, `parentDomainId` = ?, `webspace_status` = ?, `permissions_id` = ?, `external_id` = ?, `adminDescription` = ?, `resellerDescription` = ?, `description` = ?, `gl_filter` = ?, `icpStatus` = ?, `icpPermit` = ?, `monthlyTraffic` = ? WHERE (id = 66)

  • The guid of the domain that is being migrated (d8789f58-15dd-4339-b6f3-db1b0b2cea37 in this example) is already used by another domain on the destination server:
    Source Plesk server:

    CONFIG_TEXT: plesk db -Ne "SELECT guid, count(guid),displayName FROM domains GROUP BY guid HAVING COUNT(guid)" | grep d8789f58-15dd-4339-b6f3-db1b0b2cea37
    d8789f58-15dd-4339-b6f3-db1b0b2cea37 1 one.example.com

    Target (destination) Plesk server:

    CONFIG_TEXT: plesk db -Ne "SELECT guid, count(guid),displayName FROM domains GROUP BY guid HAVING COUNT(guid)" | grep d8789f58-15dd-4339-b6f3-db1b0b2cea37
    d8789f58-15dd-4339-b6f3-db1b0b2cea37 1 two.example.com

Cause

The domain or subdomain that you are attempting to move from the source server to the destination server has a guid configured on the side of the source server that matches a guid that already exists on the destination server (it is most likely already used by a different domain). Two matching GUIDs should not exist within the Plesk database of a single Plesk server, due to which the Plesk migration cannot proceed.
Note: GUID stands for Globally Unique Identifier

Resolution

1. Log into your target server via SSH
2. Execute the following command in order to create a secret key for the necessary XML API session:

Note: The IP address 203.0.133.2 should be replaced with the public IP of the destination Plesk server.

# plesk bin secret_key -c -ip-address 203.0.133.2 -description "Admin access token"

The output would be similar to the following:

# root@server:~# plesk bin secret_key -c -ip-address 203.0.133.2 -description "Admin access token"
2def0469-25d7-e728-0c43-f6aae307a392

3. Create a file named changeguid.xml (in your current directory) by executing the following command:

# touch changeguid.xml

4. Open the file for editing with your favorite command-line text editor and input the following contents (replace two.example.com with the domain that needs a guid change in your case):

CONFIG_TEXT: <?xml version="1.0" encoding="UTF-8" ?>
<packet>
<site>
<set>
<filter>
<name>two.example.com</name>
</filter>
<values>
<gen_setup>
<guid></guid>
</gen_setup>
</values>
</set>
</site>
</packet>

5. Save the changes

6. Run the following command in order to generate a new unique guid for the domain that is using the matching one on the destination server:

Note: Replace 203.0.133.2 with your public destination Plesk server IP and 2def0469-25d7-e728-0c43-f6aae307a392 with the key you received while executing step 2

# curl -kLi -H "Content-Type: text/xml" -H "KEY: 2def0469-25d7-e728-0c43-f6aae307a392" -H "HTTP_PRETTY_PRINT: TRUE" -d @changeguid.xml https://203.0.133.2:8443/enterprise/control/agent.php

The output would be similar to the following:

# root@server:~# curl -kLi -H "Content-Type: text/xml" -H "KEY: 2def0469-25d7-e728-0c43-f6aae307a392" -H "HTTP_PRETTY_PRINT: TRUE" -d @changeguid.xml https://203.0.133.2:8443/enterprise/control/agent.php
HTTP/2 200
server: nginx
date: Mon, 18 Mar 2024 15:55:24 GMT
content-type: text/xml;charset=UTF-8
p3p: CP="NON COR CURa ADMa OUR NOR UNI COM NAV STA"
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
expires: Mon, 26 Jul 1990 05:00:00 GMT
last-modified: Mon, 18 Mar 2024 15:55:24 GMT
cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
pragma: no-cache
x-content-type-options: nosniff

<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.9.1">
<site>
<set>
<result>
<status>ok</status>
<filter-id>two.example.com</filter-id>
<id>39</id>
</result>
</set>
</site>
</packet>

7. Confirm the domain on the destination server that was using the matching guid is now using a different one by executing the following command:

# plesk db -Ne "SELECT guid, count(guid),displayName FROM domains GROUP BY guid HAVING COUNT(guid)" | grep two.example.com

The output would be similar to the following:

# root@server:~# plesk db -Ne "SELECT guid, count(guid),displayName FROM domains GROUP BY guid HAVING COUNT(guid)" | grep two.example.com
7864e79a-25c4-4f10-8bcb-ebd963db042e 1 two.example.com

Now that the guid has been changed, you may continue with the migration via the Plesk Migrator without getting such an error

Additional information

About XML API | Plesk Obsidian documentation

Was this article helpful?

Comments

1 comment
Date Votes
  • Hello,

    We are running Plesk Obsidian 18.0.67.3 on CentOS Linux 7.9.2009 (Final).
    When we try to update Plesk, the process fails with dependency errors:

    sw-engine-7.71.1-1centos.7.250709.0854.x86_64 requires libgsasl.so.7()(64bit)
    sw-engine-7.71.1-1centos.7.250709.0854.x86_64 requires libpsl.so.0()(64bit)
    sw-engine-cli-7.71-7.71.1-1centos.7.250709.0854.x86_64 requires libpsl.so.0()(64bit)
    sw-engine-cli-7.71-7.71.1-1centos.7.250709.0854.x86_64 requires libgsasl.so.7(LIBGSASL_1.1)(64bit)
    sw-engine-cli-7.71-7.71.1-1centos.7.250709.0854.x86_64 requires libgsasl.so.7()(64bit)
    

    We tried:

    • Enabling centos-vault repositories for base and updates
    • Searching for libpsl and libgsasl in base, updates, extras, vault repos
    • Installing epel-release from archived sources
    • Manually downloading RPMs from vault.centos.org

    But we cannot find libpsl or libgsasl anywhere in the enabled repos.
    yum search returns no matches, and the files on vault.centos.org are replaced with HTML pages.

    Could you please advise where to obtain these packages or how to resolve the dependency issue so we can update Plesk?

    Thank you for your help. 

    0

Please sign in to leave a comment.