Are you trying to use "mchk" Utility in Plesk?
This guide is for you.
The mchk Utility in Plesk helps to rebuild all mail configuration files. In addition, it restores the settings for all mailboxes created in Parallels Plesk Panel.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform Plesk related queries.
In this context, we shall look into how to use Plesk Utility to fix errors.
Mchk plesk utility sets proper ownership and permissions for all mailboxes. And, It rebuilds mail server control files mailboxes settings.
In addition, it sets appropriate permissions for all the related files. In short, it will rebuild the mail configuration or recreate the broken mail handlers.
Recently, one of our customers approached us with the request to provide him the steps to perform mchk utility in both Windows and Linux.
Since it will cause some downtime, we recommended running it only during off-peak hours.
The steps we follow both in Linux and Windows are given below:
We usually follow the steps below:
1. Parallels Plesk Panel for Windows
C:\Users\Administrator>cd %plesk_bin%
C:\Parallels\Plesk\admin\bin>mchk.exe –all –fix=all
2. Parallels Plesk Panel for Linux
i. Firstly, we stop the mail service
/usr/local/psa/admin/sbin/mailmng –stop-service
ii. Next, backup old handlers:
mkdir /root/temp
cp -a /usr/local/psa/handlers/before-* /root/temp/
cp -a /usr/local/psa/handlers/info /root/temp/
iii. Then, we delete all the mail handlers:
rm -rf /usr/local/psa/handlers/before-*/*
rm -rf /usr/local/psa/handlers/info/*
iv. After that, we run mchk utility to recreate mail handlers:
/usr/local/psa/admin/sbin/mchk –with-spam
v. Finally, we start the mail service:
/usr/local/psa/admin/sbin/mailmng –start-service
By performing these steps we helped our customer with his query regarding mchk.
Moving ahead, let us focus on a few errors and its fix in detail.
a) Plesk repair mail or mchk fails: mail_outgoing_restore… fail
The symptoms of this error include:
Plesk repair mail or /usr/local/psa/admin/sbin/mchk command fails:
==> Checking for: mail_outgoing_restore... fail
Some utilities have exited with errors:
/usr/lib64/plesk-9.0/remote_mail_restore/mail_outgoing_restore
The following files present on the server:
# ls -al /usr/lib/plesk-9.0/mail_postfix_transport_restore
-rwxr-x--- 1 root root 348 Mar 1 2018 /usr/lib/plesk-9.0/mail_postfix_transport_restore
# ls -al /usr/lib/plesk-9.0/remote_mail_restore/mail_outgoing_restore
-rwxr-x--- 1 root root 358 Mar 1 2018 /usr/lib/plesk-9.0/remote_mail_restore/mail_outgoing_restore
The major cause of this error is a failed upgrade.
In order to solve this, follow the below steps:
i. Log in to the server over SSH
ii. Move the files to the other location:
# mv /usr/lib/plesk-9.0/remote_mail_restore/mail_postfix_transport_restore /root/plesksupport/
# mv /usr/lib/plesk-9.0/remote_mail_restore/mail_outgoing_restore /root/plesksupport/
iii. Reinstall latest updates:
# plesk installer update --repatch
b. mchk failed: mailsrv_conf_init… not found
i. Execution of plesk repair mail fails:
# plesk repair mail
Reconfiguring all domains and mailboxes ......................... [2017-09-03 11:17:31] ERR [util_exec] proc_close() failed ['/opt/psa/admin/bin/mchk'] with exit code [1]
[FAILED]
- mchk failed: ==> Checking for: mailsrv_conf_init... not found,
skipped
ii. Symbolic link /usr/bin/which points not to /bin/which:
# ls -al /usr/bin/which
lrwxrwxrwx 1 root root 63 Aug 24 04:04 /usr/bin/which -> ../local/share/.config/yarn/global/node_modules/which/bin/which
Mail authorization database is empty:
# /usr/local/psa/admin/bin/mail_auth_dump
Authentication database contents:
+--------------------------------------+
| address |flags| password |
+--------------------------------------+
+--------------------------------------+
iii. In /var/log/maillog there are records like:
Feb 3 06:59:30 mail plesk_saslauthd[25101]: failed mail authenticatication attempt for user 'example' (password len=9)
Feb 3 06:59:30 mail postfix/smtpd[25099]: warning: unknown[xxx.xxx.xxx.xxx]: SASL LOGIN authentication failed: authentication failure
Incorrect location of /usr/bin/which is the cause of this error.
In order to resolve this our Support Techs suggest the following steps:
i. Connect to the server via SSH.
ii. Change location of /usr/bin/which:
# unlink /usr/bin/which
# ln -s /bin/which /usr/bin/which
# ls -al /usr/bin/which
lrwxrwxrwx 1 root root 10 Feb 4 04:15 /usr/bin/which -> /bin/which
iii. If the issue persists, reinstall which package:
# rpm -e --nodeps --noscripts which
# yum install which -y
iv. Run plesk repair mail again.
This article will guide you on mchk utility in #Plesk and how to use it to fix errors. It helps to repair malfunctioning Plesk services.
By using Plesk Reconfigurator, you can check and #repair Plesk installation that is malfunctioning due to misconfiguration of one or more of its components.
The following problems can be identified and corrected by using the Repair Plesk Installation option:
1. problems with mail delivery caused by user-made changes in DNS server addresses.
2. misconfigurations of system user accounts or groups used by Plesk to access system objects.
3. malfunction of Plesk's services.
4. misconfigurations in user access permissions for files and folders on server disks and hosting folders.
5. miscalculations of disk space usage by individual domains and subdomains.