vagrant-libvirt: could not find capabilities for domaintype=qemu on mac
I almost have vagrant-libvirt running on macos, but running into an issue.
vagrant, libvirt and qemu are installed from homebrew.
vagrant-libvirt is installed with vagrant plugin install vagrant-libvirt
Sample vagrant file:
Vagrant.configure(2) do |config|
config.vm.provider :libvirt do |lv|
lv.driver = 'qemu'
lv.socket = '/usr/local/var/run/libvirt/libvirt-sock'
lv.cpus = 1
lv.memory = 512
end
config.vm.define 'test' do |node|
node.vm.hostname = 'test'
node.vm.box = 'generic/ubuntu1804'
end
end
$ vagrant up
Bringing machine 'test' up with 'libvirt' provider...
==> test: Checking if box 'generic/ubuntu1804' version '1.9.16' is up to date...
==> test: Creating image (snapshot of base box volume).
==> test: Creating domain with the following settings...
==> test: -- Name: t_test
==> test: -- Domain type: qemu
==> test: -- Cpus: 1
==> test: -- Feature: acpi
==> test: -- Feature: apic
==> test: -- Feature: pae
==> test: -- Memory: 512M
==> test: -- Management MAC:
==> test: -- Loader:
==> test: -- Nvram:
==> test: -- Base box: generic/ubuntu1804
==> test: -- Storage pool: default
==> test: -- Image: /var/lib/libvirt/images/t_test.img (32G)
==> test: -- Volume Cache: default
==> test: -- Kernel:
==> test: -- Initrd:
==> test: -- Graphics Type: vnc
==> test: -- Graphics Port: -1
==> test: -- Graphics IP: 127.0.0.1
==> test: -- Graphics Password: Not defined
==> test: -- Video Type: cirrus
==> test: -- Video VRAM: 256
==> test: -- Sound Type:
==> test: -- Keymap: en-us
==> test: -- TPM Path:
==> test: -- INPUT: type=mouse, bus=ps2
Error while creating domain: Error saving the server: Call to virDomainDefineXML failed: invalid argument: could not find capabilities for domaintype=qemu
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 42 (10 by maintainers)
@ladar Thanks for the reply.
virbrXXinterfaces listed when I doifconfig.bridge0which I see inifconfig, I get a different error:/Users/ermurphy/.vagrant.d/gems/2.4.6/gems/vagrant-libvirt-0.0.45/lib/vagrant-libvirt/driver.rb:59:in `open_read_only': Call to virConnectOpenReadOnly failed: internal error: unexpected QEMU URI path '/system', try qemu:///session (Libvirt::ConnectionError)I am way over my head here on diagnosing the problem since I am new to these tools. Would be wonderful if someone could create a guide for using QEMU/Libvirt/Vagrant on Mac OS.
Have the same issue on my Mac
I explicitly specify the socket in my VagrantFile:
v.socket = "/Users/testuser/.cache/libvirt/libvirt-sock"The same error occurs with either one of the drivers
kvmorqemu(with or without session enabled)Here’s a related issue that was filed against the libvirt project: https://gitlab.com/libvirt/libvirt/-/issues/75
Hi,
Tried the same on macOS and failed too…
created a baked-in packer image with
Was surprised it worked 😃.
Installed libvirt via brew but started the service with sudo (so that I had the qemu://system available) I also had to symlink libvirt-sock:
sudo ln -s /usr/local/var/run/libvirt/libvirt-sock /var/run/libvirt/libvirt-sockThen installed vagrant-libvirt with that wonderful command:
CONFIGURE_ARGS='with-ldflags=-L/opt/vagrant/embedded/lib with-libvirt-include=/usr/local/include/libvirt with-libvirt-lib=/usr/local/lib' GEM_HOME=~/.vagrant.d/gems GEM_PATH=$GEM_HOME:/opt/vagrant/embedded/gems PATH=/opt/vagrant/embedded/bin:$PATH vagrant plugin install vagrant-libvirtBut the simplest vagrantfile fails badly:
which outputs
/Users/charliemordant/.vagrant.d/gems/2.4.9/gems/vagrant-libvirt-0.0.45/lib/vagrant-libvirt/util/network_util.rb:117:inlist_networks’: Call to virConnectNumOfNetworks failed: this function is not supported by the connection driver: virConnectNumOfNetworks (Libvirt::RetrieveError) `This seems to be due to the fact that network is not valid on MacOS: https://github.com/libvirt/libvirt/blob/master/configure.ac#L198
How can we go further? I’m far from being a libvirt/qemu guy, just trying to make it work to have better perf than VirtualBox…
More a workaround than, but can we customise QEMU options ? The idea is to pass some option like these ones:
Gathered from https://www.naut.ca/blog/2020/08/26/ubuntu-vm-on-macos-with-libvirt-qemu/, full XML template for Qemu is here: https://raw.githubusercontent.com/yoonsikp/vm_configs/master/ubuntu.xml
This way we can
vagrant upand then ssh into the VM… which can be usefulAs a backend developper, I always preferred to use Java rather than Assembly, so I would prefer a contribution to libvirt (that won’t be only useful for this plugin). However, I’m just discovering Qemu and infra/VM unix ecosystem so for sure not a good source of truth…
the same issue, do you have resolved this problem?
I am very interested in getting qemu and libvirt working on Mac as well. I have had some success but am currently running into an error.
I also had to create symbolic link
sudo ln -s ~/.cache/libvirt/libvirt-sock /var/run/libvirt/libvirt-sockCurrent Vagrantfile
Please let me know if there is anything obviously wrong here. I am new to Vagrant, Qemu, and Libvirt.
I am interested in collaborating to resolve this issue. I would like to demonstrate CentOS 7 running.