Vagrant SSH 代理转发 + 提供程序配置 = 错误



相对流浪者和Ruby newb在这里。我正在尝试启用从我的Windows机器到我的Vagrant创建的Ubuntu VM的SSH转发。我的Vagrantfile有一些Virtualbox提供程序特定的配置:

  config.vm.provider "virtualbox" do |v|
    v.name = guestHostname
    v.memory = 8192
    v.cpus = 2
    v.customize ["modifyvm", :id, "--vram", "128"]
    v.gui = true
  end

本身工作正常。但是当我添加 SSH 转发的配置时:

  config.ssh.forward_agent = true

运行"vagrant up"开始失败,并显示以下错误消息:

Bringing machine 'development' up with 'virtualbox' provider...
==> development: Importing base box 'bento/ubuntu-16.10'...
==> development: Matching MAC address for NAT networking...
==> development: Checking if box 'bento/ubuntu-16.10' is up to date...
==> development: Setting the name of the VM: development
==> development: Clearing any previously set network interfaces...
==> development: Preparing network interfaces based on configuration...
    development: Adapter 1: nat
==> development: Forwarding ports...
    development: 22 (guest) => 2222 (host) (adapter 1)
==> development: Running 'pre-boot' VM customizations...
==> development: Booting VM...
==> development: Waiting for machine to boot. This may take a few minutes...
    development: SSH address: 127.0.0.1:2222
    development: SSH username: vagrant
    development: SSH auth method: private key
==> development: Forcing shutdown of VM...
==> development: Destroying VM and associated drives...
C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh/transport/server_version.rb:54:in `readpartial': An established connection was aborted by the software in your host machine. (Errno::ECONNABORTED)
        from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh/transport/server_version.rb:54:in `block (2 levels) in negotiate!'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh/transport/server_version.rb:52:in `loop'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh/transport/server_version.rb:52:in `block in negotiate!'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh/transport/server_version.rb:50:in `loop'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh/transport/server_version.rb:50:in `negotiate!'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh/transport/server_version.rb:32:in `initialize'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh/transport/session.rb:84:in `new'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh/transport/session.rb:84:in `initialize'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh.rb:233:in `new'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh.rb:233:in `start'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.4/plugins/communicators/ssh/communicator.rb:397:in `block (2 levels) in connect'
        from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:88:in `block in timeout'
        from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in `block in catch'
        from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in `catch'
        from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in `catch'
        from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:103:in `timeout'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.4/plugins/communicators/ssh/communicator.rb:371:in `block in connect'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/util/retryable.rb:17:in `retryable'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.4/plugins/communicators/ssh/communicator.rb:370:in `connect'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.4/plugins/communicators/ssh/communicator.rb:68:in `block in wait_for_ready'
        from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:88:in `block in timeout'
        from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in `block in catch'
        from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in `catch'
        from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in `catch'
        from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:103:in `timeout'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.4/plugins/communicators/ssh/communicator.rb:46:in `wait_for_ready'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/action/builtin/wait_for_communicator.rb:16:in `block in call'

注释掉特定于提供程序的配置会使错误消失,并且转发似乎有效。关于可能导致问题的原因的任何想法?

我可以看到您使用的是流浪者 1.9.4,这是流浪者 1.9.4 的已知问题。我在这里链接了与此问题相关的 github 问题。不过,这已在 1.9.5 版中修复。因此,您可以降级到1.9.3或升级到1.9.5

最新更新