vagrant-libvirt: incompatible library version

I just tried uninstalling and re-installing vagrant-libvirt in the vague hope that it fixed issue #535

However, now I can’t get anything other than this:

$ vagrant up
/home/ichilton/.vagrant.d/gems/gems/ruby-libvirt-0.6.0/lib/libvirt.rb:11:in `require': incompatible library version - /home/ichilton/.vagrant.d/gems/extensions/x86_64-linux/2.2.0/ruby-libvirt-0.6.0/_libvirt.so (LoadError)
    from /home/ichilton/.vagrant.d/gems/gems/ruby-libvirt-0.6.0/lib/libvirt.rb:11:in `<top (required)>'
    from /home/ichilton/.vagrant.d/gems/gems/fog-libvirt-0.0.3/lib/fog/libvirt.rb:4:in `require'
    from /home/ichilton/.vagrant.d/gems/gems/fog-libvirt-0.0.3/lib/fog/libvirt.rb:4:in `<top (required)>'
    from /home/ichilton/.vagrant.d/gems/gems/vagrant-libvirt-0.0.32/lib/vagrant-libvirt/driver.rb:1:in `require'
    from /home/ichilton/.vagrant.d/gems/gems/vagrant-libvirt-0.0.32/lib/vagrant-libvirt/driver.rb:1:in `<top (required)>'
    from /home/ichilton/.vagrant.d/gems/gems/vagrant-libvirt-0.0.32/lib/vagrant-libvirt/provider.rb:29:in `driver'
    from /home/ichilton/.vagrant.d/gems/gems/vagrant-libvirt-0.0.32/lib/vagrant-libvirt/provider.rb:101:in `state'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/machine.rb:501:in `state'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/machine.rb:144:in `initialize'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/vagrantfile.rb:79:in `new'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/vagrantfile.rb:79:in `machine'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:663:in `machine'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/plugin/v2/command.rb:177:in `block in with_target_vms'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/plugin/v2/command.rb:201:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/plugin/v2/command.rb:201:in `block in with_target_vms'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/plugin/v2/command.rb:183:in `each'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/plugin/v2/command.rb:183:in `with_target_vms'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/commands/up/command.rb:89:in `block in execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:278:in `block (2 levels) in batch'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:276:in `tap'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:276:in `block in batch'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:275:in `synchronize'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:275:in `batch'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/commands/up/command.rb:88:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/cli.rb:42:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:302:in `cli'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/bin/vagrant:174:in `<main>'

O/S is Arch Linux.

I tried swapping in the ruby-libvirt from the AUR, as suggested at: https://wiki.archlinux.org/index.php/Vagrant …but I just get the same.

Any ideas?

Thanks,

Ian

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 29 (10 by maintainers)

Most upvoted comments

ok, i’ve managed to get a workaround for this.

Doing some testing with ruby-libvirt and irb, I found that it worked fine with Arch’s system ruby (2.3.0), but not with Vagrant’s embedded ruby - it gave the above error.

So, I manually uninstalled ruby-libvirt and installed it with the environment fudged to use Vagrant’s ruby.

This includes the fix for the libcurl issue, as per: https://wiki.archlinux.org/index.php/Vagrant

export PATH=/opt/vagrant/embedded/bin:$PATH
export GEM_HOME=~/.vagrant.d/gems
export GEM_PATH=$GEM_HOME:/opt/vagrant/embedded/gems
gem uninstall ruby-libvirt
sudo mv /opt/vagrant/embedded/lib/libcurl.so{,.backup}
sudo mv /opt/vagrant/embedded/lib/libcurl.so.4{,.backup}
sudo mv /opt/vagrant/embedded/lib/libcurl.so.4.4.0{,.backup}
sudo mv /opt/vagrant/embedded/lib/pkgconfig/libcurl.pc{,.backup}
sudo mv /opt/vagrant/embedded/lib/pkgconfig/libcurl.pc{,.backup}
gem install ruby-libvirt
sudo mv /opt/vagrant/embedded/lib/libcurl.so{.backup,}
sudo mv /opt/vagrant/embedded/lib/libcurl.so.4{.backup,}
sudo mv /opt/vagrant/embedded/lib/libcurl.so.4.4.0{.backup,}
sudo mv /opt/vagrant/embedded/lib/pkgconfig/libcurl.pc{.backup,}

And finally, success!

$ vagrant up
Bringing machine 'default' up with 'libvirt' provider...

So it seems that when doing a ‘vagrant plugin install vagrant-libvirt’, it’s not setting up the environment properly somewhere.

I was able to work around this on Arch by changing the Gem path. It seems that Vagrant is installing the gems, linked against Ruby 2.3, into ~/.vagrant.d/gems/2.2.5 not ~/.vagrant.d/gems. Changing the Gem path to ~/.vagrant.d/gems/2.2.5 and reinstalling ruby-libvirt seems to fix this.

https://gist.github.com/j883376/d90933620c7ed14daa4e0963e005377f

It does continue to spew the “incompatible library version” on every command, but it seems to be cosmetic because I was able to successfully start and provision a machine.

Good news! I was able to resolve the incompatible library version error in macOS by:

  1. Upgrading to Vagrant 2.0.1.
  2. rm -rf ~/.vagrant.d
  3. vagrant destroy -f; rm -rf .vagrant
  4. CONFIGURE_ARGS="with-libvirt-include=/usr/include/libvirt with-libvirt-lib=/usr/lib" vagrant plugin install vagrant-libvirt
  5. vagrant up --provider libvirt

At this point, the error is no longer to do with incompatible library version, though hilariously enough after resolving all manner of issues setting up libvirt for vagrant on macOS, I do get a new error:

$ vagrant up --provider libvirt
==> default: VM not created. Moving on...
Bringing machine 'default' up with 'libvirt' provider...
Error while connecting to libvirt: Error making a connection to libvirt URI qemu:///system?no_verify=1&keyfile=/Users/andrew/.ssh/id_rsa&socket=/var/run/libvirt/libvirt-sock:
Call to virConnectOpen failed: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory

Configuring virtd or whatever is beyond me, but at least with a fresh Vagrant including removing the $HOME/.vagrant.d and $(pwd)/.vagrant directories, I don’t see the incompatibility error anymore. Oh well, I’ll look into how to get the libvirt daemon thingy up and running in macOS… The tutorials online keep insisting on using user@hostname in the virtd connection URL, and no combination of values there gets that working.

Also posting to the Homebrew Discourse in case any Homebrew users know how to deal with this socket setup: https://discourse.brew.sh/t/failed-to-connect-socket-to-var-run-libvirt-libvirt-sock-no-such-file-or-directory/1297

Seeing same cosmetic issue on Linux Mint 18 = Ubuntu 16.04 LTS after upgrading vagrant from 1.8.6 to 1.9.1

I’m running into the same issue with Arch. gem pristine ruby-libvirt --version 0.7.0 doesn’t seem to help.

Thank you, kind sir! Why is this not added to the Arch wiki yet?

Sadly I am afraid that will never change for the good as @hashicorp lost interest in vagrant and there is nobody with enough money/time to drive the project. That is one of the reasons I would see molecule-libvirt driver more likely to replace molecule-vagrant for local VM provisioning, removing vagrant from the equation. I hope I am wrong as I really liked the simplicity of the vagrant command line.

I think for some https://github.com/vagrant-libvirt/vagrant-libvirt#additional-notes-for-fedora-and-similar-linux-distributions will help and for others use of CONFIGURE_ARGS will help, the move by vagrant to put plugins under a versioned directory will also help, but in general until vagrant doesn’t require an embedded ruby version with specific libraries to be distributed there are going to be issues when linking between system libraries and the vagrant embedded ruby.

The workaround presented in https://gist.github.com/j883376/d90933620c7ed14daa4e0963e005377f doesn’t work by itself anymore on the latest Archlinux software snapshot

Kernel: 4.11.3-1-ARCH x86_64 (64 bit)
Distro: Arch Linux

pacman -Q|grep vagrant
vagrant 1.9.5-1
vagrant-substrate-605.0566498 ( as pulled from an update with pacman -Syu )
vagrant-substrate 599.d7cedfe-2 (after downgrade)

I’ve updated both the link to the aforementioned gist and the Archlinux wiki for the workaround for vagrant 1.9.5-1

I’m hitting this as well. Ubuntu 16.04, vagrant-libvirt from source, ruby-libvirt from source, vagrant from upstream 1.9.1. I’ve tried everything I can think of.

For me the message appears to be cosmetic because I can still turn up a vagrant-libvirt VM. `vagrant status Ignoring ruby-libvirt-0.7.0 because its extensions are not built. Try: gem pristine ruby-libvirt --version 0.7.0 Current machine states:

oob-mgmt-server not created (libvirt) oob-mgmt-switch not created (libvirt) leaf1 not created (libvirt) leaf2 not created (libvirt)

This environment represents multiple VMs. The VMs are all listed above with their current state. For more information about a specific VM, run vagrant status NAME. ` But the message shows up with every vagrant command which is very annoying.

FYI, I hit this today on Arch Linux and the workaround script posted failed since gem install ruby-libvirt now installs 0.7.0 instead of 0.6.0, (fog-libvirt requires < 0.7.0). Installing ruby-libvirt 0.6.0 explicitly fixed the problem.

gem install ruby-libvirt -v 0.6.0

Error I saw after running the workaround:

Bundler could not find compatible versions for gem "ruby-libvirt":
  In Gemfile:
    vagrant-libvirt was resolved to 0.0.35, which depends on
      fog-libvirt (= 0.0.3) was resolved to 0.0.3, which depends on
        ruby-libvirt (< 0.7.0, >= 0.5.0)