Vagrant-libvirt fails to create VMs on Fedora 31

I belong to the minority group of people who:

  • Use vagrant with vagrant-libvirt
  • Setup VMs with disks additional to the OS disk
  • Use Fedora and install Vagrant from Fedora repo


And ever since I upgraded to Fedora 31, I have been getting the following error on vagrant up.

undefined method `+' for nil:NilClass (NoMethodError)


The error is caused due to a number of changes that were introduced in the vagrant-libvirt version 0.0.45:
  • The default connection to libvirt was changed from system to session. This is the user session mode which is probably useful for many web/apps developers because it makes using vagrant without root permissions possible. However, user session has some downsides, for example, it is not capable of creating virtual networks. It is also not possible to migrate old VMs from system session to user session if case you have been using Vagrant before the upgrade.
  • The location of the disk files changes to ~/.local/share/libvirt from /var/lib/libvirt/images.
It looks like the bug is already fixed in the master branch of vagrant-libvirt but there hasn't been a release yet.

Meanwhile, if you want to continue using vagrant-libvirt by reverting back to system session, you can update the Vagrantfiles to have the following line under the libvirt section:
qemu_use_session = false

If changing every Vagrantfile that you use across multiple projects seems like a lot of work to you then there is a simpler option. Vagrant includes the Vagrantfile under ~/.vagrant.d dir for all the Vagrantfiles it reads. You can, therefore, just create the file with the contents like below :



Vagrant.configure("2") do |config|
  config.vm.provider :libvirt do |libvirt|
    libvirt.qemu_use_session = false
  end

end


Here is the Fedora bug if you want to track its progress: https://bugzilla.redhat.com/show_bug.cgi?id=1706289 .



Comments