Parallels Plesk upgrade issue: "Integrity constraint violation: 1062 Duplicate entry '1' for key 1"

Refers to:

  • Plesk 11.0 for Linux
  • Plesk 11.5 for Linux

Created:

2016-11-16 13:11:49 UTC

Modified:

2016-12-21 20:10:03 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Parallels Plesk upgrade issue: "Integrity constraint violation: 1062 Duplicate entry '1' for key 1"

Symptoms

  1. An upgrade from Parallels Plesk 9.5 fails with one of the following messages:

    Error: Unable to execute file-sharing: ERROR: Dependent row(s) 'FileSharingUsers.userId = 1' isn't found for 'smb_users.id = 1'.

    Updating client with id 7...
    Zend_Db_Statement_Exception: SQLSTATE[230 00]: Integrity constraint violation: 1062 Duplicate entry '1' for key 1
    file: /usr/local/psa/admin/externals/Zend/Db/Statement/Pdo.php
    line: 234
    code: 23000
  2. After the upgrade, the smb_roles table has no roles belonging to the administrator's users:

    mysql> select * from smb_roles where ownerId = (select id from clients where login = 'admin');
    Empty set (0.00 sec)

Cause

The internal ID of the admin user in the Plesk database was not 1 before the upgrade, and the Plesk upgrade script failed to properly update the administrator account's properties.

Resolution

This problem is caused by a known issue (with the report ID TP-141589 ). The issue has been completely fixed in Parallels Plesk 11.5 MU#14 .

Workaround

  1. Download patch_141611v2.tar.gz to the server.

  2. Apply the patch with the following command:

    tar zxf patch_141611v2.tar.gz -C /usr/local/psa/admin/ --backup
  3. Re-run the database upgrade procedure to create the administrator's roles:

    /usr/local/psa/bin/sw-engine-pleskrun /usr/local/psa/admin/plib/scripts/db-update-plesk10.php
  4. Get the Admin role from the smb_roles table and update smb_roleServicePermissions with the correct roleId :

    mysql> update smb_roleServicePermissions rsp, smb_servicePermissions sp, smb_roles sr set rsp.roleId=sr.id where  rsp.servicePermissionId=sp.id and sp.permissionCode="external" and sr.isBuiltIn=1 and sr.name="Admin";
  5. Re-run the filesharing upgrade:

    /usr/local/psa/bin/sw-engine-pleskrun /usr/local/psa/admin/plib/scripts/upgrade_filesharing_1011.php
  6. Reconfigure the web server configuration:

    /usr/local/psa/admin/sbin/httpdmng --reconfigure-all
Have more questions? Submit a request
Please sign in to leave a comment.