Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

libvirt and VirtualBox / Getting Started

I'm trying to get started on libvirt with VirtualBox as a virtualization 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.

like image 766
Marc Lucas Avatar asked May 06 '10 05:05

Marc Lucas


People also ask

How do I start libvirt?

Use the following commands to start and stop libvirtd or check its status: tux > sudo systemctl start libvirtd tux > sudo systemctl status libvirtd libvirtd.

Does VirtualBox use KVM?

KVM offers some features that VirtualBox does not and the other way around. There is no such thing in the IT world as a universal tool, so it's important to use something that fits your needs. The basic idea is : if you want to install a binary Linux distribution as a guest, use KVM.

What is better VMware or VirtualBox?

If you already work in a VMware environment, Workstation/Fusion is clearly the better option, as it has better compatibility with VMware servers and data management tools. Overall, it's probably a superior option for business use. Virtual machines created by VMware are faster than those created by VirtualBox.


1 Answers

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).

like image 53
brainsik Avatar answered Oct 23 '22 08:10

brainsik