3

I'm using Virtualbox 4.3.18 on my Arch Linux Host machine and libvirt-bin 1.2.9 on my Ubuntu Server Cloud guest machine. Everytime I try to follow this tutorial I receive the following error when I run virsh:

Command:

virsh -c vbox+ssh://[email protected]/system list --all

Error:

error: failed to connect to the hypervisor
error: internal error: unable to initialize VirtualBox driver API

Someone know how to fix this?

Leandro
  • 131
  • 3

1 Answers1

0

Your installation of libvirtd needs to be configured to handle the vbox+ssh connection type. Details on how to do this are covered here, titled: VirtualBox hypervisor driver.

There's a sample domain XML config that you'll need to load into libvirtd so that it knows how to talk to the VirtualBox VM.

excerpt - sample config
<domain type='vbox'>
  <name>vbox</name>
  <uuid>4dab22b31d52d8f32516782e98ab3fa0</uuid>

  <os>
    <type>hvm</type>
    <boot dev='cdrom'/>
    <boot dev='hd'/>
    <boot dev='fd'/>
    <boot dev='network'/>
  </os>

  <memory>654321</memory>
  <vcpu>1</vcpu>

  <features>
    <pae/>
    <acpi/>
    <apic/>
  </features>

  <devices>
    <disk type='file' device='cdrom'>
      <source file='/home/user/Downloads/slax-6.0.9.iso'/>
      <target dev='hdc'/>
      <readonly/>
    </disk>

    <disk type='file' device='disk'>
      <source file='/home/user/tmp/vbox.vdi'/>
      <target dev='hdd'/>
    </disk>

    <disk type='file' device='floppy'>
      <source file='/home/user/tmp/WIN98C.IMG'/>
      <target dev='fda'/>
    </disk>

    <filesystem type='mount'>
      <source dir='/home/user/stuff'/>
      <target dir='my-shared-folder'/>
    </filesystem>

    <!--BRIDGE-->
    <interface type='bridge'>
      <source bridge='eth0'/>
      <mac address='00:16:3e:5d:c7:9e'/>
      <model type='am79c973'/>
    </interface>

    <!--NAT-->
    <interface type='user'>
      <mac address='56:16:3e:5d:c7:9e'/>
      <model type='82540eM'/>
    </interface>

    <sound model='sb16'/>

    <parallel type='dev'>
      <source path='/dev/pts/1'/>
      <target port='0'/>
    </parallel>

    <parallel type='dev'>
      <source path='/dev/pts/2'/>
      <target port='1'/>
    </parallel>

    <serial type="dev">
      <source path="/dev/ttyS0"/>
      <target port="0"/>
    </serial>

    <serial type="pipe">
      <source path="/tmp/serial.txt"/>
      <target port="1"/>
    </serial>

    <hostdev mode='subsystem' type='usb'>
      <source>
        <vendor id='0x1234'/>
        <product id='0xbeef'/>
      </source>
    </hostdev>

    <hostdev mode='subsystem' type='usb'>
      <source>
        <vendor id='0x4321'/>
        <product id='0xfeeb'/>
      </source>
    </hostdev>
  </devices>
</domain>

Save this to a file, say my.xml, on your system and then use virsh to import it.

$ virsh create my.xml

NOTE: You'll also need the libvirt daemon driver installed. On Fedora 20 it's in a package called: libvirt-daemon-driver-vbox. You'll need libvirt-daemon along with the interface, libvirt-daemon-driver-interface. I would assume there are similar packages that provide these on ArchLinux.

References

KVM/Virsh - Ubuntu documentation

slm
  • 363,520
  • 117
  • 767
  • 871
  • I couldn't find any of this packages for Arch and Ubuntu. – Leandro Oct 17 '14 at 23:54
  • Their names will likely be different. Relax your searches using pacman. Look for libvirt. – slm Oct 18 '14 at 00:05
  • There are only 3 packages: libvirt, libvirt-glib and libvirt-python – Leandro Oct 18 '14 at 00:30
  • @Leandro_GS - Then you may not be able to make use of libvirt on Arch if it doesn't have these packages. You cannot do what you want without the vbox driver for libvirt. – slm Oct 18 '14 at 00:39
  • Looks like these packages are [all included](https://wiki.archlinux.org/index.php/libvirt) on "libvirt" package. `libvirt is a virtualization API and a daemon for managing virtual machines (VMs) -- remote or locally, using multiple virtualization back-ends (QEMU/KVM, VirtualBox, Xen, etc), communally called hypervisors .` – Leandro Oct 18 '14 at 00:41
  • @Leandro_GS - yes that possibly sounds like everything is included. Be aware that libvirtd is a generic interface from which you can manage many different backend technologies, so that description may be saying just that. Using `pacman` you should be able to list out an inventory of what's included. – slm Oct 18 '14 at 00:43
  • I think [this](https://www.archlinux.org/packages/community/x86_64/libvirt/) is the list – Leandro Oct 18 '14 at 00:49
  • @Leandro_GS - looking in my package for vbox the library is called: `/usr/lib64/libvirt/connection-driver/libvirt_driver_vbox.so`. Looking at that Arch pkg it too carries that same file, `usr/lib/libvirt/connection-driver/libvirt_driver_vbox.so`, so you should be all set. – slm Oct 18 '14 at 00:51
  • I was thinking in use virt-manager instead virtualbox, but I am also having trouble to install it. – Leandro Oct 18 '14 at 01:00
  • @Leandro_GS - sorry I don't use Arch so I can't really be of much more help on your original Q. – slm Oct 18 '14 at 01:01