lxc-create se bloquea y finalmente falla

lxc-create se bloquea y finalmente falla

Estaba intentando colocar algunos encantos juju en contenedores de Linux y los contenedores no pudieron iniciarse. Para depurar el problema, ingresé al nodo donde sucedió esto e intenté crear un contenedor LXC manualmente como

ubuntu@slot13:~$ sudo lxc-create -t ubuntu -n pavan
Checking cache download in /var/cache/lxc/trusty/rootfs-amd64 ...
Installing packages in template: ssh,vim,language-pack-en
Downloading ubuntu trusty minimal ...
I: Retrieving Release

No avanza en absoluto. Está atrapado aquí durante mucho tiempo. Después de mucho tiempo dice:

ERROR: Unable to fetch GPG key from keyserver

y sigue colgado. Finalmente, después de 20-30 minutos, se rinde como

E: Failed getting release file http://archive.ubuntu.com/ubuntu/dists/trusty/Release

¿Dónde están los archivos de registro correspondientes al lxc-createcomando? ¿Cómo puedo depurar este problema?

EDITAR: Descubrí cómo ver los registros de depuración y, por lo tanto, ejecuté el siguiente comando varias veces

sudo lxc-create -t ubuntu -n pavan --logfile=test.txt --logpriority=DEBUG

test.txtcontiene solo esto

lxc-create 1414897265.204 ERROR    lxc_container - Error: pavan creation was not completed
lxc-create 1414897407.757 ERROR    lxc_container - Error: pavan creation was not completed
lxc-create 1414897407.759 WARN     lxc_log - lxc_log_init called with log already initialized

Pero aún así se bloquea y los registros de depuración no ofrecen mucha ayuda.

Respuesta1

Agregue --no-validateuna bandera para omitir la validación de gpg:

lxc-create -t ubuntu -n pavan -- --no-validate

Referirsehttps://github.com/lxc/lxc/blob/master/templates/lxc-download.in#L240

Respuesta2

¿Estás detrás de un proxy? En caso afirmativo, puede configurar su proxy en bash. Problema siguiente,

export http_proxy="http://<proxy_host>:<port>"

Respuesta3

En realidad, juju usa la plantilla 'ubuntu-cloud' para capturar una imagen, el comando ejecutado para crear la plantilla en mi sistema que ejecuta Trusty es:

lxc-create -n juju-trusty-lxc-template \
  -t ubuntu-cloud \
  -f /var/lib/juju/containers/juju-trusty-lxc-template/lxc.conf \
  -- --debug \
  --userdata /var/lib/juju/containers/juju-trusty-lxc-template/cloud-init \
  --hostid juju-trusty-lxc-template
  -r trusty

Te sugiero que ejecutes algo así y veas qué error te da.

Respuesta4

Problema

Si está detrás de un firewall que restringe el acceso a Internet, podría recibir este error:

$ lxc-create -t download -n my-container
Setting up the GPG keyring
ERROR: Unable to fetch GPG key from keyserver.
lxc-create: lxccontainer.c: create_run_template: 1297 container
  creation template for my-container failed
lxc-create: tools/lxc_create.c: main: 318 Error creating
  container my-container

Arreglar

Conéctese al servidor de claves a través del puerto 80:

$ lxc-create -t download -n my-container \
  -- --keyserver hkp://p80.pool.sks-keyservers.net:80

Detalles

El servidor de claves, hkp://p80.pool.sks-keyservers.net:80proviene del lxccódigo fuente:

apt source lxc
grep -ri hkp: .

Referencias

información relacionada