默认值:警告:远程连接断开连接。重试

时间:2014-12-24 18:33:45

标签: vagrant virtualbox

当我运行vagrant up时,我得到:

D:\GitHub\website\rails-dev-box>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty32' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 3000 => 1234 (adapter 1)
    default: 22 => 2222 (adapter 1)
==> 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: Connection timeout. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...

这个警告将永远......

我注意到的是,如果我手动启动VM(没有流浪汉),它将毫无延迟地工作,但仅限于如果我在VM设置中启用了适配器2,如下所示:enter image description here 使用vagrant up时如何启用VM的适配器2?

修改

Vagrantfile是:

# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
#     config.vm.network :hostonly, "192.168.50.4"
end



Vagrant.configure('2') do |config|

  config.vm.box      = 'ubuntu/trusty32'
  config.vm.hostname = 'rails-dev-box'
# config.vm.synced_folder ".", "/vagrant/web" #, type: "nfs"

config.vm.provider :virtualbox do |vb|
  vb.gui = true
end

 config.vm.boot_timeout = 120

 #  config.winnfsd.uid = 1
   # config.winnfsd.gid = 1

  config.vm.network :forwarded_port, guest: 3000, host: 1234

  config.vm.provision :shell, path: 'bootstrap.sh', keep_color: true
end

2 个答案:

答案 0 :(得分:18)

对我而言,结果是耐心才是答案 我收到了消息(我得到了12次)但是我等了几分钟然后它成功了。 当你说"这个警告永远都是......"你等了多久?

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'phusion/ubuntu-14.04-amd64' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
    default: Adapter 3: hostonly
    default: Adapter 4: hostonly
==> default: Forwarding ports...
    default: 3000 => 3334 (adapter 1)
    default: 1080 => 1082 (adapter 1)
    default: 22 => 2222 (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: Connection timeout. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Exporting NFS shared folders...
==> default: Preparing to edit /etc/exports. Administrator privileges will be required...
Password:
==> default: Mounting NFS shared folders...
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: to force provisioning. Provisioners marked to run always will still run.
==> default: Running provisioner: shell...
    default: Running: inline script
==> default: stdin: is not a tty
==> default: stop: Unknown instance:
==> default: mongod start/running, process 8424

答案 1 :(得分:0)

不是真正的解决方案,但是我发现当我在获得该消息后超时时〜我可以vagrant halt机器的20倍(由于没有可以连接的ssh连接而强制它跑了vagrant up,它只给我两次警告。

所以......把它关掉再打开?如此愚蠢,但似乎确实有效,直到有一个实际的解决方案。