Symptoms

OS template cache creation fails with a similar error message:

# vzpkg create cache debian-7.0-x86_64
Creation OS template cache for debian-7.0-x86_64 template
...
W: Failed to fetch http://1.2.3.4/debian/dists/wheezy/historical/i18n/Translation-en  Unable to connect to 1.2.3.4:http:
E: Some index files failed to download. They have been ignored, or old ones used instead.
Error: /usr/bin/apt-get failed, exitcode=100

Cause

Unavailable repository is configured for the template, e.g:

# cat /vz/template/debian/7.0/x86_64/config/os/default/repositories
$DEB_SERVER/debian wheezy main contrib non-free
$DEB_SERVER/debian-security wheezy/updates main contrib non-free
http://1.2.3.4/debian wheezy historical

In the example above "http://1.2.3.4" is a custom repository, which is not available.

"$DEB_SERVER" variable is defined in "/etc/vztt/url.map" file and by default is equal to:

 # grep DEB_SERVER  /etc/vztt/url.map
 $DEB_SERVER     ftp://ftp.de.debian.org

Resolution

  1. Delete the unavailable repositories from the configured list (e.g "/vz/template/debian/7.0/x86_64/config/os/default/repositories");

  2. Check that "$DEB_SERVER" is leading to an existing and available Debian repository.

  3. Update the template's metadata before another attempt on cache creation : "# vzpkg update metadata debian-7.0-x86_64 -r"

Additinal articles:

Cannot create/update OS template cache: 404 Not found

Internal content