Developing/testing vagrant-libvirt

This is a draft I update on the go.

My goal is to make Vagrant work with QEMU/KVM using libvirt and this is a development quickstart for vagrant-libvirt plugin which does exactly that and which I plan to improve.


Download and install vagrant package.


Lives on github.



git clone
cd vagrant-libvirt
# dependencies on Fedora 18
sudo yum install -y libvirt gcc rubygem-bundler
sudo yum install -y libxml2-devel libxslt-devel libvirt-devel libffi-devel
bundle install

create box

A box is a tarball containing:

  • qcow2 image file named box.img.
  • metadata.json file describing box image (provider, virtual_size, format).
  • Vagrantfile that does default settings for the provider-specific configuration for this provider.

vagrant-libvirt git contains example_box:

cp -r vagrant-libvirt/example_box my_box
cd my_box
# get qcow image
wget -O box.img ""
# From example_box/
edit metadata.json
tar cvzf ./metadata.json ./Vagrantfile ./box.img
vagrant box add my_box


You can test the plugin without installing it into your Vagrant environment by creating a Vagrantfile in vagrant-libvirt directory and add as a first line

Vagrant.require_plugin "vagrant-libvirt"

Minimal vagrant-libvirt/Vagrantfile:

Vagrant.require_plugin "vagrant-libvirt" do |config| = "my_box"

With Vagrantfile ready, you can use bundler to execute Vagrant:

bundle exec 'vagrant up --provider=libvirt'


Sadly, previous command fails for me with

Bringing machine 'default' up with 'libvirt' provider...
Error while connecting to libvirt: Error making a connection to libvirt URI qemu://localhost/system?no_verify=1:
Call to virConnectOpen failed: Cannot read CA certificate '/etc/pki/CA/cacert.pem': No such file or directory

I wasn’t able to make it work even after Genereating libvirt certificates.