使用 vagrant 和 chef 创建 aws 实例时遇到错误“in `recv': Operation timed out”

使用 vagrant 和 chef 创建 aws 实例时遇到错误“in `recv': Operation timed out”

我已经使用 vagrantfile 创建了一个 Virtualbox 实例,并且没有任何问题。

但是,当我添加开关时,--provider aws我收到以下错误消息:

==> server-1: Loading Berkshelf datafile...
==> server-1: Sharing cookbooks with VM
==> server-1: Terminating the instance...
==> server-1: Running cleanup tasks for 'chef_zero' provisioner...
/opt/vagrant/embedded/gems/gems/net-ssh-2.9.2/lib/net/ssh/buffered_io.rb:65:in `recv': Operation timed out - recvfrom(2) (Errno::ETIMEDOUT)
    from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.2/lib/net/ssh/buffered_io.rb:65:in `fill'
    from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:237:in `block in postprocess'
    from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:233:in `each'
    from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:233:in `postprocess'
    from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:212:in `process'
    from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:170:in `block in loop'
    from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:170:in `loop'
    from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:170:in `loop'
    from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.2/lib/net/ssh/connection/channel.rb:269:in `wait'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/communicators/ssh/communicator.rb:589:in `shell_execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/communicators/ssh/communicator.rb:215:in `block in execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/communicators/ssh/communicator.rb:312:in `connect'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/communicators/ssh/communicator.rb:209:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/communicators/ssh/communicator.rb:246:in `sudo'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/provisioners/chef/provisioner/chef_zero.rb:76:in `block in run_chef_zero'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/provisioners/chef/provisioner/chef_zero.rb:68:in `times'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/provisioners/chef/provisioner/chef_zero.rb:68:in `run_chef_zero'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/provisioners/chef/provisioner/chef_zero.rb:38:in `provision'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/builtin/provision.rb:133:in `run_provisioner'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:95:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/environment.rb:428:in `hook'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/builtin/provision.rb:121:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/builtin/provision.rb:121:in `block in call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/builtin/provision.rb:103:in `each'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/builtin/provision.rb:103:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/antkong/.vagrant.d/gems/gems/vagrant-cachier-1.2.1/lib/vagrant-cachier/action/configure_bucket_root.rb:20:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/antkong/.vagrant.d/gems/gems/vagrant-berkshelf-4.0.4/lib/vagrant-berkshelf/action/upload.rb:23:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/antkong/.vagrant.d/gems/gems/vagrant-berkshelf-4.0.4/lib/vagrant-berkshelf/action/install.rb:19:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/antkong/.vagrant.d/gems/gems/vagrant-berkshelf-4.0.4/lib/vagrant-berkshelf/action/save.rb:21:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/antkong/.vagrant.d/gems/gems/vagrant-aws-0.6.0/lib/vagrant-aws/action/connect_aws.rb:43:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/antkong/.vagrant.d/gems/gems/vagrant-berkshelf-4.0.4/lib/vagrant-berkshelf/action/share.rb:28:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/antkong/.vagrant.d/gems/gems/vagrant-berkshelf-4.0.4/lib/vagrant-berkshelf/action/load.rb:30:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/builtin/env_set.rb:19:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/antkong/.vagrant.d/gems/gems/vagrant-berkshelf-4.0.4/lib/vagrant-berkshelf/action/check.rb:18:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/machine.rb:214:in `action_raw'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/machine.rb:191:in `block in action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/environment.rb:516:in `lock'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/machine.rb:178:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/machine.rb:178:in `action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'

我想知道是否有人可以解释一下可能的原因是什么?

答案1

/opt/vagrant/embedded/gems/gems/net-ssh-2.9.2/lib/net/ssh/buffered_io.rb:65:in `recv': Operation timed out - recvfrom(2) (Errno::ETIMEDOUT)

嗯,从那以后,似乎无法通过 ssh 成功连接到 EC2 实例。

...这是有道理的,因为它已经终止了实例。参见上面的第二行:

==> server-1: Terminating the instance...

相关内容