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

时间:2012-11-17 02:23:40

标签: ruby virtualbox vagrant

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手动启动它,但我只看到一个空白屏幕。我可能认为我错过了一些东西。

2 个答案:

答案 0 :(得分:3)

export VAGRANT_LOG=debug,这向我展示了试用vagrant destroyvagrant up的消息。然后我的VM正常启动。理解可能是什么问题仍然很奇怪。

答案 1 :(得分:2)

我还想补充一点,你会收到这个错误

  

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

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