Amazon-Web-Services

使用 vagrant 和 chef 創建 aws 實例時遇到錯誤“在‘recv’中:操作超時”

  • September 15, 2015

我已經使用 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'

我想知道是否有人可以闡明可能的原因是什麼?

/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...

引用自:https://serverfault.com/questions/722340