lost and found ( for me ? )

Linux Mint 12 : use KVM SPICE


Here’s an explanation of how to use SPICE on Linux Mint.

# uname -ri
3.0.0-14-generic x86_64

# tail -1 /etc/lsb-release
DISTRIB_DESCRIPTION="Linux Mint 12 Lisa"

at first , install KVM from the default repository
# apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils virt-manager -y

# kvm --version
QEMU emulator version 0.14.1 (qemu-kvm-0.14.1), Copyright (c) 2003-2008 Fabrice Bellard

# libvirtd --version
libvirtd (libvirt) 0.9.2

# LANG=C apt-cache policy qemu-kvm
qemu-kvm:
 Installed: 0.14.1+noroms-0ubuntu6
 Candidate: 0.14.1+noroms-0ubuntu6
 Version table:
*** 0.14.1+noroms-0ubuntu6 0
       500 http://archive.ubuntu.com/ubuntu/ oneiric/main amd64 Packages
       100 /var/lib/dpkg/status

# LANG=C apt-cache policy libvirt-bin
libvirt-bin:
 Installed: 0.9.2-4ubuntu15.1
 Candidate: 0.9.2-4ubuntu15.1
 Version table:
*** 0.9.2-4ubuntu15.1 0
       500 http://archive.ubuntu.com/ubuntu/ oneiric-updates/main amd64 Packages
       100 /var/lib/dpkg/status
    0.9.2-4ubuntu15 0
       500 http://archive.ubuntu.com/ubuntu/ oneiric/main amd64 Packages

add the repository for SPICE support
# add-apt-repository ppa:bderzhavets/qemu-git
You are about to add the following PPA to your system:
Qemu-kvm 0.15.0 and Spice on Ubuntu 11.10
Installed and tested to work on Ubuntu Oneiric Alpha 3 and daily build 08/14/11


upgrade KVM related packages.
# apt-get update ;apt-get upgrade –y
以下のパッケージは保留されます:
 qemu-kvm
以下のパッケージはアップグレードされます:
 libvirt-bin libvirt0 python-libvirt qemu-common


install SPICE packages and upgrade qemu-kvm
# LANG=C apt-get install qemu-kvm qemu qemu-common libspice-client libs
pice-client-dev libspicegtk3-client libspicegtk3-client-dev spice libspice-proto
col-dev spicegtk3-client
Reading package lists... Done
Building dependency tree
Reading state information... Done
qemu-common is already the newest version.
qemu-common set to manually installed.
The following extra packages will be installed:
 libcegui-mk2-1 libcelt051 libdevil1c2 libfreeimage3 libspice-server
 libxerces-c28
The following NEW packages will be installed:
 libcegui-mk2-1 libcelt051 libdevil1c2 libfreeimage3 libspice-client
 libspice-client-dev libspice-protocol-dev libspice-server
 libspicegtk3-client libspicegtk3-client-dev libxerces-c28 qemu spice
 spicegtk3-client
The following packages will be upgraded:
 qemu-kvm

# LANG=C apt-cache policy qemu-kvm
qemu-kvm:
 Installed: 081011-2ubuntu9
 Candidate: 081011-2ubuntu9
 Version table:
*** 081011-2ubuntu9 0
       500 http://ppa.launchpad.net/bderzhavets/qemu-git/ubuntu/ oneiric/main amd64 Packages
       100 /var/lib/dpkg/status
    0.14.1+noroms-0ubuntu6 0
       500 http://archive.ubuntu.com/ubuntu/ oneiric/main amd64 Packages

# LANG=C apt-cache policy libvirt-bin
libvirt-bin:
 Installed: 0.9.2-5ubuntu15
 Candidate: 0.9.2-5ubuntu15
 Version table:
*** 0.9.2-5ubuntu15 0
       500 http://ppa.launchpad.net/bderzhavets/qemu-git/ubuntu/ oneiric/main amd64 Packages
       100 /var/lib/dpkg/status
    0.9.2-4ubuntu15.1 0
       500 http://archive.ubuntu.com/ubuntu/ oneiric-updates/main amd64 Packages
    0.9.2-4ubuntu15 0
       500 http://archive.ubuntu.com/ubuntu/ oneiric/main amd64 Packages


reboot the OS
# reboot


check the installed version
# kvm --version
QEMU emulator version 0.15.0 (qemu-kvm-devel), Copyright (c) 2003-2008 Fabrice Bellard

# libvirtd --version
libvirtd (libvirt) 0.9.2

Now you can use SPICE.
virt-manger -> change Display setting from VNC to SPICE


You can change the display from VNC to SPICE by editing *.xml file.

add the following lines.
   <channel type='spicevmc'>
     <target type='virtio' name='com.redhat.spice.0'/>
     <address type='virtio-serial' controller='0' bus='0' port='1'/>
   </channel>


change the following line:

from
<graphics type='vnc' port='-1' autoport='yes'/>

to
<graphics type='spice' autoport='yes' keymap='ja'/>

# diff spice.centos6-1.xml vnc.centos6-1.xml
60,63d59
<     <channel type='spicevmc'>
<       <target type='virtio' name='com.redhat.spice.0'/>
<       <address type='virtio-serial' controller='0' bus='0' port='1'/>
<     </channel>
66c62
<     <graphics type='spice' autoport='yes' keymap='ja'/>
---
>     <graphics type='vnc' port='-1' autoport='yes'/>


start the VM ( CentOS 6.2 )
# LANG=C virsh start centos6-1
Domain centos6-1 started

# ps aux | grep spice
116       7706 13.4  3.1 1381600 389940 ?      Sl   18:26   0:16 /usr/bin/kvm -S -M pc-0.14 -enable-kvm -m 1024 -smp 1,maxcpus=4,sockets=4,cores=1,threads=1 -name centos6-1 -uuid 4cbf3421-bb8e-0d3c-e71b-d8cb29aa588d -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/centos6-1.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -rtc base=utc -boot order=c,menu=on -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x4 -drive file=/var/disk1/libvirt/images/centos6-1.img,if=none,id=drive-virtio-disk0,boot=on,format=raw -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=20,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:d2:28:33,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -usb -device usb-tablet,id=input0 -spice port=5900,addr=127.0.0.1,disable-ticketing -k ja -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6


connect to the VM via spice-client
virsh # qemu-monitor-command centos6-1 'info spice'
Server:
    address: 127.0.0.1:5900
       auth: none
Channel:
    address: 127.0.0.1:44959
    session: 719885386
    channel: 1:0
Channel:
    address: 127.0.0.1:44960
    session: 719885386
    channel: 4:0
Channel:
    address: 127.0.0.1:44961
    session: 719885386
    channel: 2:0
Channel:
    address: 127.0.0.1:44962
    session: 719885386
    channel: 3:0


on the KVM machine ( Linux Mint ) , start spice client.
$ spicec –h 127.0.0.1 –p 5900

3 comments:

  1. Thank you, thank you, thank you!!

    ReplyDelete
  2. thank you for your comment
    my pleasure :D

    ReplyDelete
  3. thank you for your comment
    my pleasure :D

    ReplyDelete

Note: Only a member of this blog may post a comment.