Vagrant: Solución a “connection timeout…” en box privados

Standard

¡Hola!

El día de hoy les vengo a compartir la solución o consejo para prevenir un error muy recurrente cuando se trabaja con “boxes” privados en Vagrant.

default: Warning: Authentication failure. Retrying…

 

Para reproducir el error basta con descargar e instalar un box privado (previamente habiendote logueado con vagrant login).

$ vagrant init <usuariohashicorp>/<nombredelbox>;
$ vagrant up --provider virtualbox

Al ejecutar el comando vagrant up éste falla debido a un problema con la autenticación del ssh.

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'karengonzalez/hnb-ruby'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'karengonzalez/hnb-ruby' is up to date...
==> default: Setting the name of the VM: vagrant_ruby_default_1444085189336_82764
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

Esto es debido al parecer a un issue de vagrant que se dá al empaquetar los boxes, no necesariamente los privados.

La clave está en realizar unos pequeños ajustes en el Vagrantfile. Sólamente agregamos dos líneas al Vagrantfile.

config.ssh.username = "vagrant"
config.ssh.password = "vagrant"

“config.ssh.username” define el usuario al que vagrant accederá por SSH por default.
“config.ssh.password” define la contraseña que vagrant usarará para autenticar al usuario SSH.

Screen Shot 2015-10-05 at 5.11.09 PM

Después de realizar esas modificaciones intenta de nuevo ejecutar el comando vagrant up y tus problemas se habrán resuelto.

La prueba con el box funcionando:

Screen Shot 2015-10-05 at 5.18.11 PM

Es todo por hoy, si arreglaste tu problema viendo este post pon una carita feliz en los comentarios.

One thought on “Vagrant: Solución a “connection timeout…” en box privados

Leave a Reply

Your email address will not be published. Required fields are marked *