How do I repair/rebuild all mail configuration files and restore settings for all mailboxes?

Resolution
This can be done with Plesk mchk utility:

# /usr/local/psa/admin/sbin/mchk --help
Synopsis:
mchk [OPTION]
--without-spam - restore all settings except for SpamAssassin configuration
--with-spam - restore all settings
--spam-only - restore only SpamAssassin settings

This utility rebuilds in line with Plesk database Qmail control files in the /var/qmail/control, /var/qmail/users directories and mail users’ settings. Also, it sets proper ownership/permissions for all mailboxes (/var/qmail/mailnames/*).

Example:
# /usr/local/psa/admin/sbin/mchk --with-spam

I get the error: “Could not connect to SQL database. Too many connections”.

Symptoms
Sometimes I get the “Too many connections” error in Plesk CP or when open a site in my browser:

Unable to connect to database: Too many connections

Cause
This error means that the limit of simultaneous MySQL connection to mysql server is reached and new connections to the server cannot be established at this time.

Resolution
There are two ways to solve this issue. The first one is increase the connection limit and the second, find what is the reason of “too many connection” error and try to lower MySQL server usage.

MySQL server state can be checked using ‘mysqladmin’ utility. For example to find out the number of current connections to the server use:

# mysqladmin -uadmin -p`cat /etc/psa/.psa.shadow` extended-status | grep Max_used_connections
| Max_used_connections | 11 |

Current connections limit settings can be found with:

# mysqladmin -uadmin -p`cat /etc/psa/.psa.shadow ` variables | grep 'max.*connections'
| max_connections | 100 |
| max_user_connections | 0

In the example above, maximum number of connections to the server (max_connections) is set to 100. And maximum number of connections per user (max_user_connections) to zero, that means unlimited. There are default MySQL values. They can be redefined in /etc/my.cnf, for example:

[mysqld]
set-variable=max_connections=150
set-variable=max_user_connections=20

Restart MySQL after my.cnf is modified.

Note, if you set connections limit to very high value (more than 300) it may affect the server performance. It is better to find out the reason of the high MySQL server usage. You may check what users/requests slow mysql and take all curent connections, for example with the command:

# mysqladmin -uadmin -p`cat /etc/psa/.psa.shadow` processlist

Parallels Plesk Panel reports that updates are available however all components are should updated on autoinstaller page

Symptoms
When I log to Parallels Plesk Panel it tells me that I have updates.
But when I check updates on page Home -> Updates -> Parallels Plesk Panel 9.2.x everything looks updated.

What causes the problem?
Cause
This issue is caused by the fact that there are still some components of Parallels Plesk Panel that need to be upgraded. But these components not listed on the Updater page in Parallels Plesk Panel.

Resolution
The problem will be fixed in future updates of Parallels Plesk Panel. As s solution for now it is recommended to upgrade the older component manually.

Run the following command to get list of Plesk components ready for updating:

~# /usr/local/psa/admin/sbin/autoinstaller --select-release-id PLESK_9_2_0 --show-components 2>&1 | grep upgrade
qmail [upgrade] - Qmail mailserver
~#

Put your own release ID instead of PLESK_9_2_0.

Use the following command to install the component:

~# /usr/local/psa/admin/sbin/autoinstaller --select-release-latest --install-component qmail

Message cannot be delivered and error “Unable to stat …executable’ or it is not link: No such file or directory” in maillog

Symptoms
For some account messages cannot be delivered and the following errors are shown in maillog:

/usr/local/psa/var/log/maillog
--->8---
Jun 10 03:53:42 vps310 postfix-local[21983]: Unable to stat entry '/usr/local/psa/handlers/info/10-spam-0gemCa/executable' or it is not link: No such file or directory
---8<---

Utility mchk does not fix the problem.

Cause
The error is caused by the fact that configuration of mail handler 10-spam-0gemCa is broken.
According to configuration in file system mail account mail@domain.name.tld has spamfilter enabled:

~# find /usr/local/psa/handlers/ -name '10-spam-0gemCa'
/usr/local/psa/handlers/before-local/recipient/mail@domain.name.tld/10-spam-0gemCa
~#

During message processing mail service is looking for executable binary, however it is missing:

~# ls -l /usr/local/psa/handlers/info/10-spam-0gemCa/executable
ls: /usr/local/psa/handlers/info/10-spam-3HB5Xe/executable: No such file or directory
~#

Resolution
It is advised to remove all mail handlers and run utility mchk to restore configuration according to Plesk database.
Stop services qmail, postfix, courier-imap and xinetd, backup old handlers and remove them:

~# /etc/init.d/postfix stop
~# /etc/init.d/qmail stop
~# /etc/init.d/courier-imap stop
~# /etc/init.d/xinetd stop

~# mkdir /root/temp
~# cp -a /usr/local/psa/handlers/before-local/recipient /root/temp/
~# cp -a /usr/local/psa/handlers/info /root/temp/
~# rm -rf /usr/local/psa/handlers/before-local/recipient/*
~# rm -rf /usr/local/psa/handlers/info/*

Then run utility mchk to recreate mail handlers. The output may look like the following:

~# /usr/local/psa/admin/sbin/mchk --with-spam
==> Checking for: mail_spam_restore... ok
==> Checking for: mailsrv_conf_init... ok
==> Checking for: mail_mailbox_restore... ok
==> Checking for: mailsrv_entities_dump... ok
==> Checking for: mail_admin_aliases... ok
==> Checking for: mail_auth_dump... ok
==> Checking for: mailman_lists_dump... ok
==> Checking for: mail_responder_restore... ok
==> Checking for: mail_drweb_restore... ok
==> Checking for: mail_kav_restore... not exsists
==> Checking for: mail_spf_restore... ok
==> Checking for: mail_dk_restore... ok
==> Checking for: mail_grey_restore... ok
~#

IMPORTANT: custom mail handlers will be lost after the reconfiguration. They need to be recreated.

Start services qmail, postfix, courier-imap and xinetd after the reconfiguration.
Additional information
The same problem may affect DrWeb Antivirus. You might get the following Antivirus filter report in bounce message:

--- Dr.Web report ---
Dr.Web detailed report:
The filter cannot connect to the DrWEB daemon

--- Dr.Web report ---

This meant that the message could not be delivered because execution of DrWeb mail handler failed.
Additional information
Parallels Plesk Panel 9.x provides ability to configure and put custom mail handlers: PPP 9.2 for Linux/Unix:: Modules API Reference
These handlers do not correspond to records in Plesk database, so mchk does not reconfigure mail handlers automatically.

Currently it is advised to recreate mail handlers according to the instructions above.

cPanel User Shell Access : fork: Resource temporarily unavailable

The cPanel user shell access gives error all of a sudden :

root@server [~]# su - user
-bash: fork: Resource temporarily unavailable

The culprit seems to be cPanel and its “Shell Fork Bomb Protection”. Logging into WHM >> Security >> Security Center >> “Shell Fork Bomb Protection” and clicking “Disable Protection” resolves the issue.

Shell Fork bomb Protection will prevent users with terminal access (ssh/telnet) from using up the server’s resources and possibly crashing the server.

PhpMyAdmin Stuck at Login screen with no errors !

This is a possible issue when the path to save php_session is not correctly set :

The directory for storing session does not exists or php do not have sufficient rights to write to it.

To define the php_session directory simply add the following line to the php.ini :

session.save_path=”/tmp/php_session/”

And give write rights to the http server.

usually, the http server run as user daemon in group daemon. If it is the case, the following commands will make it :

chown -R :daemon /tmp/php_session

chmod -R g+wr /tmp/php_session

restart http server.