1

除非我在主路径上,否则 Vagrant 不会启动。

[ruby-1.9.3-p286] ~ cat Vagrantfile 
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant::Config.run do |config|
  config.vm.box = "precise32"
end
[ruby-1.9.3-p286] ~ vagrant up
[default] Importing base box 'precise32'...
[default] The guest additions on this VM do not match the install version of
VirtualBox! This may cause things such as forwarded ports, shared
folders, and more to not work properly. If any of those things fail on
this machine, please update the guest additions and repackage the
box.

Guest Additions Version: 4.2.0
VirtualBox Version: 4.1.12
[default] Matching MAC address for NAT networking...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Mounting shared folders...
[default] -- v-root: /vagrant
[ruby-1.9.3-p286] ~ vagrant destroy
Are you sure you want to destroy the 'default' VM? [Y/N] Y
[default] Forcing shutdown of VM...
[default] Destroying VM and associated drives...
[ruby-1.9.3-p286] ~ 

vagrant up当我从我的家庭路径运行时,它成功启动。但是当我vagrant up从另一个子目录运行时,它不会启动。这有点奇怪,因为我使用的 Vagrantfile 完全相同。

[ruby-1.9.3-p286] ~ 
[ruby-1.9.3-p286] ~ cd dev_vm 
[ruby-1.9.3-p286] ~/dev_vm cat Vagrantfile 
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant::Config.run do |config|
  config.vm.box = "precise32"
end
[ruby-1.9.3-p286] ~/dev_vm vagrant up
[default] VM already created. Booting if it's not already running...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
The VM failed to remain in the "running" state while attempting to boot.
This is normally caused by a misconfiguration or host system incompatibilities.
Please open the VirtualBox GUI and attempt to boot the virtual machine
manually to get a more informative error message.
[ruby-1.9.3-p286] ~/dev_vm 
[ruby-1.9.3-p286] ~/dev_vm 

我什至尝试从 Virtualbox UI 手动启动它,但我只看到一个空白屏幕。我可能认为我错过了一些东西。

4

2 回答 2

3

export VAGRANT_LOG=debug,这向我展示了一条消息,让我尝试vagrant destroyvagrant up。然后我的虚拟机正确启动。理解可能是什么问题仍然很奇怪。

于 2012-11-19T18:27:58.600 回答
2

我还想补充一点,您会收到此错误

等待虚拟机启动。这可能需要几分钟。尝试启动时,VM 未能保持在“运行”状态。这通常是由错误配置或主机系统不兼容引起的。请打开 VirtualBox GUI 并尝试手动启动虚拟机以获取更多信息的错误消息。

运行 vagrant 时,如果您在 64 位处理器上安装了 i386 版本的 virualbox。因此,请确保您为主机安装了正确的虚拟化软件。

于 2013-05-30T21:05:49.513 回答