<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://linux-kvm.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rwh</id>
	<title>KVM - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://linux-kvm.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rwh"/>
	<link rel="alternate" type="text/html" href="https://linux-kvm.org/page/Special:Contributions/Rwh"/>
	<updated>2026-04-26T19:18:13Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.5</generator>
	<entry>
		<id>https://linux-kvm.org/index.php?title=SPICE&amp;diff=4521</id>
		<title>SPICE</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=SPICE&amp;diff=4521"/>
		<updated>2012-04-04T15:49:50Z</updated>

		<summary type="html">&lt;p&gt;Rwh: fix opening &amp;lt;code&amp;gt; tag&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Example using SPICE and QXL for improved Graphics experience in the guest ==&lt;br /&gt;
&lt;br /&gt;
This example is based on qemu-kvm (0.15.0) as installed in Fedora 15.&lt;br /&gt;
Will first show how to do this manually, and second how to do it using the virt-manager tool.&lt;br /&gt;
&lt;br /&gt;
For extensive details on SPICE, visit http://spice-space.org&lt;br /&gt;
&lt;br /&gt;
== Manually, using qemu-kvm command line directly ==&lt;br /&gt;
&lt;br /&gt;
The simplest part is adding the qxl graphics device to the guest.  By adding &amp;lt;code&amp;gt;-vga qxl&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 # /usr/bin/qemu-kvm -m 1024 -name f15 -drive file=/images/f15.img,if=virtio -vga qxl&lt;br /&gt;
&lt;br /&gt;
You&#039;ll see a normal SDL window pop up, and if you poke inside the guest you&#039;ll find that X is using the qxl device to display:&lt;br /&gt;
&lt;br /&gt;
 $ lspci&lt;br /&gt;
 ...&lt;br /&gt;
 00:02.0 VGA compatible controller: Red Hat, Inc. Device 0100 (rev 03)&lt;br /&gt;
&lt;br /&gt;
 $ grep QXL /var/log/Xorg.0.log&lt;br /&gt;
 [    15.878] (II) qxl: Driver for QXL virtual graphics: QXL 1&lt;br /&gt;
 &lt;br /&gt;
However, this is not enough to use SPICE.  We need to enable the spice server in qemu-kvm.  We also need a client to view the guest.  So first be sure the client is installed:&lt;br /&gt;
&lt;br /&gt;
 # yum install spice-client&lt;br /&gt;
&lt;br /&gt;
To keep it simple, we&#039;ll not require authentication and simply bind the server to 127.0.0.1 on port 5900.&lt;br /&gt;
&lt;br /&gt;
 # /usr/bin/qemu-kvm -m 1024 -name f15 -drive file=/images/f15.img,if=virtio -vga qxl  -spice port=5900,addr=127.0.0.1,disable-ticketing&lt;br /&gt;
&lt;br /&gt;
This will not pop up an SDL window, so launch the client to connect to the guest.&lt;br /&gt;
&lt;br /&gt;
 $ spicec -h 127.0.0.1 -p 5900&lt;br /&gt;
&lt;br /&gt;
We&#039;re getting closer.  Now the only thing left is to improve the experience by&lt;br /&gt;
enabling the spice agent communication channel between the host and the guest (you wanted copy and paste between host and guest right? ;)&lt;br /&gt;
&lt;br /&gt;
This part is a bit arcane.  We need to add a virtio-serial device to the guest, and open a port for the spice vdagent.  We also need to install the spice vdagent in guest.  Be sure the agent is running (and for future, started automatically).&lt;br /&gt;
&lt;br /&gt;
First the guest side, since the guest is running.&lt;br /&gt;
&lt;br /&gt;
 # yum install spice-vdagent&lt;br /&gt;
 # chkconfig --add spice-vdagentd&lt;br /&gt;
&lt;br /&gt;
Now stop the guest and we&#039;ll build up the hostside qemu-kvm commandline.&lt;br /&gt;
We need to add the virtio-serial device: &amp;lt;code&amp;gt;-device virtio-serial-pci&amp;lt;/code&amp;gt;&lt;br /&gt;
We need to add a port for spice in that device: &amp;lt;code&amp;gt;-device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0&amp;lt;/code&amp;gt;&lt;br /&gt;
And we need a spicevmc chardev for that port: &amp;lt;code&amp;gt;-chardev spicevmc,id=spicechannel0,name=vdagent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It&#039;s important that the virserialport &amp;lt;code&amp;gt;chardev=&amp;lt;/code&amp;gt; option matches the &amp;lt;cdoe&amp;gt;id=&amp;lt;/code&amp;gt; given the chardev (&amp;lt;code&amp;gt;spicechannel0&amp;lt;/code&amp;gt; in this example).  It&#039;s also important that the port&#039;s &amp;lt;code&amp;gt;name=&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;com.redhat.spice.0&amp;lt;/code&amp;gt;, because that&#039;s the namespace spice-vdagentd is looking for in the guest. And finally, you need to specify &amp;lt;code&amp;gt;name=vdagent&amp;lt;/code&amp;gt; so spice knows what this channel is for.&lt;br /&gt;
&lt;br /&gt;
So we launch the guest one last time with the complete command line:&lt;br /&gt;
&lt;br /&gt;
 # /usr/bin/qemu-kvm -m 1024 -name f15 -drive file=/images/f15.img,if=virtio -vga qxl -spice port=5900,addr=127.0.0.1,disable-ticketing -device virtio-serial-pci -device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 -chardev spicevmc,id=spicechannel0,name=vdagent&lt;br /&gt;
&lt;br /&gt;
And kick off a spice client:&lt;br /&gt;
&lt;br /&gt;
 $ spicec -h 127.0.0.1 -p 5900&lt;br /&gt;
&lt;br /&gt;
Now you can login to the guest, and you&#039;ll still see the qxl display device.  In addition, you&#039;ll see the virtio-serial port:&lt;br /&gt;
&lt;br /&gt;
 $ ls /dev/virtio-ports/&lt;br /&gt;
 com.redhat.spice.0&lt;br /&gt;
&lt;br /&gt;
Now test it out.  Grab some text and copy it to the clipboard in the guest.&lt;br /&gt;
(In gnome-terminal it&#039;s Shift-Ctrl-C to copy).  And paste it in the host (again, Shift-Ctrl-V to paste in gnome-terminal).&lt;br /&gt;
&lt;br /&gt;
== Enabling SPICE using virt-manager ==&lt;br /&gt;
&lt;br /&gt;
This assumes you&#039;ve already installed a guest with virt-manager or virt-install and it&#039;s shut off.&lt;br /&gt;
&lt;br /&gt;
Start virt-manager, and open your VM by double clicking on it.  Click the virtual hardware details (lightbulb).&lt;br /&gt;
&lt;br /&gt;
First we need to make the Video card a qxl device.  Click on Video, and in the Model pulldown, choose, qxl.  And Apply.&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshot-video-qxl.png]]&lt;br /&gt;
&lt;br /&gt;
Next we need to change the display from VNC to Spice.  Click on Display VNC, and in the Type pulldown, choose Spice.  And Apply.  You&#039;ll be prompted to add the Spice agent channels, click Yes. (notice the additional Controller Virtio Serial too).&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshot-display-Spice.png]]&lt;br /&gt;
&lt;br /&gt;
Now start the VM.  virt-manager has a spice-gtk client built-in.  So you don&#039;t need to fuss with a manual spice client like you did above.  You still need to be sure that the guest has spice-vdagent installed and running.  In the guest:&lt;br /&gt;
&lt;br /&gt;
 # yum install spice-vdagent&lt;br /&gt;
 # chkconfig --add spice-vdagentd&lt;br /&gt;
 # service start spice-vdagentd&lt;br /&gt;
 ... log out of X, and log back in, verify agent is running...&lt;br /&gt;
 $ ps -ef | grep vdagent&lt;br /&gt;
 root      1653     1  0 14:54 ?        00:00:00 /usr/sbin/spice-vdagentd&lt;br /&gt;
 gdm       1703     1  0 14:54 ?        00:00:00 /usr/bin/spice-vdagent&lt;br /&gt;
 chrisw    1932     1  0 14:55 ?        00:00:00 /usr/bin/spice-vdagent&lt;br /&gt;
&lt;br /&gt;
And you&#039;re done.  Test copy and paste and enjoy.&lt;/div&gt;</summary>
		<author><name>Rwh</name></author>
	</entry>
</feed>