Skip to content

Vagrant fails with "libvirt is not a recognized provider" #770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dolobanko opened this issue Apr 27, 2017 · 13 comments
Closed

Vagrant fails with "libvirt is not a recognized provider" #770

dolobanko opened this issue Apr 27, 2017 · 13 comments
Labels

Comments

@dolobanko
Copy link

dolobanko commented Apr 27, 2017

I do have strange behavior with vagrant-libvirt plugin on Centos 6.8, libvirt v0.10.2.

Steps to reproduce

  1. Install the latest Vagrant binary (1.9.4).
  2. Install vagrant-libvirt plugin: vagrant plugin install vagrant-libvirt. The strange thing here, that plugin is version 0.0.20.
  3. Initialize vagrant file: vagrant init.
  4. Run vagrant up --provisioner=libvirt

Expected behaviour

VM up and running

Actual behaviour

Below stacktrace:

vagrant up --provider=libvirt

/root/.vagrant.d/gems/2.2.5/gems/fog-core-1.43.0/lib/fog/core/services_mixin.rb:12:in new': libvirt is not a recognized provider (ArgumentError) from /root/.vagrant.d/gems/2.2.5/gems/fog-core-1.43.0/lib/fog/compute.rb:54:in new'
from /root/.vagrant.d/gems/2.2.5/gems/vagrant-libvirt-0.0.20/lib/vagrant-libvirt/action/connect_libvirt.rb:38:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/action/warden.rb:34:in call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/action/builtin/config_validate.rb:25:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/action/warden.rb:34:in call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/action/builder.rb:116:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/action/runner.rb:66:in block in run'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/util/busy.rb:19:in busy' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/action/runner.rb:66:in run'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/machine.rb:225:in action_raw' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/machine.rb:200:in block in action'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/environment.rb:567:in lock' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/machine.rb:186:in call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/machine.rb:186:in action' from /root/.vagrant.d/gems/2.2.5/gems/vagrant-libvirt-0.0.20/lib/vagrant-libvirt/provider.rb:58:in state'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/machine.rb:506:in state' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/machine.rb:145:in initialize'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/vagrantfile.rb:79:in new' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/vagrantfile.rb:79:in machine'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/environment.rb:669:in machine' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/plugin/v2/command.rb:177:in block in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/plugin/v2/command.rb:201:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/plugin/v2/command.rb:201:in block in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/plugin/v2/command.rb:183:in each' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/plugin/v2/command.rb:183:in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/plugins/commands/up/command.rb:131:in install_providers' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/plugins/commands/up/command.rb:85:in execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/cli.rb:42:in execute' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/environment.rb:308:in cli'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/bin/vagrant:127:in `

'

System configuration

OS/Distro version:: Centos 6.8

Libvirt version: v0.10.2

Output of vagrant version; vagrant plugin list:

`vagrant version
Installed Version: 1.9.4
Latest Version: 1.9.4

You're running an up-to-date version of Vagrant!

vagrant plugin list
vagrant-libvirt (0.0.20)

  • Version Constraint: > 0
    vagrant-share (1.1.7)
  • Version Constraint: > 0
    `

Output of VAGRANT_LOG=debug vagrant ... --provider=libvirt
The same as above stacktrace.
``

A Vagrantfile to reproduce the issue:

Vagrant.configure("2") do |config|
  config.vm.box = "centos/7"
end
@timhughes
Copy link
Contributor

timhughes commented Apr 28, 2017

seeing the same thing.

Versions

hughest@argon [0] $ hostnamectl 
    ....
  Operating System: Fedora 25 (Workstation Edition)
       CPE OS Name: cpe:/o:fedoraproject:fedora:25
            Kernel: Linux 4.10.11-200.fc25.x86_64
      Architecture: x86-64


hughest@argon [0] $ vagrant version
Installed Version: 1.9.4
Latest Version: 1.9.4


hughest@argon [0] $ vagrant plugin list
vagrant-libvirt (0.0.20)
vagrant-share (1.1.7, system)


hughest@argon [0] $ rpm -qa|grep libvirt
libvirt-daemon-driver-nwfilter-2.2.0-2.fc25.x86_64
libvirt-gconfig-1.0.0-1.fc25.x86_64
libvirt-glib-1.0.0-1.fc25.x86_64
libvirt-libs-2.2.0-2.fc25.x86_64
libvirt-daemon-driver-nodedev-2.2.0-2.fc25.x86_64
libvirt-daemon-driver-qemu-2.2.0-2.fc25.x86_64
libvirt-python-2.2.0-1.fc25.x86_64
libvirt-gobject-1.0.0-1.fc25.x86_64
libvirt-daemon-driver-secret-2.2.0-2.fc25.x86_64
libvirt-daemon-2.2.0-2.fc25.x86_64
libvirt-daemon-driver-interface-2.2.0-2.fc25.x86_64
libvirt-daemon-kvm-2.2.0-2.fc25.x86_64
libvirt-daemon-driver-storage-2.2.0-2.fc25.x86_64
libvirt-client-2.2.0-2.fc25.x86_64
libvirt-daemon-driver-network-2.2.0-2.fc25.x86_64
libvirt-daemon-config-network-2.2.0-2.fc25.x86_64
libvirt-devel-2.2.0-2.fc25.x86_64

@timhughes
Copy link
Contributor

#769 will fix this issue

for the time being this works

mkdir -p ~/tmp/
cd ~/tmp/
git clone https://github.com/jcf/vagrant-libvirt
cd ./vagrant-libvirt/
git checkout upgrade-nokogiri
gem build vagrant-libvirt.gemspec
vagrant plugin install  ~/tmp/vagrant-libvirt/vagrant-libvirt-0.0.37.gem

@andrewpgit
Copy link

Thank you. It solved the issue.

@PCoetzeeDev
Copy link

Just to add to the above workaround. I didn't have ruby installed natively on my system, so I used the gem binary located at /opt/vagrant/embedded/bin/gem

I don't know if there are any downsides to doing this, but I didn't want to install and configure ruby to get this right. Gem file that was generated was named differently as vagrant-libvirt-0.0.40.gem but worked all the same and my vagrants are running again.

Apologies if anything I've mentioned here is incorrect, my experience with ruby is very limited.

@alexggolovin
Copy link

alexggolovin commented May 19, 2017

Issue is fixed on Debian 8.8 with vagrant-libvirt (0.0.40) installed in the way proposed by timhughes:
vagrant plugin install ~/tmp/vagrant-libvirt/vagrant-libvirt-0.0.40.gem

But new dhcp leases issue has been detected #674 and temporary fixed with the workaround proposed by mrvovanness here fog/fog-libvirt#28

@infernix
Copy link
Member

infernix commented Aug 3, 2017

Can you please retest with 1.9.7?

@davidcomeyne
Copy link

davidcomeyne commented Aug 18, 2017

I have the same issue with Vagrant 1.9.7.
Tried the fix proposed by @timhughes, to no avail (it used vagrant-libvirt-0.0.40.gem).

The output when installing the .gem > gem_make.txt
The mkmf.log states:

"pkg-config --exists libvirt"
package configuration for libvirt is not found

Could easily be an issue on my system (Fedora 26), but if you do know a possible solution I would love to try it out.

@HartS
Copy link

HartS commented Sep 8, 2017

Looking at your 4th step, where are you getting the --provisioner flag? I don't see it documented by vagrant anywhere.. I've been using --provider=libvirt

@electrofelix
Copy link
Contributor

@HartS reasonably sure it's a type and should have been --provider=libvirt, --provision and --provision-with=shell would be the correct arguments if you were looking to control that. The command run and output is consistent with the option having been '--provider=libvirt`.

@pag-r
Copy link

pag-r commented Sep 23, 2017

I had the same issue on my Fedora 26. No solutions was working except one, taken from ArchLinux Vagant wiki: https://wiki.archlinux.org/index.php/Vagrant#vagrant-libvirt. Package libvirt-devel is required. Vagrant package: vagrant-2.0.0-1.x86_64

@friendlypenguin
Copy link

libvirt-dev for debian/ubuntu users

@dolorsitatem
Copy link

Running Debian 9 (Stretch) and installing libvirt-dev solved it for me.

@timhughes
Copy link
Contributor

This was fixed in #769 so this ticket can be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests