Symptoms
-
Unable to swap domain and domain alias names in Plesk with the error below:
Error: mailmng-core failed: mailmng[23434]: Mail directory /var/qmail/mailnames/example.com already exists
-
The following can be found in
/var/log/plesk/panel.log
:ERR [util_exec] proc_close() failed ['/opt/psa/admin/bin/mailmng-core' '--rename-domain' '--old-domain-name=domain-example.com' '--new-domain-name=alias-example.com'] with exit code [1]
ERR [1] '/opt/psa/admin/bin/mailmng-core' '--rename-domain' '--old-domain-name=domain-example.com' '--new-domain-name=alias-example.com' failed with code 1. stdout: Fatal error: boost::filesystem::filesystem_error(boost::filesystem::rename: Directory not empty: "/var/qmail/mailnames/domain-example.com", /var/qmail/mailnames/alias-example.com)
Cause
Mail directory for the alias is not empty.
Resolution
In order to archive the goal to swap domain and domain alias names remove incorrect folder for alias:
-
Connect to the server via SSH.
Note: Let's assume that
domain-example.com
is a domain name andalias-example.com
is an alias. -
Move current mailnames folder for alias to another directory as a backup:
# mv /var/qmail/mailnames/alias-example.com/ ~/alias-example.com/
-
If
/var/qmail/mailnames/domain-example.com
does not exist, copy backed up mail directory:# mkdir /var/qmail/mailnames/domain-example.com
# cp -p ~/alias-example.com/* /var/qmail/mailnames/domain-example.com/ -
Rename the domain.