Latest Tweets

Installing and using RAVADAVDI on Debian Jessie

Introducing RAVADAVDI

This is an incredible effort to bring the power of VDI to you using only open source libraries and tools. It is mainly developed in PERL 5, and it relies on KVM for virtualization, and Spice for sound, I/O and graphics. Of course, there’s still a lot of things to polish, such as increasing its security: it does not implement any sort of encryption save for TLS on the ravadavdi web framework part (by means of using Apache, for example). The way the user authenticates against the Spice remote server is poor; only a 4-character pseudo-random password easily prone to brute-forcing. But this is a start, and a hell of a start indeed! I’ve been testing this whole framework myself and I have to admit that I am impressed. Thus, I was a bit disappointed at discovering that it did not work out out-of-the-box on Debian systems. The installation is really easy, but only if you are deploying this solution on Ubuntu-based distros. A pitty. So I decided to have a look into it and make it work for Debian Jessie.

First Issue: MySQL version < 5.6

You can follow the instructions and install the framework on your Debian Jessie box up until the “Ravada Web User” section (http://ravada.readthedocs.io/en/latest/docs/INSTALL.html). Debian Jessie ships with MySQL 5.55.084, and according to RAVADAVDI documentation, MySQL 5.6 is required. But in fact, it does not use anything from MySQL 5.6 that is not present on MySQL 5.55, so you can still use this framework without the pain of updating your MySQL version. MySQL 5.55 does not implement a DEFAULT value for DATETIME fields; therefore if you try to add a new user using the rvd_back perl script, you will get an error:

rvd_back –add-user lud.test
INFO: creating table messages
DBD::mysql::db do failed: Invalid default value for ‘date_send’ at /usr/share/perl5/Ravada.pm line 276.

You need to replace the field “date_send” in the table “messages”, which is of type DATETIME,  with  TIMESTAMP. TIMESTAMP fields in MySQL 5.55 does implement a DEFAULT value:

CREATE TABLE `messages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_user` int(11) NOT NULL,
`id_request` int(11),
`subject` varchar(120) DEFAULT NULL,
`message` text,
`date_send` timestamp default now(),
`date_shown` datetime,
`date_read` datetime,
PRIMARY KEY (`id`),
KEY `id_user` (`id_user`)

Use your favourite ASCII editor and make this small alteration in the file /usr/share/doc/ravada/sql/mysql/messages.sql.

Second Issue: no kvm-spice binary

Reading the RAVADAVDI documentation we notice:

Debian jessie has been tried but kvm spice wasn’t available there, so it won’t work.

which is not true at all. Spice is already available on Debian Jessie. All you need to do in order to test that is to run the strings command on the kvm binary in Debian Jessie:

cat /usr/bin/kvm
#! /bin/sh
exec qemu-system-x86_64 -enable-kvm “$@”

strings /usr/bin/qemu-x86_64-static |grep spice
spicevmc
spiceport
qemu_spice_create_update
qemu_spice_wakeup
qemu_spice_del_memslot
qemu_spice_add_memslot
qxl_spice_update_area_rest
qxl_spice_update_area
qxl_spice_reset_memslots
qxl_spice_reset_image_cache
qxl_spice_reset_cursor
qxl_spice_oom
qxl_spice_loadvm_commands
qxl_spice_monitors_config
qxl_spice_destroy_surfaces
spice_vmc_event
spice_vmc_register_interface
spice_vmc_read
spice_vmc_write
qemu_spice_destroy_primary_surface
qemu_spice_create_primary_surface
qxl_spice_flush_surfaces_async
qxl_spice_destroy_surface_wait
qxl_spice_destroy_surface_wait_complete
qxl_spice_destroy_surfaces_complete
spice_vmc_unregister_interface

So, Debian Jessie does have spice support on the qemu-kvm package. The problem here is that on Ubuntu systems, there’s a file /usr/bin/kvm-spice, whereas on Debian Jessie there isn’t. To fix this, you can create a symlink and be done with it:

# ln -s /usr/bin/kvm /usr/bin/kvm-spice

Third issue: “persistent update of device ‘graphics’ is not supported”

This is a reported and well-know issue of libvirt0. The workaround on Debian Jessie systems is to add the backports repository and install spice from it:

apt-get -t jessie-backports install libvirt0

After that, make sure you have the right version running on your system:

apt-cache madison libvirt0
libvirt0 | 3.0.0-4~bpo8+1 | http://ftp.es.debian.org/debian/ jessie-backports/main amd64 Packages
libvirt0 | 3.0.0-4~bpo8+1 | http://http.debian.net/debian/ jessie-backports/main amd64 Packages
libvirt0 | 3.0.0-4~bpo8+1 | http://http.debian.net/debian/ jessie-backports/main amd64 Packages
libvirt0 | 1.2.9-9+deb8u4 | http://ftp2.fr.debian.org/debian/ jessie/main amd64 Packages
libvirt0 | 1.2.9-9+deb8u3 | http://security.debian.org/ jessie/updates/main amd64 Packages
libvirt | 1.2.9-9+deb8u4 | http://ftp2.fr.debian.org/debian/ jessie/main Sources
libvirt | 1.2.9-9+deb8u3 | http://security.debian.org/ jessie/updates/main Sources

You should have version 3.0.0-4 instead of 1.2.9-9.

Four issue: “Unsupported machine type”

Finally, whenever starting a new VDI you will get this error:

ERROR starting domain status:’done’ ( libvirt error code: 1, message: internal error: process exited while connecting to monitor: redir -device usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=1 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 -msg timestamp=on (process:29263): GLib-WARNING **: /build/glib2.0-ETetDu/glib2.0-2.48.0/./glib/gmem.c:483: custom memory allocation vtable not supported qemu-system-x86_64: -machine pc-i440fx-xenial,accel=kvm,usb=off,dump-guest-core=off: Unsupported machine type Use -machine help to list supported machines! )

Crystal clear: the -machine argument passed to every single machine defined using the proper XML files are Ubuntu-based. So you have to edit these files and use the right -machine flag for your Debian Jessie distro. For example, edit the “Debian Jessie AMD64” VM XML definition file and replace pc-i440fx-xenial with pc-i440fx-2.1:

vi /var/lib/ravada/xml/jessie-amd64.xml

<type arch=’x86_64′ machine=’pc-i440fx-2.1′>hvm</type>

Of course, you can do as suggested in the error message and get a list of valid machines by issuing:

kvm -machine help

Conclussions

It is quick and easy to make RAVADAVDI work on Debian Jessie. And it is better to use Debian than Ubuntu most of the time. So now, following these instructions, you can also benefit from this incredible work and start using an open-source  VDI framework right away on your amazing Debian GNU/Linux distro!