通过Vagrant进行安装需要GUI

时间:2014-01-22 07:26:44

标签: virtualization vagrant edx

更新(2014年2月5日):在没有正常关机的情况下重启机器时出现此错误

我正在尝试通过远程计算机上的开发流浪盒安装EdX的开源学习管理系统。但是,我收到与虚拟机GUI相关的错误。有没有什么可以通过CLI / ssh完成? 这是确切的错误。

The guest machine entered an invalid state while waiting for it       
to boot. Valid states are 'starting, running'. The machine is in the  
'poweroff' state. Please verify everything is configured              
properly and try again.                                               

If the provider you're using has a GUI that comes with it,            
it is often helpful to open that and watch the machine, since the     
GUI often has more helpful error messages than Vagrant can retrieve.  
For example, if you're using VirtualBox, run `vagrant up` while the   
VirtualBox GUI is open.           

以下是VagrantFile的内容


# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "precise32"
  config.vm.box_url = "http://files.vagrantup.com/precise32.box"

  config.vm.network :forwarded_port, guest: 8000, host: 9000
  config.vm.network :forwarded_port, guest: 8001, host: 9001

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  config.vm.network :private_network, ip: "192.168.20.40"

  nfs_setting = RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/
  config.vm.synced_folder ".", "/opt/edx/edx-platform", id: "vagrant-root", :nfs => nfs_setting

  # Make it so that network access from the vagrant guest is able to
  # use SSH private keys that are present on the host without copying
  # them into the VM.
  config.ssh.forward_agent = true

  config.vm.provider :virtualbox do |vb|
    # Use VBoxManage to customize the VM. For example to change memory:
    vb.customize ["modifyvm", :id, "--memory", "2048"]

    # This setting makes it so that network access from inside the vagrant guest
    # is able to resolve DNS using the hosts VPN connection.
    vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
  end

  config.vm.provision :shell, :path => "scripts/install-acceptance-req.sh"
  config.vm.provision :shell, :path => "scripts/vagrant-provisioning.sh"
end

2 个答案:

答案 0 :(得分:1)

不,在此阶段您无法使用CLI或Ssh进行/诊断,因为VM无法正常初始化并且未处于“工作”状态。

您应该遵循错误消息中包含的建议。

销毁您当前的VM:

vagrant destroy

然后打开VirtualBox GUI,并使用以下命令重新启动Vagrant设置:

vagrant up

然后,您可以在VM控制台/窗口(来自Virtualbox GUI)中观察失败的情况并阻止设置运行。

使用控制台GUI启动VM的另一种方法是修改Vagrantfile

# You will find this line in the Vagrantfile
Vagrant.configure("2") do |config|

  #Add this directive
  config.vm.provider "virtualbox" do |v|
    v.gui = true
  end


end

(使用vagrant destroy销毁现有和失败的虚拟机,然后运行vagrant up

如果远程机器(运行VirtualBox的地方)是使用SSH访问的Unix机箱,则可以在SSH连接时使用-X选项将GUI导出到本地计算机。有关ssh -X

的详细信息,请参阅this answer

答案 1 :(得分:-1)

此消息发生在我的环境中,因为有两件事:

1 - 如果您的VirtualBox软件GUI已关闭,只需将其打开即可。 Ps。:再次尝试vagrant destroy然后vagrant up

2 - 如果问题仍然存在,只需更新VirtualBox GUI即可。 VirtualBox Downloads

如果已经完成,请告诉我。