KVM - The Linux Kernel-Based Virtual Machine
News, Blogs and Resources on the Linux (KVM) Kernel-Based Virtual Machine

Getting Started with SPICE on Fedora 12

If you’re running Fedora 12, getting started with SPICE is super easy. In this post I’ll demonstrate getting the most basic implementation working with Red Hat’s spice client that was released two days ago. Please note that because the windows binaries ( qxl drivers and agent ) have not been released yet you won’t be able to get the full SPICE experience using this procedure. According to the spice website these windows binaries are to be released soon. So let’s begin.

 

 

 

Install SPICE client , SPICE server and Qemu with SPICE backend

Fedora has made it very simple to setup the required dependencies to get spice client and server up and running. Again, I’ll re-emphasize that this is procedure currently only works if you’re running Fedora 12 on your KVM host. Install the spice repository using the following commands.

sudo wget -P /etc/yum.repos.d/ http://spice-space.org/download/spice.repo
sudo rpm --import http://spice-space.org/download/RPM-GPG-KEY-spice-fedora-12-x86_64

Next install the spice client and qemu packaged with the spice using the following commands.

sudo yum install spice-client
sudo yum install qemu-spice

Now you are ready to give spice client a test run.

 

Start up your qemu with the spice backend

For this part you can either install a new guest machine or you can use an existing disk image that you’ve already installed using kvm. The only additional options you really need in order to get this “spiced” version of qemu up and running is the –spice option as shown below. Note that this package installs the qemu spiced binary at /usr/libexec/qemu-spice .

/usr/libexec/qemu-spice \
-hda /var/lib/libvirt/images/Centos4-Devel.qcow2 \
-m 512 \
-qxl 1 \
-spice port=5930,disable-ticketing &

The –qxl option specifies the number of qxl display devices. You can safely use this option even without qxl drivers since it supports standard VGA even when no drivers are installed. The spice option disable-ticketing enables a spice client connection with no password. Because we are just trying to get a basic working implementation of spice client and server we won’t be using any passwords. The port number is the port the spice server will be listening on. In this case I used 5930. When you execute that command you’ll probably see lots out output to your terminal similar to below.

Don’t worry about this as it’s just status information.

 

Startup your spice client

Now you can startup your spice client using the following command assuming you installed the client and server on the same machine.

/usr/bin/spicec –h localhost –p  5930

If you installed client and server on separate machines then replace localhost with the ip address of your server. Now you’ll see your spice client window startup. Below is a snapshot of what your spice client window should look like.

 

 

NOTE: To release your cursor from the guest you need to use key combination of Shift+F12

If you’re curious about SPICE and you have a KVM host running Fedora, 12 go ahead and give this procedure a try. As mentioned earlier this is the most basic implementation and so you won’t get the full SPICE experience due to lack of qxl driver and guest agent availability. I think it would be nice to eventually see integration of spice into virt-manager but it might be some time before we see this due to the work involved. In any case you at least have the components to work with SPICE.
 

See Also

Comments

Impressive

Very impressive. Even with server and client on the same box, you can feel the improvement in responsiveness in the guest's GUI. Couldn't quite figure out how to leave the guests window again though: had to shutdown the guest to get the pointer back on my desktop :)

Darn slow on localhost for me

Maxim,

I ran it on a fast machine but it was very, very slow for me. It worked and I understand why it was slow. I find it strange that you were able to get the improvement in responsiveness?

Slow for me

Maxim,

It was darn slow for me on a very fast machine so I'm not sure how you were able to notice an improvement in responsiveness. I understand why it is slow though... because, as mentioned, some of its pieces aren't there so it is default to something slow just to work at all.

Thanks for posting though, it was fun to play with.

Release cursor from guest

 I updated to post to include the keystrokes needed to release your cursor from the guest. I had the same issue and specifically wanted to mention this but it slipped me somehow. Performance will be noticeably better if you use qxl drivers so we'll just have to wait until they're released.  

You need driver to make spice work fast

without the QXL driver installed, spice will render at the speed of qemu std-vga.

(No point in using it if not having the driver installed in the guest)

You can use RHEL /Centos 5

You can use RHEL /Centos 5 guest with the qxl driver:

http://rhn.redhat.com/errata/RHEA-2009-1308.html

are there a way to integrate

are there a way to integrate it to virt-manager?

I'm using remote server for hosting VMs. Would like to either patch virt-manager or config xmls in order to get spice work.

Re: are there a way to integrate

There upstream qemu developer community is currently discussing the integration of SPICE. A large part of the integration will have to happen there so it's going to be some time. There will probably have to be some kind of GTK widget for the client side (virt-manager) as well. If you're interested in the discussion you can read it at the following link.

http://lists.gnu.org/archive/html/qemu-devel/2009-12/msg01168.html 

It's quite a lengthy discussion but if you're interested in SPICE integration, it's a good read

 

Spice windows drivers were released

Now you can checkout spice with windows guests, huge improvment over working without the driver

Re: Spice windows drivers were released

 Thanks for the update. I caught the announcement and I'm almost finished writing a post about this.

Update: You can find the post at http://www.linux-kvm.com/content/rhev-spice-guest-drivers-released-windows

Re: release cursor correction

I've updated the post to correct typo for key combination to release the cursor. The correct key combination is

Shift + F12

Trouble Starting spicec

I had some trouble starting spicec with the command you stated here. It complained about unexpected positional arguments. Worked like a charm when i used --host and --port as arguments. Not documented at all so i thought i share my findings. Maybe someone else stumbled upon that.
Thx for the guide.

Re: Trouble Starting spicec

Out of curiosity, are you using Fedora or did you manually install the client?

Re: Re: Trouble Starting spicec

i am using fedora 12, used the yum way illustrated above.
Its running fine now, btw. Installed the windows drivers, works like a charm. Win7 "performance measures" give almost bare metal results, except graphics.

Still can't get the qxl

Still can't get the qxl driver working. Installed, still poor performance. Any ideas? What about ubuntu?

Send ctrl-alt-del

Does anyone know how to send ctrl-alt-del to a Windows guest from within the spicec window ?
Thanks

re: send ctrl-alt-del

You should have access to the monitor by typing ctrl-alt-2 then use the sendkeys command.

That isn't working because i

That isn't working because i have a putty connection to the spice fedora 12 server. In this connection i start the guest via /usr/libexec/qemu-spice -hda /kvm/images/XXX.qcow2 -m 512 -qxl 1 -spice port=5930,disable-ticketing &.
after this i start the spicec from my putty windows via /usr/bin/spicec -h localhost -p 5930. The Window appear as a remote x11 windows on my windows xp. Now the question again, how can i send the ctrl-alt-del combination.
Thanks

Re: That isn't working because

In that case you need to add the following monitor option when starting up your guest virtual machine

-monitor telnet::4444,server,nowait 

With this option you can access the guest monitor across the network. See the following post for more information on this.

http://www.linux-kvm.com/content/two-ways-access-your-virtual-machine-monitor-across-network

Fedora

Thanks for the info and the brief tutorial. I am working with Linux and Fedora for quite some time now and I think Spice is definitely worth trying. I also do my webhosting activities at http://www.ixwebhosting.com/ on a Linux server and Spice could be a helpful tool for my everyday work. I'll give it a try and will come back if any questions or problems occur.

Re: Fedora

Lewal,

Do you know if your hosting provider offers KVM as a solution?

/usr/libexec/qemu-spice command doesn't work

GuestOS is already running.

Command:

/usr/libexec/qemu-spice -sdc /vol/windows7.img -m 800 -qxl 1 -spice port=5930,disable-ticketing -usb -usbdevice table

Error:
/usr/libexec/qemu-spice: error while loading shared libraries: libspice.so.0: cannot open shared object file: No such file or directory

Is there anything I have to check?

Re: qemu-spice command doesn't work

Are you running Fedora 12? What is the output of the following comand?

ldd /usr/libexec/qemu-spice 

If you're running Fedora 12 you shouldn't have to do anything unless this is a more recent version of qemu-spice with some kind of bug.

This is not Fedora 12, it is

This is not Fedora 12, it is running Fedora 14.

there is no qemu-spice on Fedora 14, so what command should be used instead.

do command qemu like this

Reference:
http://fedoraproject.org/wiki/Features/Spice#Scope

qemu -drive /home/store/Windows7.img -soundhw ac97 -vga qxl -spice port=5930,disable-ticketing -enable-kvm

do_spice_init: starting 0.6.3
spice_server_add_interface: SPICE_INTERFACE_KEYBOARD
spice_server_add_interface: SPICE_INTERFACE_MOUSE
mouse_mode_notifier: absolute pointer: not available
spice_server_add_interface: SPICE_INTERFACE_QXL
red_worker_main: begin
spice_server_add_interface: SPICE_INTERFACE_RECORD
spice_server_add_interface: SPICE_INTERFACE_PLAYBACK
handle_dev_destroy_surfaces:
handle_dev_input: start

Never move at this point.

SPICE on Fedora 14

In that case you need to use the command /usr/bin/qemu-kvm

First thing you need to do is remove the repository described in this post since Fedora 14 now includes these packages. Next you need to install the following packages

  • qemu-kvm
  • spice-protocol
  • spice-server
  • spice-client

then try running your vm again.

RE: SPICE on Fedora 14

Running on Fedora14
Install qemu-kvm, spice-server, spice-client, spice-protocol
Setup GuestOS with WindowsXP, Windows7
Format type is raw, not qcow2

[root@fedora1402 ~]# /usr/bin/qemu-kvm -drive file=/kvm/winxp2.img -vga qxl -spice port=5930,disable-ticketing -enable-kvm
do_spice_init: starting 0.6.3
spice_server_add_interface: SPICE_INTERFACE_KEYBOARD
spice_server_add_interface: SPICE_INTERFACE_MOUSE
mouse_mode_notifier: absolute pointer: not available
spice_server_add_interface: SPICE_INTERFACE_QXL
red_worker_main: begin
handle_dev_destroy_surfaces:
handle_dev_input: start

Never changed the status since it was reinstalled many times.

Is there anything I am wrong??

Re: SPICE on Fedora 14

Output looks ok.  After this, what happens when you open another terminal as your user ( not root ) and run the following command?

spicec -h localhost -p 5930 

You should see something...

Hi! I'm trying to run windows

Hi!
I'm trying to run windows on kvm with spice drivers on my fedora now but I've got a problem.
When I normal run windows (with wirtual machine manager) everything is ok, but windows is soooo sloowww, - mouse is moving about 10 fps :/ )
I heard that kvm is the fastest way to
I'm doing everything as is described on this page:
http://www.linux-kvm.com/content/rhe...leased-windows
and after I write command in termianl (even as root):

/usr/libexec/qemu-spice \
-hda /home/virt/w7.img \
-m 1024 \
-qxl 1 \
-spice port=5930,disable-ticketing &

then I've got the same output in my terminal as the author, but ... nothing happens next - I cannot wrote nothing in console - it's like hanged (of course i can ctrl+c)
When I run then system with virt machine manager - it behaves normal - it doesn't discover any new devices (as it should - on those site was described, it should).

What should I do?
(Is it true that kvm with spice is a lot faster than vmware?)
regards
NS0-163 dumps

Post new comment

The content of this field is kept private and will not be shown publicly.
Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.