How to Fix Vagrant: Error while connecting to libvirt
When you setup a box with vagrant and virtualbox and got this error message:
Error while connecting to libvirt: Error making a connection to libvirt URI qemu:///system?no_verify=1&keyfile=/home/username/.ssh/id_rsa:
Call to virConnectOpen failed: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
the reason you can’t run the vagrant box is because your Virtualbox is not recognized by Vagrant Script. You can fix this by run vagrant use virtualbox as the provider.
vagrant up --provider virtualbox
if you lucky, the box will start and booting. but, if you got this error:
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, you need to update your Vagrant script.
wget https://releases.hashicorp.com/vagrant/2.2.10/vagrant_2.2.10_x86_64.deb sudo dpkg -i vagrant_2.2.10_x86_64.deb
and then start the box again