Lessons Learned: Vagrant + libvirt under Fedora

Vagrant is a popular tool when it comes to creating virtual machines on short notice and without further intervention.

Vagrant should not be installed via the official Hashicorp- but via the Fedora repositories - otherwise plugins (like the libvirt integration) have to be compiled manually. I also had compatibility problems here:

1# dnf install vagrant{,-libvirt}

Molecule on the other hand should be installed via pip:

1$ pip3 install --user molecule molecule-vagrant

Simple Vagrant machines without additional or private networks work without problems via the automatically selected user connection (qemu:///session). However, if additional networks are used, the following error usually appears:

1Network xxx.xxx.xxx.xxx is not available. Specify available network name, or an ip address if you want to create a new network.

The reason is simple: the create network requires higher privileges - to do this, add your user to the libvirt group and add the following lines to the vagrantfile:

1Vagrant.configure("2") do |config|
2  config.vm.provider :libvirt do |libvirt|
3    libvirt.qemu_use_session = false
4    # if the above doesn't work, try uncommenting the following instead
5    # libvirt.uri = 'qemu:///system'
6  end
7end

The automatically preinstalled GNOME Boxes has few features. It is suitable to have a look into the console. However, I like to take a look at the VM settings without it being started - this is not possible with GNOME Boxes without starting the VM. So I still rely on the dusty virt-manager:

1# dnf install virt-manager
2# dnf remove gnome-boxes

Translations: