Posts Tagged ‘OpenVZ’
Solution for amavisd error – TROUBLE in process_request: Error writing a SMTP response to the socket: Broken pipe – on OpenVZ server
If you get error messages from amavisd similar to the one posted below on a server which is virtualized with OpenVZ:
Mar 5 09:09:02 v100 amavis: (17378-14) (!!)TROUBLE in process_request: Error writing a SMTP response to the socket: Broken pipe at (eval 100) line 987, <GEN44> line 31.
then the issue can be caused by the NUMTCPSOCK value in the openvz limits. Even if the barrier of this limit was never met in /proc/user_beancounters, the above error occurs when more then 25% of all TCP sockets were used. The solution is to set the NUMTCPSOCK barrier and limit to a high value in the openvz container configuration file. Here a value that worked for me on a moderately used mailserver:
Finally restart the OpenVZ VM to apply the new limit value.
If you want to set the time in a OpenVZ Guest automatically, execute the following command on the host system:
vzctl set 101 –capability sys_time:on –save
and restart the guest system:
vzctl restart 101
101 is the ID of the container and has to be changed to match the ID of your OpenVZ VM.
Thanks to PlanetFox for this FAQ.
If you get the error “/dev/zero: No space left on device” in the apache error.log on a OpenVZ virtual machine, then the shared memory size in the xcache.ini is too high or the xcache.mm_path is set wrong.
Edit the file /etc/php5/conf.d/xcache.ini
and check the mm_path. On a OpenVZ virtual machine it should be set to “/tmp/xcache” as /dev/zero might not work correctly in a virtual machine:
xcache.mmap_path = “/tmp/xcache”
Then restart apache2:
and check if the error has been resolved.
If the roor still occurs after some time, you will have to reduce the xcache.size.
Edite the xcache.ini file:
and set xcache.size to e.g. 8 MB
xcache.size = 8M
Then restart apache2:
The /tmp and /dev/shm directories of a OpenVZ virtual machine shall be mounted without suid and exec permissions. To achieve this, create a a shell script on the host server for every virtual machine which contains the commands to remount the directories. This script will be started automatically by openvz when the VM is started.
I will use VPSID as placeholder for the ID of the virtual machine in the commands and the script. Replace VPSID with the id of the virtual machine that you want to create the script for, e.g. replace VPSID with 101.
Create the script:
and insert the following lines:
mount -n –bind -onosuid,noexec /vz/vps/VPSID/tmp /vz/root/VPSID/tmp
mount -n –bind -onosuid,noexec /vz/vps/VPSID/shm /vz/root/VPSID/dev/shm
now make the sscript executable:
chmod 700 /etc/vz/conf/VPSID.mount
Vzdump is a perl script that makes live backups of OpenVZ virtual machines very easy. The following steps are for Debian Linux but vzdump can be used on all other linux distributions. Only the installation may vary.
Download and install vzdump from http://download.openvz.org/contrib/utils/vzdump/
dpkg -i vzdump_1.1-2_all.deb
Create the backup directory
Create a backup of all virtual machines as compressed (tar.gz) archive and send a email report to the root user when finished.
vzdump –dumpdir /home/backup –suspend –compress –mailto root –all
vzdump can also be used to restore a backup. Example: restore the backup of the virtual machine 101:
vzdump –restore /home/backup/vzdump-101.tgz 101
To restore the backup to a different virtual machine, you can specify a differnt target ID. E.g. restore the backup of vm 101 to the virtual machine with the ID 500:
vzdump –restore /home/backup/vzdump-101.tgz 500