Articles in this section

Unable to start migration on Plesk server: Command execution failed on the local server with non-zero exit code. command: /usr/local/psa/bin/secret_key --list

kb: technical ext: migrator Plesk Obsidian for Linux

Symptoms

  • Plesk migration doesn't start with the error like below:

    CONFIG_TEXT: Failed to check Plesk API connection to target Plesk server: Command execution failed on the local server with non-zero exit code.
    command: /usr/local/psa/bin/secret_key --list
    exit code: 1
    stdout: ***hidden***
    stderr: ***hidden***

  • The command from the error message plesk bin secret_key --list runs for a long time and then fails with database error:

    CONFIG_TEXT: DB query failed: SQLSTATE[HY000] [2002] Connection refused
    exit status 1

  • There are a lot of rows in the SecretKeys and SecretKeysIpAddresses tables in Plesk psa database:

    # plesk db "select count(keyId) from SecretKeysIpAddresses;"
    +--------------+
    | count(keyId) |
    +--------------+
    | 319772 |
    +--------------+

    # plesk db "select count(id) from SecretKeys;"
    +-----------+
    | count(id) |
    +-----------+
    | 319769 |
    +-----------+

Cause

Too many entries in the SecretKeys and SecretKeysIpAddresses tables.

Resolution

Temporarily remove entries in the SecretKeys and SecretKeysIpAddresses tables until the migration is finished:

  1. Connect to the server via SSH
  2. Backup Secret Keys with the next command:

# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -uadmin psa SecretKeys > /root/SecretKeys_backup.sql

# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -uadmin psa SecretKeysIpAddresses > /root/SecretKeysIpAddresses_backup.sql

  1. Remove the existing keys from the database:

# plesk db "TRUNCATE TABLE SecretKeys"

# plesk db "TRUNCATE TABLE SecretKeysIpAddresses"

  1. Re-start the migration process
  2. After the migration is finished, restore the keys:

# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin psa < /root/SecretKeys_backup

Since Plesk 18.0.33 restoration step can be ignored, as the Migrator recreates keys/records automatically

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.