开发者

libvirt and VirtualBox / Getting Started

I'm trying to get started on libvirt with VirtualBox as a virtualiz开发者_Python百科ation solution. I installed everything and VirtualBox itself is running when using their VBoxHeadless command. However, libvirt fails to connect to VirtualBox:

# virsh -c vbox:///session
libvir: error : could not connect to vbox:///session
error: failed to connect to the hypervisor

I could not find any hints in the libvirt documentation that point to whether I have to make any domain specific configuration before using virsh.

Does anyone have a hint? Or even better, maybe a tutorial that works through the way of using libvirt, virsh or it's APIs (my later goal) from the ground up.


If you are doing this on Ubuntu, then the problem is their libvirt package is built without VirtualBox support.

You can rebuild the package with support very easily. Something like:

apt-get source -d libvirt
sudo apt-get build-dep libvirt
dpkg-source -x libvirt*dsc

Go into the libvirt directory and edit debian/rules so that instead of --without-vbox it says --with-vbox. You can add an entry to the top of debian/changelog so the package is compiled as a different version (e.g., append ~local1 to the version).

dpkg-buildpackage -us -uc -b -rfakeroot

You'll get new .debs built in the directory above. Use dpkg -i to install the relevant ones (libvirt0, libvirt0-bin, and whatever else you want).


Double-check whether or not you have write access to /var/run/libvirt/libvirt-sock.

The socket file should have permissions similar to:

$ sudo ls -la /var/run/libvirt/libvirt-sock
srwxrwx--- 1 root libvirtd 0 2010-08-24 14:54 /var/run/libvirt/libvirt-sock

I think it could be helpful also to increase the libvirt logging capabilities by running this in your shell:

export LIBVIRT_DEBUG=1


There is Ubuntu PPA for libvirt with VirtualBox support: https://launchpad.net/~cxl/+archive/ubuntu/libvirt

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜