Symptoms

It is not possible to create the OS template cache of Debian 5. The error 404 Not Found is reported:

    [root@pvc01 ~]# vzpkg create cache debian-5.0-x86_64
    Creation OS template cache for debian-5.0-x86_64 template
    ...
    Err http://ftp.de.debian.org lenny/main i386 Packages
      404  Not Found
    Err http://ftp.de.debian.org lenny/contrib i386 Packages
      404  Not Found
    Err http://ftp.de.debian.org lenny/non-free i386 Packages
      404  Not Found
    ...
    W: Failed to fetch http://ftp.de.debian.org/debian/dists/lenny/main/binary-i386/Packages  404  Not Found
    W: Failed to fetch http://ftp.de.debian.org/debian/dists/lenny/contrib/binary-i386/Packages  404  Not Found
    W: Failed to fetch http://ftp.de.debian.org/debian/dists/lenny/non-free/binary-i386/Packages  404  Not Found
    ...
    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

By default, there is only one server defined for Debian packages to be used by Virtuozzo package management tools for fetching OS packages:

    [root@pvc01 ~]# grep DEB /etc/vztt/url.map
    $DEB_SERVER     http://ftp.de.debian.org

This server stores the current and previous stable releases only, since these OS versions are officially supported. However, packages for older OS versions are not kept on the main server because those releases have reached End-of-Life.

Resolution

In order to create the OS template cache for Debian 5 or any previous version, it is necessary to specify the proper server to fetch packages from and update the list of repositories of the affected EZ OS template. In the example below, the EZ OS template is debian-5.0-x86_64 - Debian 5.0 64-bit.

  1. Define the additional variable DEB_ARCHIVE in the file /etc/vztt/url.map that would point to the archive server.

    [root@pvc09 ~]# grep DEB /etc/vztt/url.map
    $DEB_SERVER     ftp://ftp.de.debian.org
    $DEB_ARCHIVE    http://archive.debian.org
    
  2. Edit the list of repositories in the EZ OS template configuration file (for Debian 5.0 64-bit, the file is /vz/template/debian/5.0/x86_64/config/os/default/repositories), so finally it looks like:

    [root@pvc01 ~]# cat /vz/template/debian/5.0/x86_64/config/os/default/repositories
    $DEB_ARCHIVE/debian lenny main contrib non-free
    $DEB_ARCHIVE/debian-volatile lenny/volatile main contrib non-free
    $DEB_ARCHIVE/debian-security lenny/updates main contrib non-free
    
  3. Clean the information about the information from repositories:

    [root@pvc01 ~]# vzpkg clean debian-5.0-x86_64
    
  4. Create the OS template cache for Debian 5.0 x64:

    [root@pvc01 ~]# vzpkg create cache debian-5.0-x86_64
    

The similar operations are needed for other Debian releases which are not officially supported by Debian community anymore.

Note: For Debian 4.0, there is one known issue with creating the OS template cache due to the issue with a package name, described in this article: Impossible to create Debian 4.0 OS template cache on PVCfL 4.7.

Internal content