Vagrant problem: timeout when connecting by SSH

Asked

Viewed 2,586 times

2

I’m trying to climb up to my box in Vagrant. When I give one vagrant up it performs everything correctly, but when connecting with ssh, keeps giving timeout.

Follow the stacktrace in the powershell:

PS C:\projetos_vagrant> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'hellobits'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: projetos_vagrant_default_1438439495619_27166
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 3000 => 3000 (adapter 1)
    default: 9292 => 9292 (adapter 1)
    default: 4567 => 4567 (adapter 1)
    default: 1080 => 1080 (adapter 1)
    default: 8888 => 8888 (adapter 1)
    default: 3306 => 3306 (adapter 1)
    default: 1234 => 1234 (adapter 1)
    default: 5432 => 5432 (adapter 1)
    default: 6379 => 6379 (adapter 1)
    default: 9200 => 9200 (adapter 1)
    default: 27017 => 27017 (adapter 1)
    default: 80 => 8080 (adapter 1)
    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: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. 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.
PS C:\projetos_vagrant>

Follow also my own Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "hellobits"
  config.vm.box_url = "http://files.hellobits.com/vagrant/hellobits-trusty64-virtualbox.box"

  config.ssh.insert_key = false

  config.vm.network :forwarded_port, guest: 3000, host: 3000    # rails
  config.vm.network :forwarded_port, guest: 9292, host: 9292    # rack
  config.vm.network :forwarded_port, guest: 4567, host: 4567    # sinatra
  config.vm.network :forwarded_port, guest: 1080, host: 1080    # mailcatcher
  config.vm.network :forwarded_port, guest: 8888, host: 8888    # jasmine
  config.vm.network :forwarded_port, guest: 3306, host: 3306    # mysql
  config.vm.network :forwarded_port, guest: 1234, host: 1234    # node
  config.vm.network :forwarded_port, guest: 5432, host: 5432    # postgresql
  config.vm.network :forwarded_port, guest: 6379, host: 6379    # redis
  config.vm.network :forwarded_port, guest: 9200, host: 9200    # elasticsearch
  config.vm.network :forwarded_port, guest: 27017, host: 27017  # mongodb
  config.vm.network :forwarded_port, guest: 80, host: 8080      # apache/nginx
end

Someone could give me a light?

  • This is a VM that you created from scratch and then converted to a Box or that you downloaded from Atlas and just customised?

1 answer

1

Your machine may be waiting for some confirmation on the keyboard. You can do two things:

A) Checking by GUI - Add this stretch to your Vagrantfile:

config.vm.provider :virtualbox do |vb|
  vb.gui = true
end

B) Sending command via Vbox

First, see which is the machine ID:

vboxmanage list runningvms

With the collected ID, for example, projects_1234567890, run:

vboxmanage controlvm projects_1234567890 keyboardputscancode 1c

Browser other questions tagged

You are not signed in. Login or sign up in order to post.