Symptoms

OS Template Cache cannot be created. During packages installation stage you can see a lot of errors like these:

/sbin/ldconfig: File /usr/lib/libformw.so.5.7 is empty, not checked.
/sbin/ldconfig: File /usr/lib/libformw.so.5 is empty, not checked.
/sbin/ldconfig: File /usr/lib/libmenu.so.5.7 is empty, not checked.
/sbin/ldconfig: File /usr/lib/libmenu.so.5 is empty, not checked.
/sbin/ldconfig: File /usr/lib/libpanelw.so.5.7 is empty, not checked.
/sbin/ldconfig: File /usr/lib/libpanel.so.5.7 is empty, not checked.
/sbin/ldconfig: File /usr/lib/libpanelw.so.5 is empty, not checked.
/sbin/ldconfig: File /usr/lib/libtic.so.5 is empty, not checked.
/sbin/ldconfig: File /usr/lib/libform.so.5 is empty, not checked.
/sbin/ldconfig: File /usr/lib/libform.so.5.7 is empty, not checked.
/sbin/ldconfig: File /usr/lib/libmenuw.so.5 is empty, not checked.

Cause

Output provided by ldconfig reports lots of empty files in template area (files that shouldn't be empty).

This means contents of /vz/template/%ostemplate%/%version%/%arch%/ are corrupted, files exist but they are zero-sized. E.g.:

# ll /vz/template/centos/6/x86_64/bash-4.1.2-3.el6.x86_64/bin
total 888
-rwxr-xr-x 1 root root      0 May 30  2011 bash
lrwxrwxrwx 1 root root      4 Sep 13  2011 sh -> bash

Resolution

vzpkg won't re-download the package if files exist, regardless of their size and validity. To force re-downloading it is necessary to remove these files completely. Please follow steps below to achieve this goal:

  1. Make sure you don't have containers based on this OS template (it might be if you faced this error upon updating cache):

    # vzlist -ao ctid,ostemplate | grep %ostemplate%
    

    E.g.

    # vzlist -ao ctid,ostemplate | grep debian-6.0-x86_64
    #
    

    NOTE: If there are containers based on this template stop performing commands from this article! Migrate containers to another host first.

  2. Remove template area for this OS Template:

    # rm -rf /vz/template/%ostemplate%/%version%/%arch%/
    

    E.g.

    # rm -rf  /vz/template/debian/6.0/x86_64/
    
  3. Install template back:

  4. Create cache:

    # vzpkg create cache %ostemplate%
    

    E.g.

    # vzpkg create cache debian-6.0-x86_64
    

Internal content