Skip to content
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

Unable to install vagrant-libvirt on Ubuntu 22.04 (Jammy Jellyfish) #1498

Closed
alexanderadam opened this issue May 21, 2022 · 7 comments
Closed

Comments

@alexanderadam
Copy link

Describe the bug

This is probably similar to #1403 and #1476: I cannot install the plugin since Vagrant complains that libvirt is missing.

To Reproduce
Steps to reproduce the behaviour:

Using the official Vagrant repo doesn't for 22.04 work and the workaround for installing seem to be using the current deb directory: https://stackoverflow.com/questions/71987581/openssl-3-0-error-when-booting-vagrantbox

But if it is installed this way, installing vagrant-libvirt doesn't work:

$ vagrant plugin install vagrant-libvirt
Installing the 'vagrant-libvirt' plugin. This can take a few minutes...
Building native extensions. This could take a while...
Vagrant failed to install the requested plugin because it depends
on a library which is not currently installed on this system. The
following library is required by the 'vagrant-libvirt' plugin:

  libvirt

Please install the library and then run the command again.

Installed dependencies before with:

sudo apt install ruby-libvirt qemu libvirt-daemon-system libvirt-clients ebtables dnsmasq-base libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev libguestfs-tools

Expected behaviour

  1. The Vagrant Debian/Ubuntu repo should work for Jammy
  2. vagrant-libvirt should recognize libvirt installation

Screenshots

grafik

Versions (please complete the following information)::

  • Libvirt version: 8.0.0
  • Vagrant version [output of vagrant version]: 2.2.19
  • Vagrant flavour [Upstream or Distro]: latest DEB on Vagrant website
  • Vagrant plugins versions (including vagrant-libvirt) [output of vagrant plugin list]:
vagrant-mutate (1.2.0, global)

Debug Log

Attach Output of VAGRANT_LOG=debug vagrant ... --provider=libvirt >vagrant.log 2>&1
vagrant.log

@electrofelix
Copy link
Contributor

Did you also run the first line to install all of the build dependencies of vagrant and ruby-libvirt?

apt-get build-dep vagrant ruby-libvirt

I see that you've got the following lines covered, but not the above:

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

Also if that doesn't solve you're problem, when you perform the plugin install with debug enabled it should reference addition log files that capture more details of what went wrong during the install, your existing log contains the following lines, can you attach the mkmf.log and gem_make.log mentioned below:

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/user/.vagrant.d/gems/2.7.4/extensions/x86_64-linux/2.7.0/ruby-libvirt-0.8.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/user/.vagrant.d/gems/2.7.4/gems/ruby-libvirt-0.8.0 for inspection.
Results logged to /home/user/.vagrant.d/gems/2.7.4/extensions/x86_64-linux/2.7.0/ruby-libvirt-0.8.0/gem_make.out

@alexanderadam
Copy link
Author

alexanderadam commented May 21, 2022

Thank you for your fast response!

Did you also run the first line to install all of the build dependencies of vagrant and ruby-libvirt?

grafik

Everything should be available.

can you attach the mkmf.log and gem_make.log mentioned

Sure. mkmf.log contains

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

and gem_make.out contains

current directory: /home/user/.vagrant.d/gems/2.7.4/gems/ruby-libvirt-0.8.0/ext/libvirt
/opt/vagrant/embedded/bin/ruby -I /opt/vagrant/embedded/lib/ruby/2.7.0 -r ./siteconf20220521-2784004-1f6t70c.rb extconf.rb
Looking for libvirt using pkg-config
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/opt/vagrant/embedded/bin/$(RUBY_BASE_NAME)
	--with-libvirt-include
	--without-libvirt-include
	--with-libvirt-lib
	--without-libvirt-lib
	--with-libvirt-config
	--without-libvirt-config
	--with-pkg-config
	--without-pkg-config
extconf.rb:37:in `<main>': libvirt library not found in default locations (RuntimeError)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/user/.vagrant.d/gems/2.7.4/extensions/x86_64-linux/2.7.0/ruby-libvirt-0.8.0/mkmf.log

extconf failed, exit code 1

@electrofelix
Copy link
Contributor

Well that is odd to see it can't find the libvirt.pc file for pkg-config. That sounds like a distro bug since you've installed libvirt-dev which should contain the necessary files according to https://packages.ubuntu.com/jammy/amd64/libvirt-dev/filelist

Can you run pkg-config --exists libvirt directly yourself so we can see if it's specific to how it's called from within vagrant and not something won't with the installed packages.

Btw, I'm presuming you are x86_64 arch for distro and vagrant package?

@alexanderadam
Copy link
Author

alexanderadam commented May 21, 2022

pkg-config --exists libvirt returns 1.

I also saw that there's a vagrant-libvirt debian package in the sources (0.7.0-1), so I just installed that.
But when I'm running vagrant up I'm getting

No usable default provider could be found for your system.

Vagrant relies on interactions with 3rd party systems, known as
"providers", to provide Vagrant with resources to run development
environments. Examples are VirtualBox, VMware, Hyper-V.

The easiest solution to this message is to install VirtualBox, which
is available for free on all major platforms.

If you believe you already have a provider available, make sure it
is properly installed and configured. You can see more details about
why a particular provider isn't working by forcing usage with
`vagrant up --provider=PROVIDER`, which should give you a more specific
error message for that particular provider.

So I guess that libvirt isn't recognized in general?

Btw, I'm presuming you are x86_64 arch for distro and vagrant package?

Yes.

It would be great if at least the Podman solution would be running.
But I'm purging and reinstalling everything now since I got at least the IP error yesterday.

Purging and reinstalling didn't help.

@electrofelix
Copy link
Contributor

If you use the distro package of vagrant-libvirt you'll need to use the distro package of vagrant as well, as the install location won't be picked up by the upstream vagrant.

I'm a little rusty on pkg-config, so not sure what verbose or debug options there are, but need to find out why it's not finding them given you have libvirt-dev installed. Can you check if the files actually appear at the location reported by the page listing the files installed by libvirt-dev https://packages.ubuntu.com/jammy/amd64/libvirt-dev/filelist

And then check if there are other pkg-config files under the same directory and see if pkg-config will report success if you query for the associated package.

I'll have a look at the podman issue shortly, it could be a simple group permission issue or possibly starting the container before the service has created the required sockets to open resulting in the directory being created with the wrong permissions/owner/group

@electrofelix
Copy link
Contributor

Running pkg-config --list-package-names | grep libvirt outputs:

libvirt-admin
libvirt-lxc
libvirt-qemu
libvirt
libvirt-gobject-1.0
libvirt-gconfig-1.0
libvirt-glib-1.0

trying pkg-config --path libvirt:

/usr/lib64/pkgconfig/libvirt.pc

As I'm using gentoo, the paths will be different, however I would expect that pkg-config should see the libvirt.pc file under /usr/lib/x86_64-linux-gnu/pkgconfig/ and report a whole bunch of packages that you can get pkg-config for.

@alexanderadam
Copy link
Author

If you use the distro package of vagrant-libvirt you'll need to use the distro package of vagrant as well

I would love to but then I'm running into another bug that other users described on StackOverflow.
I'm not quite sure whether this is tracked somewhere, too?
Probably related to this Lauchpad bug that should be fixed but obviously isn't.

Can you check if the files actually appear at the location reported by the page listing the files installed by libvirt-dev https://packages.ubuntu.com/jammy/amd64/libvirt-dev/filelist

Okay, I got it. Homebrew is breaking pkgconfig paths:

$ pkg-config --variable pc_path pkg-config
/home/linuxbrew/.linuxbrew/lib/pkgconfig:/home/linuxbrew/.linuxbrew/share/pkgconfig:/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/os/linux/pkgconfig

With that information I found an issue on Homebrew that I created on Homebrew in 2017 🙄

So I did

$ brew remove --ignore-dependencies pkg-config

Afterwards paths looked fine again:

pkg-config --variable pc_path pkg-config
/usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig

Afterwards installing vagrant-libvirt worked perfectly fine.

I'm sorry for the fuss.

If Vagrant would also be installable via homebrew on Linux this wouldn't have happened because I would have installed it via Homebrew then.
And if homebrew would work including distribution libraries, this wouldn't have happened either.

Thank you for your support. I really appreciate it! 🙌

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

No branches or pull requests

2 participants