Symptoms

Is is not possible to install some package into the container using "vzpkg". Similar error message can is observed:

# vzpkg install 101 -p yum
Loaded plugins: rpm2vzrpm
0 metadata files removed
0 sqlite files removed
0 metadata files removed
Loaded plugins: rpm2vzrpm
http://mirror.centos.org/centos/5/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout: <urlopen error timed out>
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base0. Please verify its path and try again
Error: /usr/share/vzyum/bin/yum failed, exitcode=1

Cause

There are network problems/misconfiguration on the node or in the infrastructure. The repository configured for the container's OS template cannot be reached.

Resolution

Investigate and resolve network issues on the node.

In case some alternative repository can be reached, you can reconfigure the OS tempate settings, for example:

  1. Find out which repositories/mirrorlist is configured for the container's OS tempalate:

    # vzpkg list -O 11154
    centos-5-x86_64                    2013-09-23 11:19:50
    
    # vzpkg info centos-5-x86_64 | egrep 'mirror|repo'
    repositories:
            http://mirror.centos.org/centos/5/os/x86_64/
            http://mirror.centos.org/centos/5/updates/x86_64/
    mirrorlist:
            http://vzdownload.swsoft.com/download/mirrors/centos-5
            http://vzdownload.swsoft.com/download/mirrors/updates-released-ce5
            http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=os
            http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=updates
    
  2. Confirm that you can reach some other suitable repository:

    Configured repository:

    # wget --spider -SO- http://mirror.centos.org/centos/5/os/x86_64/repodata/repomd.xml
    --16:06:11--  http://mirror.centos.org/centos/5/os/x86_64/repodata/repomd.xml
    Resolving mirror.centos.org... 66.147.238.146
    Connecting to mirror.centos.org|66.147.238.146|:80... failed: Connection timed out.
    Retrying.
    
    --16:09:21--  (try: 2)  http://mirror.centos.org/centos/5/os/x86_64/repodata/repomd.xml
    Connecting to mirror.centos.org|66.147.238.146|:80...
    

    Alternative repository:

    # wget --spider -SO- http://vault.centos.org/5.8/os/x86_64/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm
    --16:26:05--  http://vault.centos.org/5.8/os/x86_64/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm
    Resolving vault.centos.org... 160.10.26.25
    Connecting to vault.centos.org|160.10.26.25|:80... connected.
    HTTP request sent, awaiting response...
      HTTP/1.1 200 OK
      Date: Tue, 04 Nov 2014 10:26:05 GMT
      Server: Apache/2.2.15 (CentOS)
      Last-Modified: Thu, 23 Feb 2012 10:19:09 GMT
      ETag: "15e0bf8-fca96-4b99ef9842140"
      Accept-Ranges: bytes
      Content-Length: 1034902
      Connection: close
      Content-Type: application/x-rpm
    Length: 1034902 (1011K) [application/x-rpm]
    200 OK
    
  3. Find out the configuration folder for template:

    # vzpkg info centos-5-x86_64 | grep -A1 config_path
    config_path:
        /vz/template/centos/5/x86_64/config/os/default
    
  4. Rename "mirrorlist" file if it is present in the config folder:

    # ls -l /vz/template/centos/5/x86_64/config/os/default/mirrorlist
    -rw-r--r-- 1 root root 211 Aug 14  2012 /vz/template/centos/5/x86_64/config/os/default/mirrorlist
    # mv /vz/template/centos/5/x86_64/config/os/default/mirrorlist{,_orig}
    
  5. Change the "repositories" file in the config folder ("/vz/template/centos/5/x86_64/config/os/default/repositories") to contain only reachable repositories
  6. Update the template metadata:

    # vzpkg update metadata centos-5-x86_64 -r
    
  7. Run the intended "vzpkg" operation again

Internal content