【问题标题】:default: Warning: Remote connection disconnect. Retrying默认值:警告:远程连接断开。重试
【发布时间】:2014-12-24 18:33:44
【问题描述】:

当我运行 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...

这个警告将永远存在..

我注意到的是,如果我手动启动虚拟机(没有 vagrant),它将不会有任何延迟,但前提是我在虚拟机设置中启用了适配器 2,如下所示: 使用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

【问题讨论】:

  • 能否请您删除整个Vagrant::Config.run do |config|# config.vm.network :hostonly, "192.168.50.4" end 并重试?
  • 我试过了,但我得到了同样的结果..
  • 自从你激活了GUI,你看到Virtualbox有什么东西吗?你的Vagrantfile 对我来说很好。我建议 1) 尝试使用不同的图像(例如,precise64)。 2)重启你的机器。 3)清理你的virtualbox环境并重试。

标签: vagrant virtualbox


【解决方案1】:

对我来说,耐心就是答案。
我收到了消息(我收到了 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

【讨论】:

  • 再次出现这种情况,大约 5 分钟后成功。
  • 对我来说也一样。不得不耐心。我让virtualbox给我看这个vm的屏幕,我看到启动很慢,ssh服务还没有准备好。
  • 似乎不是一个完整的解决方案。
【解决方案2】:

不是一个真正的解决方案,但我发现当我在收到该消息后超时约 20 次时,我可以 vagrant halt 机器(这会强制它,因为没有可以建立的 ssh 连接) ,运行vagrant up,它只给了我两次警告。

所以...关闭再打开?如此愚蠢,但在有实际解决方案之前似乎确实有效。

【讨论】:

    猜你喜欢
    • 2015-10-13
    • 2020-11-12
    • 2017-10-08
    • 1970-01-01
    • 2014-08-26
    • 2018-10-24
    • 2014-11-21
    • 1970-01-01
    • 2016-02-04
    相关资源
    最近更新 更多