0

I have an Ubuntu 17.04 machine that has both VirtualBox and libvirt/kvm-qemu installed.

Whenever I try to bring up a Vagrant box with the VirtualBox prodiver, I get this error:

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/xenial64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/xenial64' is up to date...
==> default: A newer version of the box 'ubuntu/xenial64' is available! You currently
==> default: have version '20170626.0.0'. The latest is version '20170717.0.0'. Run
==> default: `vagrant box update` to update.
==> default: Setting the name of the VM: mainframe_default_1500383484218_22222
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> 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", "ab19fdfd-349e-40d0-b540-aa130b9e1b72", "--type", "headless"]

Stderr: VBoxManage: error: VT-x is being used by another hypervisor (VERR_VMX_IN_VMX_ROOT_MODE).
VBoxManage: error: VirtualBox can't operate in VMX root mode. Please disable the KVM kernel extension, recompile your kernel and reboot (VERR_VMX_IN_VMX_ROOT_MODE)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ConsoleWrap, interface IConsole

Is there a way to use VirtualBox and Vagrant when kvm-qemu is also present?

This is my Vagrantfile:

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

Vagrant.configure("2") do |config|
  config.vm.network "private_network", ip: "192.168.66.10"
  config.vm.provision "ansible" do |ansible|
    ansible.playbook = 'playbook.yml'
  end
end

I don't want to use the libvirt provider because it has less boxes, and I have to manually edit every Vagrantfile I use.

How can I use Vagrant with VirtualBox when both VirtualBox and libvirt/kvm-qemu are present?

2 Answers 2

1

I found the answer, somewhat by chance. It's possible to have both installed, but it's not possible to have them both run VMs at the same time.

If I shutdown every VM in libvirt, then I can run Vagrant and VirtualBox. If I need a machine from libvirt, then I have to shutdown every VitrualBox VM.

1
  • You can however run your Virtualbox boxes in QEMU/KVM instead of Virtualbox. The all your VMs would be running on KVM.
    – Tobias
    Dec 20, 2019 at 21:05
1

It isn't possible to run VirtualBox and Libvirt (KVM) at the same time because they both require full access to the cpu virtualization features.

Some information on this

Check this question on AskUbuntu

1
  • Could you please include more information from those links? There are also more authoritative sources, such as the VirtualBox manual and the KVM FAQ which address this specifically. Jul 3, 2019 at 12:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .