Symptoms
-
A subscription/domain can not be created or migrated to a Plesk server: Cannot migrate or create subscription:
Restore domain object 'example.com'
Execution of /opt/psa/admin/plib/api-cli/domain.php --update example.com -guid 2f0a7ad4-7003-4a81-8f2d-faaefaa6ad77 -creation-date 2016-11-09 -description '' -hosting true -hst_type phys -do-not-apply-skeleton -ip '203.0.113.2' -www-root httpdocs -login user -passwd '' -passwd_type sym -ignore-nonexistent-options failed with return code 1.
Stderr is
An error occurred during domain update: An error occurred during changing of hosting settings: The user john.doe already exists. -
The dame error appears in attempt to create a subscription manually from the command line:
# plesk bin subscription -c example.com -owner admin -service-plan "Default Domain" -ip 203.0.113.2 -login john.doe -passwd ""
An error occurred during domain creation: An error occurred during changing of hosting settings: The user john.doe already exists.
Cause
The user john.doe
doesn't exist in the psa
database:
# plesk db "select * from sys_users where login = 'john.doe'"
Empty output
However, is already present in the system:
# less /etc/passwd | grep john.doe
john.doe:x:10006:1004::/var/www/vhosts/example.com:/bin/false
Resolution
-
Connect to the server via SSH.
-
Delete the user
john.doe
from the system:# userdel john.doe
-
Move his home directory:
# mv /var/www/vhosts/example.com ~/
-
Create the domain once again.
In case of migration, remove the subscription from the target server and re-migrate it.