How to get libvirt working on macos

From razwiki
Jump to navigation Jump to search

says to try

qemu:///session

Ok so do

export LIBVIRT_DEFAULT_URI=qemu:///session

With a vagrantfile that looks like

Vagrant.configure("2") do |config|
  config.vm.define :test_vm do |test_vm|
    test_vm.vm.box = "fedora/32-cloud-base"
  end
end

I get an error

        38: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/batch_action.rb:86:in `block (2 levels) in run'
        37: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/machine.rb:201:in `action'
        36: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/machine.rb:201:in `call'
        35: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/environment.rb:614:in `lock'
        34: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/machine.rb:215:in `block in action'
        33: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/machine.rb:246:in `action_raw'
        32: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/runner.rb:89:in `run'
        31: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/util/busy.rb:19:in `busy'
        30: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/runner.rb:89:in `block in run'
        29: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builder.rb:149:in `call'
        28: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
        27: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
        26: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
        25: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builtin/box_check_outdated.rb:31:in `call'
        24: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
        23: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builtin/call.rb:53:in `call'
        22: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/runner.rb:89:in `run'
        21: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/util/busy.rb:19:in `busy'
        20: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/runner.rb:89:in `block in run'
        19: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builder.rb:149:in `call'
        18: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
        17: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:127:in `block in finalize_action'
        16: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
        15: from /Users/rabuissa/.vagrant.d/gems/2.7.4/gems/vagrant-libvirt-0.7.0/lib/vagrant-libvirt/action/set_name_of_domain.rb:34:in `call'
        14: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
        13: from /Users/rabuissa/.vagrant.d/gems/2.7.4/gems/vagrant-libvirt-0.7.0/lib/vagrant-libvirt/action/handle_storage_pool.rb:63:in `call'
        12: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
        11: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
        10: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
         9: from /Users/rabuissa/.vagrant.d/gems/2.7.4/gems/vagrant-libvirt-0.7.0/lib/vagrant-libvirt/action/handle_box_image.rb:111:in `call'
         8: from /Users/rabuissa/.vagrant.d/gems/2.7.4/gems/vagrant-libvirt-0.7.0/lib/vagrant-libvirt/action/handle_box_image.rb:111:in `synchronize'
         7: from /Users/rabuissa/.vagrant.d/gems/2.7.4/gems/vagrant-libvirt-0.7.0/lib/vagrant-libvirt/action/handle_box_image.rb:112:in `block in call'
         6: from /Users/rabuissa/.vagrant.d/gems/2.7.4/gems/vagrant-libvirt-0.7.0/lib/vagrant-libvirt/action/handle_box_image.rb:112:in `each_index'
         5: from /Users/rabuissa/.vagrant.d/gems/2.7.4/gems/vagrant-libvirt-0.7.0/lib/vagrant-libvirt/action/handle_box_image.rb:119:in `block (2 levels) in call'
         4: from /Users/rabuissa/.vagrant.d/gems/2.7.4/gems/vagrant-libvirt-0.7.0/lib/vagrant-libvirt/action/handle_box_image.rb:196:in `send_box_image'
         3: from /Users/rabuissa/.vagrant.d/gems/2.7.4/gems/fog-core-2.2.4/lib/fog/core/collection.rb:50:in `create'
         2: from /Users/rabuissa/.vagrant.d/gems/2.7.4/gems/fog-libvirt-0.9.0/lib/fog/libvirt/models/compute/volume.rb:42:in `save'
         1: from /Users/rabuissa/.vagrant.d/gems/2.7.4/gems/fog-libvirt-0.9.0/lib/fog/libvirt/requests/compute/create_volume.rb:6:in `create_volume'
/Users/rabuissa/.vagrant.d/gems/2.7.4/gems/fog-libvirt-0.9.0/lib/fog/libvirt/requests/compute/create_volume.rb:6:in `create_volume_xml': Call to virStorageVolCreateXML failed: cannot chown /Users/rabuissa/.local/share/libvirt/images/fedora-VAGRANTSLASH-32-cloud-base_vagrant_box_image_32.20200422.0_box.img to (0, 0): Operation not permitted (Libvirt::Error)

It's a permission issue, let me try sudo

sh-3.2# LIBVIRT_DEFAULT_URI=qemu:///session vagrant up --provider libvirt
The provider 'libvirt' could not be found, but was requested to
back the machine 'test_vm'. Please use a provider that exists.

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

Ok...