无法在 Ubuntu 上启动 Vagrant VirtualBox [英] Unable to start Vagrant VirtualBox on Ubuntu

查看:56
本文介绍了无法在 Ubuntu 上启动 Vagrant VirtualBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想启动一些 Windows vagrant VirtualBox VM.

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 版本:Vagrant 2.0.2VirtualBox 版本:5.2.6r120293lsb_release -a:

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

流浪箱列表:

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

流浪文件:

# -*- 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

更新

我添加了一个配置来让 VirtualBox 加载 GUI.现在我从 GUI 弹出窗口收到此错误:

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

推荐答案

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

The problem: too many versions of VirtualBox installed.

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

I used these question/answer of StackExchange to help me:

我是如何发现的:

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

然后我用这个命令删除了VB的包:

Then I used this command to remove the package of VB:

sudo apt autoremove --purge virtualbox

还有其他包以 VB 命名,我都删除了.

There was other packages with VB name, I deleted all of them.

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

Then I updated... Just in case:

sudo apt update

然后重新安装VB.

以下是确保不会再有过去的错误配置导致冲突的最后步骤.

Here are the last steps to make sure that there is no more past misconfiguration causing conflicts.

删除 .vagrant 目录:

Remove the .vagrant directory:

rm -r .vagrant

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

Remove the VirtualBox.xml configuration file and replace it with a clean version:

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

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

Remove some caching files from Vagrant:

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

清理 VB 虚拟机.

首先您需要获取 UUID:

First you need to get the UUIDs:

VBoxManage list vms

例如

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

然后您只需使用 UUID 删除它们:

Then you just remove them with the UUIDs:

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

然后我开始流浪:

vagrant up

如果您想拥有更大的视野,您可能还想扩展 Vagrantfile 中的 vram.

You might also want to extend the vram in your Vagrantfile if you want to have a bigger view.

例如

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

23 以 MB 为单位,这似乎是 VB 推荐的.

23 is in MB and it is what VB seems to recommend.

这篇关于无法在 Ubuntu 上启动 Vagrant VirtualBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆