Vagrant up times out, but vagrant ssh works (just takes 40 seconds to)

167 views
Skip to first unread message

nemonik

unread,
Apr 8, 2016, 4:38:29 PM4/8/16
to Vagrant
I'm on OS X 10.11.4 using VirtualBox 5.0.16 r105871, and Vagrant  1.8.1.

I'm getting a timeout with `vagrant up` like so, but...


Bringing machine 'default' up with 'virtualbox' provider...


<snip>


==> default: Auto-generating node name for Chef...

==> default: Clearing any previously set network interfaces...

==> default: Preparing network interfaces based on configuration...

    default: Adapter 1: nat

==> default: Forwarding ports...

    default: 80 (guest) => 8081 (host) (adapter 1)

    default: 4242 (guest) => 4242 (host) (adapter 1)

    default: 22 (guest) => 2222 (host) (adapter 1)

==> default: Running 'pre-boot' VM customizations...

==> 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: Remote connection disconnect. Retrying...

    default: 

    default: Vagrant insecure key detected. Vagrant will automatically replace

    default: this with a newly generated keypair for better security.

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.


So the Vagrant in VirtualBox is still running, so I try


vagrant ssh


The prompt sits there for 40 seconds and then I'm in.  I timed it using the stopwatch Google surfaces for "timer".  The fact it takes 40 consistent seconds has me wondering if this is the problem. 


It takes the same time for 


sh vag...@127.0.0.1 -p 2222 -i /Users/nemonik/.vagrant.d/insecure_private_key  


I built the CentOS 7 Vagrant box via Packer, and imported it... My Vagrantfile looks like so:


Vagrant.configure(2) do |config|


  config.vm.provider "virtualbox" do |vb|

    vb.memory = "1024"

    vb.cpus = "1"

  end


config.vm.provider :virtualbox do |vb|

  vb.gui = true

end


  if Vagrant.has_plugin?("vagrant-cachier")

    config.cache.scope = :box

    config.cache.auto_detect = true

  end


  config.vm.network "forwarded_port", guest: 80, host: 8081, protocol: "tcp", host_ip: '127.0.0.1'

  config.vm.network "forwarded_port", guest: 4242, host: 4242, protocol: "tcp", host_ip: '127.0.0.1'


  config.vm.box="nemonik/centos-7-2-1511"


  config.berkshelf.berksfile_path = "cookbook/Berksfile"

  config.berkshelf.enabled = true

  config.vm.synced_folder "cookbook/files/default", "/vagrant"


  config.vm.provision "chef_zero" do |chef|

    chef.cookbooks_path = "./cookbook"

    chef.add_recipe "nemonik"

    chef.nodes_path = "/tmp"

    chef.log_level = :info

  end

end


I've been pounding on this small part of open-source project all flipping day, and would appreciate the help.



-Michael


nemonik

unread,
Apr 8, 2016, 4:56:06 PM4/8/16
to Vagrant
http://superuser.com/questions/776007/login-process-very-slow-over-ssh-to-vagrant-guest

Switching "UseDNS" to "no" in the  /etc/ssh/sshd_config seems to have resolved the problem.

-Michael
Reply all
Reply to author
Forward
0 new messages