Unable to start Vagrant VirtualBox on Ubuntu

0

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
ubuntu
vagrant
window
virtualbox
asked on Stack Overflow Feb 26, 2018 by jnbdz • edited Aug 31, 2018 by jnbdz

1 Answer

1

The problem: too many versions of VirtualBox installed.

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

How I found out:

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

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

sudo apt autoremove --purge virtualbox

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

Then I updated... Just in case:

sudo apt update

Then just re-installed VB.

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

Remove the .vagrant directory:

rm -r .vagrant

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

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

Clean up the VB VMs.

First you need to get the UUIDs:

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}

Then you just remove them with the UUIDs:

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

Then I started vagrant:

vagrant up

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

e.g.

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

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

answered on Stack Overflow Feb 28, 2018 by jnbdz • edited Feb 28, 2018 by jnbdz

User contributions licensed under CC BY-SA 3.0