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 [email protected] has spamfilter enabled:

~# find /usr/local/psa/handlers/ -name '10-spam-0gemCa'
/usr/local/psa/handlers/before-local/recipient/[email protected]/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.

Plesk 9.X Upgrades : Table ‘mysql.procs_priv’ doesn’t exist

Plesk Upgrades to Plesk 9.X may result in MySQL errors while adding new Database user under Plesk.

Error under Plesk :
Table ‘mysql.procs_priv’ doesn’t exist

You can also check the same error under command line :

mysql> flush privileges;
ERROR 1146 (42S02): Table ‘mysql.procs_priv’ doesn’t exist
mysql>

This can be fixed using below command. This will try to repair/ recreate the tables having issues.

cat /usr/share/mysql/mysql_fix_privilege_tables.sql | mysql --no-defaults --force --user=admin -p --host=localhost --database=mysql

Note: Before executing this command, make sure that you have taken the full backup of MySQL.

Hope this helps 🙂

cPanel : Horde login error !

Horde login error

Horde Login shows below error :

Warning: Unknown: write failed: Disk quota exceeded (122) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of
session.save_path is correct (/var/cpanel/userhomes/cpanelhorde/sessions) in Unknown on line 0

Then try this cPanel script :

/scripts/autorepair phpapps_owner_fix

The above cPanel script will reset all the quotas for the cPanel users.

Plesk : Upgrading failed with error while trying to execute SQL query

Symptoms
Upgrade version 8.6 failed. The following error is shown in upgrade log:

/tmp/psa_8.6.0_cos4.build86080722.02_upgrade.090611.00.57.log
—>8—
ERROR while trying to execute SQL query, the query was: DELETE FROM mysql.user WHERE user = ”; FLUSH PRIVILEGES;

Aborting…

STOP psa-8.6.0-cos4.build86080722.02 upgrading AT Thu Jun 11 00:57:52 CDT 2009
—8<---

What does the error mean and how to resolve the problem?

Cause
Execution of query “FLUSH PRIVILEGES” is not possible because table ‘mysql.procs_priv’ is missing in database ‘mysql’.
To verify login to mysql and try the command:

mysql> flush privileges;
ERROR 1146 (42S02): Table ‘mysql.procs_priv’ doesn’t exist

mysql>

Resolution
In MySQL 5.0 you may create the table with the following query:

mysql> CREATE TABLE `procs_priv` (
`Host` char(60) collate utf8_bin NOT NULL default '',
`Db` char(64) collate utf8_bin NOT NULL default '',
`User` char(16) collate utf8_bin NOT NULL default '',
`Routine_name` char(64) collate utf8_bin NOT NULL default '',
`Routine_type` enum('FUNCTION','PROCEDURE') collate utf8_bin NOT NULL,
`Grantor` char(77) collate utf8_bin NOT NULL default '',
`Proc_priv` set('Execute','Alter Routine','Grant') character set utf8 NOT NULL default '',
`Timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`),
KEY `Grantor` (`Grantor`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges'

After the table was created you may continue upgrading.

It is recommended to download Plesk distributive from Parallels website, unpack it and install packages with “rpm -Uvh”.

Note: Before executing this command, make sure that you have taken the full backup of MySQL.

OR

cat /usr/share/mysql/mysql_fix_privilege_tables.sql | mysql --no-defaults --force --user=admin -p --host=localhost --database=mysql

[How to] How to configure containers to not apply Microsoft updates installed on Virtuozzo host.

Symptoms

By default Microsoft updates installed on Virtuozzo host are applied in containers during next containers start.

Resolution

If auto applying Microsoft updates in containers is unnecessary option it is possible to configure containers to not install updates even if its are on Virtuozzo host.

The following example shows how to disable this auto applying option for container 100:

vzcfgt set 100 DisableWindowsUpdates 1

If this option is set to “1” no more windows updates will be applied to the container 100.

But you can still manually install or remove windows updates to this container by using Container Update Manager.

To find Container Update Manager click Start button on the node and go to All Programs, Parallels, Parallels Virtuozzo Containers.

The command below enables auto applying option for container 100:

vzcfgt set 100 DisableWindowsUpdates 0

Also it’s possible to disable auto applying option for all newly created containers on a node:

vzcfgt set 0 DisableWindowsUpdates 1

Note: If it’s necessary to enable the auto installation of windows updates back in containers you should re-configure each container separately.