【发布时间】: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