Symptoms

It is not possible to create cache of some OS templates. Debian/Ubuntu templates are mostly affected. The errors produced on cache creation can be similar to the following ones:

# vzpkg create cache debian-6.0-x86_64

...
Setting up fontconfig-config (2.4.2-1.2) ...
Out of memory!

(or)

dpkg: error processing fontconfig-config (--configure):
subprocess post-installation script returned error exit status 2

(or)

sysvinit: creating /dev/initctl
init: timeout opening/writing control channel /dev/initctl

(or)

invoke-rc.d: initscript bind9, action "start" failed. 
dpkg: error processing bind9 (--configure):^M subprocess installed post-installation script returned error exit status 1

(or)

Errors were encountered while processing:
bind9
openssh-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Error: /usr/bin/apt-get failed, exitcode=100

At the same time an error is observed in /var/log/messages:

Jun 16 00:03:55 vz kernel: [352497.506539] Fatal resource shortage: physpages, UB 10000000

Cause

The sample configuration file, which is used for a temporary container during template caching has insufficient resources to cache the OS template.

Resolution

Correct the parameter, which is not sufficient, according to the recorded error in /var/log/messages, in /etc/sysconfig/vz-scripts/vps.vzpkgtools.conf-sample.

For example:

# cp /etc/sysconfig/vz-scripts/vps.vzpkgtools.conf-sample{,.old}
# vi /etc/sysconfig/vz-scripts/vps.vzpkgtools.conf-sample
# diff -pruN /etc/sysconfig/vz-scripts/vps.vzpkgtools.conf-sample.old /etc/sysconfig/vz-scripts/vps.vzpkgtools.conf-sample
--- /etc/sysconfig/vz-scripts/vps.vzpkgtools.conf-sample.old 2013-12-27 00:26:51.355976565 +0100
+++ /etc/sysconfig/vz-scripts/vps.vzpkgtools.conf-sample 2013-12-27 00:25:41.613976578 +0100
@@ -11,6 +11,7 @@ 
LOCKEDPAGES="256:256"
PRIVVMPAGES="151552:155648"
SHMPAGES="131072:131072"
NUMPROC="240:240"
-PHYSPAGES="262144:262144"
+PHYSPAGES="1048576:1048576"
VMGUARPAGES="33792:9223372036854775807"
OOMGUARPAGES="26112:9223372036854775807"
NUMTCPSOCK="360:360"

After that, attempt to create the cache again.

Internal content