2

I can't get vagrant working with libvirt.

I first used the distro packages, but it produced the same error you see in my description below. Then I removed every distro vagrant package and installed the packages provided by hashicorp:

curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install vagrant

then I installed the libvirt-vagrant plugin:

vagrant plugin install vagrant-libvirt
Installing the 'vagrant-libvirt' plugin. This can take a few minutes...
Fetching formatador-0.3.0.gem
Fetching fog-core-2.2.4.gem
Fetching fog-json-1.2.0.gem
Fetching nokogiri-1.12.5-x86_64-linux.gem
Fetching fog-xml-0.1.4.gem
Fetching ruby-libvirt-0.8.0.gem
Building native extensions. This could take a while...
Fetching fog-libvirt-0.9.0.gem
Fetching vagrant-libvirt-0.7.0.gem
Installed the plugin 'vagrant-libvirt (0.7.0)'!

However the vagrant up --provider=libvirt still fails:

The provider 'libvirt' could not be found, but was requested to
back the machine 'debian11'. Please use a provider that exists.

Vagrant knows about the following providers: virtualbox, hyperv, docker

Any ideas?

1 Answer 1

2

So I tried this process on a fresh VM but these are the steps I followed(In my testing I felt libvirt storage is very slow, is it due to my hardware or it is expected ?)

The Steps I followed


 curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
 sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
 sudo apt-get update && sudo apt-get install vagrant

 apt install vagrant-libvirt
 apt-get build-dep vagrant ruby-libvirt
 apt-get install qemu libvirt-daemon-system libvirt-clients ebtables dnsmasq-base
 apt-get install libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev
 apt-get install libguestfs-tools
 vagrant plugin install vagrant-libvirt
 
 vagrant init fedora/32-cloud-base
 vagrant up --provider=libvirt

Well I am doing this all in a cloud VM, while doing up I got errors like Error while creating domain: Error saving the server: Call to virDomainDefineXML failed: End of file while reading data: Input/output error I hope it's no relevant to your query.

Hope it helps.

Refernce:

1
  • Cloud VM's don't always support "nested virtualization" (Running a VM in a VM). (because the Cloud VMs are VMs, they can't always run VMs. Many cloud providers offer bare metal Infrastructure as a Service for doing VM things) Commented Feb 22, 2022 at 20:28

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.