Unable to start Vagrant VirtualBox on Ubuntu

时间:2018-02-26 17:45:51

标签: ubuntu vagrant window virtualbox

I am just trying to start some Windows vagrant VirtualBox VMs.

vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> 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: 5985 (guest) => 55985 (host) (adapter 1)
    default: 5986 (guest) => 55986 (host) (adapter 1)
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "9100d42a-152f-41c7-81f6-c3cc667240a7", "--type", "headless"]

Stderr: VBoxManage: error: The virtual machine 'MSEdgeWin10_preview17_default_1519585578822_41955' has terminated unexpectedly during startup with exit code 1 (0x1)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine

Vagrant version: Vagrant 2.0.2 VirtualBox version: 5.2.6r120293 lsb_release -a:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 17.10
Release:    17.10
Codename:   artful

vagrant box list:

IE11-win81              (virtualbox, 0)
msedge-win10-16         (virtualbox, 0)
msedge-win10-17-preview (virtualbox, 0)

Vagrantfile:

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

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://atlas.hashicorp.com/search.
  config.vm.box = "msedge-win10-17-preview"

  config.vm.boot_timeout = 500

  config.vm.communicator = "winrm"
  config.winrm.username = "IEUser"
  config.winrm.password = "Passw0rd!"

  # Disable automatic box update checking. If you disable this, then
  # boxes will only be checked for updates when the user runs
  # `vagrant box outdated`. This is not recommended.
  # config.vm.box_check_update = false

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
  # config.vm.network "forwarded_port", guest: 80, host: 8080

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

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  # config.vm.network "public_network"

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "../data", "/vagrant_data"

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
  # config.vm.provider "virtualbox" do |vb|
  #   # Display the VirtualBox GUI when booting the machine
  #   vb.gui = true
  #
  #   # Customize the amount of memory on the VM:
  #   vb.memory = "1024"
  # end
  #
  # View the documentation for the provider you are using for more
  # information on available options.

  # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
  # such as FTP and Heroku are also available. See the documentation at
  # https://docs.vagrantup.com/v2/push/atlas.html for more information.
  # config.push.define "atlas" do |push|
  #   push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
  # end

  # Enable provisioning with a shell script. Additional provisioners such as
  # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
  # documentation for more information about their specific syntax and use.
  # config.vm.provision "shell", inline: <<-SHELL
  #   apt-get update
  #   apt-get install -y apache2
  # SHELL
end

UPDATE

I added a configuration to get VirtualBox to load the GUI. Now I get this error from the GUI popup:

RTR3InitEx failed with rc=-1912 (rc=-1912)

The VirtualBox kernel modules do not match this version of VirtualBox. The installation of VirtualBox was apparently not successful. Executing

'/sbin/vboxconfig'

may correct this. Make sure that you do not mix the OSE version and the PUEL version of VirtualBox.

where: supR3HardenedMainInitRuntime what: 4 VERR_VM_DRIVER_VERSION_MISMATCH (-1912) - The installed support driver doesn't match the version of the user.

Here is the configuration I used (added to the previous configuration):

config.vm.provider 'virtualbox' do |v|
          v.gui = true
end

1 个答案:

答案 0 :(得分:1)

问题:安装了太多版本的VirtualBox。

我使用StackExchange的这些问题/答案来帮助我:

我是如何发现的:

dpkg -l '*virtualbox*' | grep ^i

然后我使用此命令删除VB的包:

sudo apt autoremove --purge virtualbox

还有其他包含VB名称的包,我删除了所有包。

然后我更新了...以防万一:

sudo apt update

然后重新安装VB。

以下是确保不再存在导致冲突的错误配置的最后步骤。

删除.vagrant目录:

rm -r .vagrant

删除VirtualBox.xml配置文件并将其替换为干净版本:

rm /home/$USER/.config/VirtualBox/VirtualBox.xml
cp /home/$USER/.config/VirtualBox/VirtualBox.xml-prev /home/$USER/.config/VirtualBox/VirtualBox.xml

从Vagrant中删除一些缓存文件:

rm /home/$USER/.vagrant.d/data/machine-index/index.lock
rm /home/$USER/.vagrant.d/data/machine-index/index

清理VB VM。

首先,您需要获取UUID:

VBoxManage list vms

e.g。

"MSEdgeWin10_preview17_default_1519845470831_93278" {060622eb-b903-4287-8ac7-fcdf9233a6b9}
"MSEdgeWin10_preview17_default_1519850217620_30972" {e2ca66bc-b64e-4fba-89e5-688c2a2a5fc3}

然后你只需用UUID删除它们:

VBoxManage unregistervm 060622eb-b903-4287-8ac7-fcdf9233a6b9
VBoxManage unregistervm e2ca66bc-b64e-4fba-89e5-688c2a2a5fc3

然后我开始流浪汉:

vagrant up

如果你想拥有更大的视图,你可能还想扩展Vagrantfile中的vram。

e.g。

config.vm.provider 'virtualbox' do |v|
    v.gui = true
    v.customize [
      "modifyvm", :id,
      "--vram", "23"
    ]
end

23是MB,这似乎是VB的推荐。