2014-12-24 73 views
15

當我運行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... 

該警告將永遠..

我已經注意到的是,如果我手動啓動虛擬機(無流浪者),將工作沒有任何延遲,但只有如果我啓用適配器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 
+0

能否請您刪除'Vagrant :: Config.run do | config |#config.vm.network:hostonly的整個部分,「192.168.50.4」 end'並重試? – BMW

+0

我試過了,但是得到了同樣的結果。 – simo

+0

既然你激活了GUI,你是否看到Virtualbox上有什麼東西存在?你的'Vagrantfile'對我來說看起來很好。我建議1)嘗試不同的圖像(例如'precise64')。 2)重新啓動你的機器。 3)清理你的虛擬環境並重試。 – BMW

回答

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 
+0

這再次發生,約5分鐘後成功。 –

+0

同樣適用於我。必須耐心等待。我問virtualbox向我展示這個虛擬機的屏幕,我看到啓動速度很慢,而且ssh服務還沒有準備好。 – mathieu

+1

似乎不是一個完整的解決方案。 – lft93ryt

0

不是真的每說一個解決方案,但我發現,當我得到這個信息〜20倍,我可以vagrant halt機器(這迫使它有一個可以沒有ssh連接超時後製造),跑vagrant up,它的工作只給了我兩次警告。

那麼...關閉它,然後再打開?如此愚蠢,但似乎工作,直到有一個實際的解決方案。

相關問題