• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

migration from 9.5 to 10 keeps failing with user already exists error

stefanos

Basic Pleskian
I'm migrating domains from plesk 9.5 to plesk 10, both on linux (from ubuntu 6.06 to ubuntu 10.04). Most of the domains are migrated with no problems, but there are some of them that keep failing with errors like the attached file (success with errors is reported, but no files are transfered).

There are basically 2 errors
Unable to create system user
and
User USERNAME already exists.

Both errors are reported in /opt/psa/admin/plib/api-cli/domain.php

After the failed migration The directory of the domain is created, but it is totally empty (no httpdocs directory, no nothing). The user is created in /etc/passwd

I checked that the sys_users table of the psa database has no such user before starting the migration. I have done over 10 migration attempts with various settings, but with no luck
 

Attachments

  • plesk.txt
    1.3 KB · Views: 8
You should remove all traces of DOMAIN on destination server.

# rm -fr /var/www/vhosts/DOMAIN
# grep USERNAME /etc/passwd
# userdel USERNAME
mysql> select * from sys_users where login='USERNAME';
mysql> delete from sys_users where login='USERNAME';
mysql> delete from accounts where id=xxx; <- account_id from sys_users table

Then try to create domain back with

# /usr/local/psa/bin/domain.sh -c DOMAIN

and try to run update command from your error log

# /opt/psa/admin/plib/api-cli/domain.php --update DOMAIN -hosting true -hst_type phys -ip IP_ADDRESS -www-root httpdocs -login USERNAME -passwd PASSWORD

You will see useful error. It will help you to find a reason of this problem. Do not forget completely remove this domain from destination server after finish investigation.
 
Igor, thank you for your answer, but I'm afraid this did not resolve the problem.

I had already cleaned /var/www/vhosts with the directory of the domain, and /etc/passwd was already cleaned as well. Table sys_users and accounts was already cleaned by me too. (of course I checked all of them again before trying the next steps).

The file /usr/local/psa/bin/domain.sh is not available on my system, but I created the domain with
/opt/psa/admin/plib/api-cli/domain.php -c DOMAIN
with no errors

Then I executed
/opt/psa/admin/plib/api-cli/domain.php --update MY_DOMAIN -hosting true -hst_type phys -ip xxx.xxx.101.227 -www-root httpdocs -login MY_USERNAME -passwd SOMEPWD
and there were NO errors at all.

So I followed all your instructions (beside that missing domain.sh) and I could not find any error message that would help me debug the problem. Any other idea?
 
Strange. Why you have errors like "already exists" if you haven't any domain traces on destination server? Looks like domain was not completely removed.
 
I agree that this seems to be the problem. But where else could be traces of these accounts? And I have to add that this does not happen only to 1 or 2 domains. I have until now about 7 domains with the exact same problem, and I am still counting as I migrate the rest of the domains
 
I think that it is that case when only detailed investigation directly on your servers can help. Therefore I suggest you contact support team.
 
thank you for the suggestion Igor, but I'm not ready to pay for something which seems to be a bug in Plesk (at least not yet).

More information in case someone else encounters this:
I even renamed both the domain and the domain's ftp account before migration, and I get the exact same error. So maybe it isn't some kind of trace left over from previous migrations that's bothering plesk... these domains have something in common that prevents them from being migrated
 
ok, here it is

PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE
Migration from Plesk 9.5.3 on Ubuntu 6.06 (32bit)
to Plesk 10.0.1 on Ubuntu 10.04 (64bit)

PROBLEM DESCRIPTION AND STEPS TO REPRODUCE
I'm migrating domains from plesk 9.5 to plesk 10. Most of the domains are migrated with no problems (about 60), but there are some of them that keep failing with errors like the rext under "additional information" (success with errors is reported, but no files are transfered).

There are basically 2 errors
Unable to create system user
and
User USERNAME already exists.

Both errors are reported in /opt/psa/admin/plib/api-cli/domain.php

After the failed migration The directory of the domain is usually created, but it is totally empty (no httpdocs directory, no nothing). The user is usually created in /etc/passwd

I checked and cleaned the sys_users table, the /etc/passwd file before starting the migration. I have done over 10 migration attempts with various settings, but with no luck

When creating the domain and changing parameters with /opt/psa/admin/plib/api-cli/domain.php manually, I don't get any errors

I've also tried to rename both the domain and the ftp user, with the same result



ACTUAL RESULT
I get an empty directory under /var/www/vhosts, an entry in /etc/passwd and a subscription for the domain. But no actual data is transfered


EXPECTED RESULT
The domain should be operational with all files transfered

ANY ADDITIONAL INFORMATION
sample error log
<?xml version="1.0"?>
<execution-result status="success">
<object name="DOMAIN" type="domain">
<object name="DOMAIN" type="hosting">
<message code="ExecCmd::ExFailed" severity="error">
<context>void plesk::ExecCmd::reportError() const</context>
<file>ExecCmd.cpp</file>
<line>49</line>
<text>Execution of /opt/psa/admin/plib/api-cli/domain.php --update DOMAIN -hosting true -hst_type phys -ip IP_ADDRESS -www-root httpdocs -webstat webalizer -err_docs true -login USERNAME -passwd failed with return code 1.
Stderr is
An error occurred during domain update: error in hosting updating: Unable to update hosting settings: system user update is failed: Unable to create system user: usermng: /usr/sbin/chpasswd execution error. result code=512
</text>
</message>
</object><
message code="ExecCmd::ExFailed" severity="error">
<context>void plesk::ExecCmd::reportError() const</context>
<file>ExecCmd.cpp</file><line>49</line>
<text>Execution of /opt/psa/admin/plib/api-cli/domain.php --update DOMAIN -hosting true -hst_type phys -ip IP_ADDRESS -www-root httpdocs -login USERNAME -passwd failed with return code 1.
Stderr is
An error occurred during domain update: error in hosting updating: Unable to update hosting settings: system user update is failed: User USERNAME already exists.
</text></message></object>
</execution-result>
 
Ok. Thank you. I have submitted request. I will update thread when I receive any useful information.
 
The exactly matching message template "​User %1 already exists." is used only in database-related code.

Check if there are mysql users with conflicting names:

SELECT User FROM mysql.user;
 
no, I'm afraid that this isn't the problem either.

I checked the user table and there are no usernames conflicting with the usernames of the databases being transferred.
 
Do you have Postgresql? If so, also check:

​SELECT * FROM pg_user;
 
I get a "1" as output which I believe means that the user does not exist (trying with an existing user from other account outputs a "0")

root@s7 ~ # /opt/psa/admin/sbin/usermng --user-exist --user=MYUSERNAME
1
 
Need more details from migration logs

/usr/local/psa/PMM/logs/
/usr/local/psa/PMM/logs/archives/

Try to find it.
 
attached are all the log files under /usr/local/psa/PMM/logs/, truncated for the specific migration. I've replaced all the references to IP addresses and actual domain names and usernames

Thank you for your ongoing support
 

Attachments

  • migration_logs.zip
    41.6 KB · Views: 1
The error is caused by chpasswd utility on Ubuntu being a bit different from other linuxes, thus confusing our usrmng.
It is invoked only when a migrated user has an encrypted password.

Try the following workaround. It's a wrapper around chpasswd that makes it ignore -e option that does cause the error.

mv /usr/sbin/chpasswd /usr/sbin/chpasswd.orig
cat > /usr/sbin/chpasswd << EOF
#!/bin/sh

ARGS=

for A in \$*; do
if [ \$A != "-e" ]; then
ARGS="\$ARGS \$A";
fi
done

/usr/sbin/chpasswd.orig \$ARGS

EOF
chmod a+x /usr/sbin/chpasswd
 
I tried your suggestion, but now I get another error "Failed preliminary check by password service"


<?xml version="1.0"?>
<execution-result status="success"><object name="DOMAIN" type="domain"><object name="DOMAIN" type="hosting"><message code="ExecCmd::ExFailed" severity="error"><context>void plesk::ExecCmd::reportError() const</context><file>ExecCmd.cpp</file><line>49</line><text>Execution of /opt/psa/admin/plib/api-cli/domain.php --update DOMAIN -hosting true -hst_type phys -ip IPADDRESS -www-root httpdocs -webstat webalizer -err_docs true -login USERNAME -passwd failed with return code 1.
Stderr is
An error occurred during domain update: error in hosting updating: Unable to update hosting settings: system user update is failed: Unable to create system user: usermng: PAM password change failed: 24, Failed preliminary check by password service
</text></message></object><message code="ExecCmd::ExFailed" severity="error"><context>void plesk::ExecCmd::reportError() const</context><file>ExecCmd.cpp</file><line>49</line><text>Execution of /opt/psa/admin/plib/api-cli/domain.php --update DOMAIN -hosting true -hst_type phys -ip IPADDRESS -www-root httpdocs -login USERNAME -passwd failed with return code 1.
Stderr is
An error occurred during domain update: error in hosting updating: Unable to update hosting settings: system user update is failed: Unable to create system user: usermng: PAM password change failed: 24, Failed preliminary check by password service
</text></message></object></execution-result>
 
Back
Top