brew install qemu gcc libvirt
brew services start libvirt
vagrant plugin install vagrant-libvirt
- e.g.
"Failed to connect socket to ‘/var/run/libvirt/libvirt-sock’: No such file or directory"
- see Discussion and solution on brew.sh
- depnding on error and socket location quick/dirty alternative is..
- a symlink:
sudo ln -s ~/.cache/libvirt/libvirt-sock /var/run/libvirt/libvirt-sock
- directly specifying socket location in Vagrantfile
- a symlink:
$ virsh
virsh # connect qemu:///session?socket=/Users/rollwagen/.cache/libvirt/libvirt-sock
list
Vagrant.configure("2") do |config|
config.vm.provider :libvirt do |libvirt|
#libvirt.socket="/usr/local/var/run/libvirt/libvirt-sock"
libvirt.uri="qemu:///session?socket=/Users/rollwagen/.cache/libvirt/libvirt-sock"
libvirt.socket="/Users/rollwagen/.cache/libvirt/libvirt-sock"
libvirt.qemu_use_session = true
#libvirt.uri = "qemu:///session"
libvirt.driver="qemu"
end
config.vm.box = "archlinux/archlinux"
config.vm.synced_folder ".", "/vagrant", disabled: true
end
-
What's the difference between
qemu:///system
andqemu:///session
link -
In case of quemu errors
qemu-system-x86_64: Error: HV_ERROR
, need to explicitely grant executable permission to qemu- create xml file e.g.
entitlements.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.security.hypervisor</key> <true/> </dict> </plist>
codesign -s - --entitlements entitlements.xml --force /usr/local/bin/qemu-system-x86_64
- create xml file e.g.