1

I am trying to test a Chef cookbook using knife solo and vagrant.

Using the information provided by vagrant ssh-config, I can connect to my vagrant host as follows:

ssh -p 3774 -i /path/to/.vagrant/machines/default/virtualbox/private_key vagrant@localhost

I am calling knife solo with:

knife solo prepare -p 3774 -i /path/to/.vagrant/machines/default/virtualbox/private_key vagrant@localhost -VV

Which raises the exception:

ERROR: Net::SSH::ConnectionTimeout: Net::SSH::ConnectionTimeout

Stack trace:

Bootstrapping Chef...
/usr/local/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/session.rb:90:in `rescue in initialize': Net::SSH::ConnectionTimeout (Net::SSH::ConnectionTimeout)
    from /usr/local/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/session.rb:57:in `initialize'
    from /usr/local/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh.rb:232:in `new'
    from /usr/local/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh.rb:232:in `start'
    from /usr/local/lib/ruby/gems/2.4.0/gems/knife-solo-0.6.0/lib/knife-solo/ssh_connection.rb:42:in `session'
    from /usr/local/lib/ruby/gems/2.4.0/gems/knife-solo-0.6.0/lib/knife-solo/ssh_command.rb:153:in `try_connection'
    from /usr/local/lib/ruby/gems/2.4.0/gems/knife-solo-0.6.0/lib/knife-solo/ssh_command.rb:194:in `detect_authentication_method'
    from /usr/local/lib/ruby/gems/2.4.0/gems/knife-solo-0.6.0/lib/knife-solo/ssh_command.rb:290:in `run_command'
    from /usr/local/lib/ruby/gems/2.4.0/gems/knife-solo-0.6.0/lib/chef/knife/solo_prepare.rb:71:in `operating_system'
    from /usr/local/lib/ruby/gems/2.4.0/gems/knife-solo-0.6.0/lib/chef/knife/solo_prepare.rb:67:in `bootstrap'
    from /usr/local/lib/ruby/gems/2.4.0/gems/knife-solo-0.6.0/lib/chef/knife/solo_prepare.rb:57:in `run'
    from /usr/local/lib/ruby/gems/2.4.0/gems/chef-13.2.20/lib/chef/knife.rb:442:in `block in run_with_pretty_exceptions'
    from /usr/local/lib/ruby/gems/2.4.0/gems/chef-13.2.20/lib/chef/local_mode.rb:44:in `with_server_connectivity'
    from /usr/local/lib/ruby/gems/2.4.0/gems/chef-13.2.20/lib/chef/knife.rb:441:in `run_with_pretty_exceptions'
    from /usr/local/lib/ruby/gems/2.4.0/gems/chef-13.2.20/lib/chef/knife.rb:219:in `run'
    from /usr/local/lib/ruby/gems/2.4.0/gems/chef-13.2.20/lib/chef/application/knife.rb:156:in `run'
    from /usr/local/lib/ruby/gems/2.4.0/gems/chef-13.2.20/bin/knife:25:in `<top (required)>'
    from /usr/local/bin/knife:22:in `load'
    from /usr/local/bin/knife:22:in `<main>'

Not sure what could possibly be causing knife solo to fail. I have also tried specifying the -P vagrant password instead of the identity file, to the same effect.

How can I connect knife solo to a local host?

Thanks for you help!

James Taylor
  • 6,158
  • 8
  • 48
  • 74
  • if you have the chefdk installed, try to isolate the ssh issue using: `knife ssh localhost --ssh-port 3774 'sudo chef-client' --manual-list --ssh-user vagrant --identity-file /path/to/.vagrant/machines/default/virtualbox/private_key` ... It may not run the `chef-client` process (if the node have not been bootstrapped), but should let u know if the ssh connection is okay or not – OK999 Aug 21 '17 at 05:04
  • I've had this same problem for more than a year and it has ended my usage of Chef. FWIW I spun up a couple VBoxes to see if anything has improved and it hasn't. In addition, the `knife ssh` connection works without issue. – Mark Dec 01 '17 at 00:17

0 Answers0