I have a new OSX Lion Macbook and would like to control VirtualBox using
"virsh" (as I do with KVM under Ubuntu).
I've got this far:
* Installed VirtualBox
* Installed libvirt (brew install libvirt)
But now I'm a bit stuck :-)
I ran VirtualBox itself, and created a test VM successfully.
If I try to use virsh, this is what I get:
Brians-MacBook-Air:~ $ virsh -c vbox:///session
error: internal error unable to initialize VirtualBox driver API
error: failed to connect to the hypervisor
Brians-MacBook-Air:~ $ virsh -c vbox+unix:///session
error: Failed to connect socket to
'@/Users/brian/.libvirt/libvirt-sock': No such file or directory
error: failed to connect to the hypervisor
If I try to start libvirtd, this is what I get:
Brians-MacBook-Air:~ $ /usr/local/sbin/libvirtd
00:00:18.970: -1: info : libvirt version: 0.9.6
00:00:18.970: -1: error : virNetSocketNewListenUNIX:340 : Failed to bind socket
to '@/Users/brian/.libvirt/libvirt-sock': No such file or directory
[but directory /Users/brian/.libvirt was created]
However, VirtualBox itself is running OK:
Brians-MacBook-Air:~ $ VBoxManage list vms
"test" {d0d74c25-1dfc-44a4-8a2b-1d25b7972e7c}
Furthermore, dtruss suggests that virsh is finding the installed VirtualBox:
Brians-MacBook-Air:~ $ sudo dtruss -f virsh -c vbox:///session 2>&1 |
grep -i virtualbox
error: internal error unable to initialize VirtualBox driver API
48916/0x3cc08: write_nocancel(0x2, "internal error unable to initialize
VirtualBox driver API\n\0", 0x3A) = 58 0
48916/0x3cc08: access("/usr/lib/virtualbox/VBoxXPCOMC.dylib\0", 0x0,
0x0) = -1 Err#2
48916/0x3cc08: access("/usr/lib/virtualbox-ose/VBoxXPCOMC.dylib\0",
0x0, 0x0) = -1 Err#2
48916/0x3cc08: access("/usr/lib64/virtualbox/VBoxXPCOMC.dylib\0",
0x0, 0x0) = -1 Err#2
48916/0x3cc08: access("/usr/lib64/virtualbox-ose/VBoxXPCOMC.dylib\0",
0x0, 0x0) = -1 Err#2
48916/0x3cc08: access("/usr/lib/VirtualBox/VBoxXPCOMC.dylib\0", 0x0,
0x0) = -1 Err#2
48916/0x3cc08: access("/opt/virtualbox/VBoxXPCOMC.dylib\0", 0x0, 0x0)
= -1 Err#2
48916/0x3cc08: access("/opt/VirtualBox/VBoxXPCOMC.dylib\0", 0x0, 0x0)
= -1 Err#2
48916/0x3cc08: access("/opt/virtualbox/i386/VBoxXPCOMC.dylib\0", 0x0,
0x0) = -1 Err#2
48916/0x3cc08: access("/opt/VirtualBox/i386/VBoxXPCOMC.dylib\0", 0x0,
0x0) = -1 Err#2
48916/0x3cc08: access("/opt/virtualbox/amd64/VBoxXPCOMC.dylib\0",
0x0, 0x0) = -1 Err#2
48916/0x3cc08: access("/opt/VirtualBox/amd64/VBoxXPCOMC.dylib\0",
0x0, 0x0) = -1 Err#2
48916/0x3cc08: access("/usr/local/lib/virtualbox/VBoxXPCOMC.dylib\0",
0x0, 0x0) = -1 Err#2
48916/0x3cc08: access("/usr/local/lib/VirtualBox/VBoxXPCOMC.dylib\0",
0x0, 0x0) = -1 Err#2
48916/0x3cc08:
access("/Applications/VirtualBox.app/Contents/MacOS/VBoxXPCOMC.dylib\0",
0x0, 0x0) = 0 0
48916/0x3cc08:
stat64("/Applications/VirtualBox.app/Contents/MacOS/VBoxXPCOMC.dylib\0",
0x7FFF685D0980, 0x7FFF685D1810) = 0 0
48916/0x3cc08:
open("/Applications/VirtualBox.app/Contents/MacOS/VBoxXPCOMC.dylib\0",
0x0, 0x0) = 4 0
48916/0x3cc08:
stat64("/Applications/VirtualBox.app/Contents/MacOS/VBoxRT.dylib\0",
0x7FFF685D0750, 0x7FFF685D15D0) = 0 0
48916/0x3cc08:
open("/Applications/VirtualBox.app/Contents/MacOS/VBoxRT.dylib\0",
0x0, 0x0) = 4 0
48916/0x3cc08:
stat64("/Applications/VirtualBox.app/Contents/MacOS/VBoxXPCOM.dylib\0",
0x7FFF685D0750, 0x7FFF685D15D0) = 0 0
48916/0x3cc08:
open("/Applications/VirtualBox.app/Contents/MacOS/VBoxXPCOM.dylib\0",
0x0, 0x0) = 4 0
But looking at the dtruss output shortly before it prints the error message
doesn't give me any clues as to what's going wrong.
...
48916/0x3cc08: stat64("/usr/lib/libbsm.0.dylib\0", 0x7FFF685D0090,
0x7FFF685D0F10) = 0 0
48916/0x3cc08:
stat64("/System/Library/PrivateFrameworks/Heimdal.framework/Versions/A/Heimdal\0",
0x7FFF685D0290, 0x7FFF685D1110) = 0 0
48916/0x3cc08: stat64("/usr/lib/libncurses.5.4.dylib\0",
0x7FFF685D05A0, 0x7FFF685D1420) = 0 0
48916/0x3cc08: getpid(0x7FFF685D1628, 0x108A16004, 0xEA60) = 48916
0
48916/0x3cc08: open("/dev/dtracehelper\0", 0x2, 0xFFFFFFFFFFFFFFB0)
= 4 0
48916/0x3cc08: ioctl(0x4, 0x80086804, 0x7FFF685D1708) = 0 0
48916/0x3cc08: close(0x4) = 0 0
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: sigaction(0xD, 0x7FFF685D1978, 0x0) = 0 0
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: pipe(0x108BF1D90, 0x1000004, 0x7) = 4 0
48916/0x3cc08: fcntl(0x5, 0x3, 0x0) = 1 0
48916/0x3cc08: fcntl(0x5, 0x4, 0x5) = 0 0
48916/0x3cc08: fcntl(0x4, 0x3, 0x0) = 0 0
48916/0x3cc08: fcntl(0x4, 0x4, 0x4) = 0 0
48916/0x3cc08: fcntl(0x5, 0x1, 0x0) = 0 0
48916/0x3cc08: fcntl(0x5, 0x2, 0x1) = 0 0
48916/0x3cc08: fcntl(0x4, 0x1, 0x0) = 0 0
48916/0x3cc08: fcntl(0x4, 0x2, 0x1) = 0 0
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: getuid(0x7F9ABBC2B850, 0x108BED7A0, 0x0) = 0 0
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: gettid(0x0, 0x7FFF74AC9F00, 0x108A32B58) = -1
Err#3
48916/0x3cc08: write_nocancel(0x2, "error: \0", 0x7) = 7 0
48916/0x3cc08: write_nocancel(0x2, "internal error unable to initialize
VirtualBox driver API\n\0", 0x3A) = 58 0
48916/0x3cc08: write_nocancel(0x2, "error: \0", 0x7) = 7 0
48916/0x3cc08: write_nocancel(0x2, "failed to connect to the
hypervisor\n\0", 0x24) = 36 0
48916/0x3cc08: close(0x3) = 0 0
48916/0x3cc08: __sysctl(0x7FFF685D0F4C, 0x2, 0x7FFF685D0F38) = 0 0
48916/0x3cc08: bsdthread_register(0x7FFF8DCDCB68, 0x7FFF8DCDCB78, 0x2000)
= 0 0
48916/0x3cc08: thread_selfid(0x7FFF8DCDCB68, 0x7FFF8DCDCB78, 0x0)
= 248840 0
...
Has anybody got libvirt + OSX Lion + VirtualBox working, and if so, how did
you do it?
I see the same question asked here:
http://stackoverflow.com/questions/7946994/libvirt-and-virtualbox-on-osx
but unfortunately no response as yet.
Thanks in advance,
Brian.