13

I am trying to setup a box with vagrant and libvirt with the following Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.define :test_vm do |test_vm|
    test_vm.vm.box = "test"
    test_vm.vm.network :private_network, :ip => '10.20.30.40'
  end

  config.vm.provider :libvirt do |libvirt|
    libvirt.driver = "qemu"
    libvirt.host = "localhost"
    libvirt.connect_via_ssh = false
    libvirt.username = "root"
    libvirt.storage_pool_name = "data"
  end
end

On RHEL 6.4 I get the following error

Error while connecting to libvirt: Error making a connection to libvirt URI qemu://localhost/system?no_verify=1:
Call to virConnectOpen failed: Unable to import client certificate /etc/pki/CA/cacert.pem

I tried to setup the cert like described here http://libvirt.org/remote.html#Remote_TLS_CA but this didnt change anything.

If i try to connect via ssh vagrant is able to slowly upload the box but afterwards I get the next failure

Call to virDomainCreateWithFlags failed: internal error Process exited while reading console log output: char device redirected to /dev/pts/20
qemu-kvm: -drive file=/local/data/virtualbox/root_1372773363.img,if=none,id=drive-virtio-disk0,format=qcow2: could not open disk image /local/data/virtualbox/root_1372773363.img: Invalid argument

On Fedora 17 or Arch Linux I cannot even install the vagrant-libvirt plugin, because it cannot find the libvirt library (lying under /usr/lib).

Does someone somehow manage to get vagrant working with libvirt or is the libvirt plugin still to alpha?

TIA && have a nice day!

Basti

1

5 Answers 5

8

I got this Error while connecting to libvirt error but it was because I was running vagrant up without specifying the provider.

In my case I needed

$ vagrant up --provider virtualbox
2

I got this error while trying to start a Vagrant machine up, without having Virtualbox initially installed (although I had previously written I needed it).

Installing Virtualbox fixed this issue right away.

1

I too had this same issue. To fix it I had to essentially follow this guide : http://wiki.libvirt.org/page/TLSSetup

Note that the guide has multiple steps and it is LONG. Its not an "easy" fix though once you have the CAcert/key HostCert/key and ClientCert/key all in place, with the correct permissions and the correct ownership, everything works as expected.

thanks for reporting this and I hope this helps.

1

I also had this error on a pretty much fresh install of Ubuntu 19.10.

When I did: vagrant up --provider virtualbox

I got this error message

The provider 'virtualbox' that was requested to back the machine
'default' is reporting that it isn't usable on this system. The
reason is shown below:

Vagrant has detected that you have a version of VirtualBox installed
that is not supported by this version of Vagrant. Please install one of
the supported versions listed below to use Vagrant:

4.0, 4.1, 4.2, 4.3, 5.0, 5.1, 5.2, 6.0

A Vagrant update may also be available that adds support for the version
you specified. Please check www.vagrantup.com/downloads.html to download
the latest version

So this helped in my case: sudo apt-get install virtualbox-6.0

0

both virtual box and vagrant have to be up to date or at least compatible versions so uninstall and re install both programs (to make sure they are compatible install the most up to date version of both programs), note that vagrant has to be installed after virtual box

You must log in to answer this question.

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