Rebuild Spice-Gtk-0.7 via Debian Unstable with gobject-introspection enabled

August 20, 2011

Following bellow seems to be the best way to implement Qemu-kvm 0.15.0 spice enabled, Spice Server 0.8.2 and Spice-Gtk-0.7 with GObject-introspection enabled on Ubuntu 11.10 in meantime close to Beta 1. It’s based on PPA Building Spice-Gtk-0.7 via Debian Unstable with Gobject-introspection enabled published on 08/20/11. The original version of Spice-Gtk-0.7-2 came from Debian Unstable didn’t support GObject-introspection. Original version 0.7-2 was not supposed to install files like *.gir and *.typelib. View projects /collab-maint/spice-gtk.git/ summary.It also clearly shows that introspection went into Git Repo on 09/01/11. View [2] also regarding this issue.
Original version 0.7-2 also required fixes for debian/control and debian/rules. To understand better why this step should be undertaken, please , view Introspection Overivew

Now I feel myself like a detective whose 4 weeks old case, somebody wants to drop. It’s really funny, because lack of understanding GObject-introspection when porting Spice-Gtk-0.7 from F16 do Debian (Ubuntu) is not a crime.

Moreover file http://mentors.debian.net/debian/pool/main/s/spice-gtk/spice-gtk_0.7-2.dsc ( been located at http://mentors.debian.net/package/spice-gtk) doesn’t exist on the Net any longer,which has been used by myself for :
$ dget -x http://mentors.debian.net/debian/pool/main/s/spice-gtk/spice-gtk_0.7-2.dsc
$ dpkg-source -x spice-gtk_0.7-2.dsc

and spice-gtk-0.7-2 was a base I used to rebuild debian packages with introspection enabled, view my PPA
“Building Spice-Gtk-0.7 via Debian Unstable with gobject-introspection enabled”. It means I did it on my own . Everything had been done by myself from scratch.
I really did it from scratch but in different way and at different time. View another my PPA : Qemu-kvm 0.15.0 and Spice on Ubuntu 11.10 as of 08/10/11 and my article at LinuxToday Set up Spice-Gtk-0.7 on Ubuntu 11.10
***********************************************************
Now back to rebuild spice-gtk-0.7-2 done on 08/20/11 :-
***********************************************************
Port Debian Unstable Spice Server (been built with embedded libcelt051) to Ubuntu 11.10.
$ dget -x http://mentors.debian.net/debian/pool/main/s/spice/spice_0.8.2-2.dsc
$ dpkg-source -x spice_0.8.2-2.dsc
Port Debian Unstable version of Spice-Gtk-0.7 to Ubuntu 11.10.
$ dget -x http://mentors.debian.net/debian/pool/main/s/spice-gtk/spice-gtk_0.7-2.dsc
$ dpkg-source -x spice-gtk_0.7-2.dsc
It requires rebuild to enable gobject-introspection,which was done in PPA “Building Spice-Gtk-0.7 via Debian Unstable with gobject-introspection enabled” for Ubuntu 11.10.

Details may be viewed here :
Building Spice-Gtk-0.7 via Debian Unstable with gobject-introspection enabled

In particular,

1. Added –enable-introspection to debian/rules dh_auto_configure.

dh_auto_configure -B/build/buildd/spice-gtk-0.7/build-gtk3 -- \
--enable-smartcard=no --with-gtk=3.0 --disable-static --enable-introspection


dh_auto_configure -- \
--enable-smartcard=no --with-gtk=2.0 --disable-static --enable-introspection

2. Updated debian/control and added required dependencies

Build-Depends:
debhelper (>= 8.0.0),
libspice-protocol-dev (>= 0.8.1),
libspice-server-dev,
libpixman-1-dev (>= 0.17.7),
libgtk2.0-dev,
libgtk-3-dev,
libglib2.0-dev (>= 2.22),
libcairo2-dev (>= 1.2.0),
libpulse-dev,
python2.7,
python-gtk2-dev (>= 2.0.0),
python-pyparsing,
intltool,
libsasl2-dev,
libjpeg8-dev,
gobject-introspection, <=
libgirepository1.0-dev <=

The last two lines have been added.

3.Several debian/package_name.install files have been updated by adding right full path to corresponding library to accommodate installation of :-

/usr/lib/girepository-1.0/SpiceClientGLib-2.0.typelib
/usr/lib/girepository-1.0/SpiceClientGtk-2.0.typelib
/usr/lib/girepository-1.0/SpiceClientGtk-3.0.typelib
/usr/share/gir-1.0/SpiceClientGLib-2.0.gir
/usr/share/gir-1.0/SpiceClientGtk-3.0.gir

which otherwise won’t be installed.

Added to libspice-client-glib-2.0-4.install
line usr/lib/girepository-1.0/SpiceClientGLib-2.0.typelib

Added to libspice-client-gtk-2.0-1.install
line usr/lib/girepository-1.0/SpiceClientGtk-2.0.typelib

Added to libspice-client-gtk-3.0-1.install
line usr/lib/girepository-1.0/SpiceClientGtk-3.0.typelib

Added to libspice-client-glib-2.0-dev.install
line usr/share/gir-1.0/SpiceClientGLib-2.0.gir

Added to libspice-client-gtk-3.0-dev.install
line usr/share/gir-1.0/SpiceClientGtk-3.0.gir

Qemu-kvm 0.15.0 was built with changed dependencies in the same PPA
Packages from https://launchpad.net/~bderzhavets/+archive/test-deb2 installed with no conflicts on Oneiric daily build 08/27/11. Spice sessions (via VirtManager) in QXL mode (64M vram) for install and for runtime have been run. The most recent snapshot for seabios supporting 64M vram for QXL device
uploaded to ppa:bderzhavets/test-deb2, ppa:bderzhavets/test-deb1

To install packages from PPA

$ sudo add-apt-repository ppa:bderzhavet/test-deb2
$ sudo apt-get update
$ sudo apt-get install qemu-kvm qemu qemu-common \
libspice-client-glib-2.0-4 libspice-client-glib-2.0-dev \
libspice-client-gtk-2.0-1 libspice-client-gtk-2.0-dev \
libspice-client-gtk-3.0-1 libspice-client-gtk-3.0-dev \
python-spice-client-gtk spice-client-gtk spice-client \
seabios

$ sudo apt-get install virtinst virt-manager virt-viewer

You might have to disable apparmor profile for libvirtd

$ sudo ln -s /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable/
$ sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.libvirtd
$ sudo adduser $USER kvm
$ sudo reboot







References
1. http://mentors.debian.net/package/spice-gtk
2. http://www.mail-archive.com/ubuntu-bugs@lists.ubuntu.com/msg3124003.html


Build Xen 4.1.1(2-rc1,2-rc2,2-rc3) on Ubuntu 11.10 and set up HVM via virt-manager

July 23, 2011

*****************************************************************************************
UPDATE on 10/25/11 Xen 4.1.2 with pygrub gpt support for Ubuntu 11.10 (virt-install fedora 16(TC1) works for me).
View PPA Xen 4.1.2 with pygrub gpt support for Ubuntu 11.10.
Attention, vif entry for HVM domains should look like :-

vif = [ 'type=ioemu, bridge=br0, model='e1000']

Then absence of Ubuntu’s patch xen-pirq-resubmit-irq.patch from official package is not important. Same entry for PV-on-HVM domains should look like :-

vif = [ 'bridge=br0, model='e1000']

Details may be viewed PV-on-HVM domains at Xen 4.1.2 Ubuntu Oneiric Dom0
I’ve also tested this hypervisor with 3.1.0-030100-generic. The last kernel has PCI_BACKEND implemented.
UPDATE on 10/21/11 Xen 4.1.2 for Ubuntu 11.10.
View PPA Xen 4.1.2 for Ubuntu 11.10.
UPDATE on 09/15/11 Xen 4.1.2-rc2 for Ubuntu 11.10.
View PPA Xen 4.1.2-rc2 for Ubuntu 11.10.
UPDATE on 08/26/11 Build Xen 4.1.2-rc1 for Ubuntu 11.10.
View PPA Build Xen 4.1.2-rc1 for Ubuntu 11.10
How to build Xen 4.1.2 on Launchpad on your own
******************************************************************************************
Patch changeset-23104 from xen-4.1-testing.hg (changeset 23104:1976adbf2b80) has been applied to fix build “hvmloader” by GCC 4.6. View thread @xen-devel (Posts #11,14,15,18) ([1]). Packages, ready to go, uploaded to PPA Xen 4.1.1 on Ubuntu 11.10. Workaround connected with ERROR: Domain not found: xenUnifiedDomainLookupByName when attempt to set up HVM DomU via virt-manager is also described in details. Build is based on https://launchpad.net/ubuntu/+source/xen/4.1.1-1ubuntu1
Now run :-
# apt-add-repository ppa:bderzhavets/xen-hg
# apt-get update
# apt-get install synaptic
Install Xen 4.1.1 Hypervisor (4.1.1-1ubuntu3) and tools via Synaptic Manager.



Add to /etc/modules :-

xen-gntdev
xen-blkback
xen-netback

Reboot into Xen environment

root@boris-System-P5Q3:~# xl info
host : boris-System-P5Q3
release : 3.0.0-6-generic
version : #7-Ubuntu SMP Wed Jul 20 13:53:04 UTC 2011
machine : x86_64
nr_cpus : 4
nr_nodes : 1
cores_per_socket : 4
threads_per_core : 1
cpu_mhz : 2833
hw_caps : bfebfbff:20100800:00000000:00000940:0008e3fd:00000000:00000001:00000000
virt_caps : hvm
total_memory : 8190
free_memory : 2052
free_cpus : 0
xen_major : 4
xen_minor : 1
xen_extra : .1
xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
xen_scheduler : credit
xen_pagesize : 4096
platform_params : virt_start=0xffff800000000000
xen_changeset : unavailable
xen_commandline : placeholder
cc_compiler : gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-5ubuntu1)
cc_compile_by : bderzhavets
cc_compile_domain : yahoo.com
cc_compile_date : Sun Jul 24 12:24:37 UTC 2011
xend_config_format : 4

Also make sure :-

root@boris-System-P5Q3:~# ls -l /dev/xen
total 0
crw------- 1 root root 10, 55 2011-07-25 10:31 evtchn
crw------- 1 root root 10, 56 2011-07-25 10:31 gntdev
root@boris-System-P5Q3:~# lsmod | grep xen
xen_evtchn 13172 1
xenfs 18311 1
xen_blkback 23177 0 [permanent]
xen_netback 27854 0 [permanent]
xen_gntdev 17676 0

If you are missing at least one device under /dev/xen or lsmod doesn’t show all mentioned drivers, yours system won’t be functional.
Create HVM DomU via standard python profile. You should be able complete the task with no problem. Next step would be fixing bug with virtinst tools and install HVM Ubuntu 10.04.3 via virt-manager or virt-install. Installation via virt-manager is much easier and allows create Ubuntu 10.04.3 PV DomU via XML profiling and command “virsh define” in several minutes.




Next to activate Libvirt 0.9.2 and virtinst tools :-

# apt-get install virtinst virt-viewer virt-manager

Comment out (xend-unix-server yes) in /etc/xen/xend-config.sxp and export variable

export VIRSH_DEFAULT_CONNECT_URI="xen:///"

in root’s .bashrc. Then restart xend service
Attempt to run :-

# virt-install --connect xen:/// --debug -n LynxHVM --hvm -r 1024 --vcpus=1 \
-f /dev/sda7 --vnc \
-c /root/Downloads/ubuntu-10.04.3-desktop-amd64.iso


Generates an error

Mon, 25 Jul 2011 10:58:45 ERROR Domain not found: xenUnifiedDomainLookupByName
Mon, 25 Jul 2011 10:58:45 DEBUG Traceback (most recent call last):
File “/usr/bin/virt-install”, line 1079, in start_install
dom = guest.start_install(conscb, meter, wait=wait_on_console)
File “/usr/lib/pymodules/python2.7/virtinst/Guest.py”, line 1187, in start_install
start_xml, final_xml, is_initial)
File “/usr/lib/pymodules/python2.7/virtinst/Guest.py”, line 1246, in _create_guest
dom = self.conn.createLinux(start_xml or final_xml, 0)
File “/usr/lib/python2.7/dist-packages/libvirt.py”, line 1686, in createLinux
if ret is None:raise libvirtError(‘virDomainCreateLinux() failed’, conn=self)
libvirtError: Domain not found: xenUnifiedDomainLookupByName

/var/log/xen/qemu-dm-LNX.log reports

/usr/lib64/xen/bin/qemu-dm: error while loading shared libraries: libxenctrl.so: cannot open shared object file: No such file or directory

To fix this failure :

root@boris-System-P5Q3:/usr/lib64/xen-4.1# cp -R lib /usr/lib64/xen
root@boris-System-P5Q3:/usr/lib64/xen-4.1# cp -R boot /usr/lib64/xen
root@boris-System-P5Q3:/usr/lib64/xen-4.1# cp -R bin /usr/lib64/xen







Normal virt-install :
root@boris-System-P5Q3:~# virt-install –connect xen:/// –debug -n LynxHVM –hvm -r 1024 –vcpus=1 -f /dev/sda7 –vnc -c /root/Downloads/ubuntu-10.04.3-desktop-amd64.iso
Mon, 25 Jul 2011 11:07:40 DEBUG Launched with command line:
/usr/bin/virt-install –connect xen:/// –debug -n LynxHVM –hvm -r 1024 –vcpus=1 -f /dev/sda7 –vnc -c /root/Downloads/ubuntu-10.04.3-desktop-amd64.iso
Mon, 25 Jul 2011 11:07:40 DEBUG Requesting libvirt URI xen:///
Mon, 25 Jul 2011 11:07:40 DEBUG Received libvirt URI xen:///
Mon, 25 Jul 2011 11:07:40 DEBUG Requesting virt method ‘hvm’, hv type ‘default’.
Mon, 25 Jul 2011 11:07:40 DEBUG Received virt method ‘hvm’
Mon, 25 Jul 2011 11:07:40 DEBUG Hypervisor name is ‘xen’
Mon, 25 Jul 2011 11:07:40 DEBUG DistroInstaller location is a local file/path: /root/Downloads/ubuntu-10.04.3-desktop-amd64.iso
Mon, 25 Jul 2011 11:07:40 DEBUG Guest.has_install_phase: True

Starting install…
Mon, 25 Jul 2011 11:07:40 DEBUG Could not open “/etc/sysconfig/keyboard” [Errno 2] No such file or directory: ‘/etc/sysconfig/keyboard’
Mon, 25 Jul 2011 11:07:40 DEBUG Could not open “/etc/X11/xorg.conf”: [Errno 2] No such file or directory: ‘/etc/X11/xorg.conf’
Mon, 25 Jul 2011 11:07:40 DEBUG Could not open “/etc/sysconfig/keyboard” [Errno 2] No such file or directory: ‘/etc/sysconfig/keyboard’
Mon, 25 Jul 2011 11:07:40 DEBUG Could not open “/etc/X11/xorg.conf”: [Errno 2] No such file or directory: ‘/etc/X11/xorg.conf’
Mon, 25 Jul 2011 11:07:40 DEBUG Generated install XML:
<domain type=’xen’>
<name>LynxHVM</name>
<currentMemory>1048576</currentMemory>
<memory>1048576</memory>
<uuid>c4e2746f-bc7c-17ef-84e4-e37defc696d3</uuid>
<os>
<type arch=’x86_64′>hvm</type>
<loader>/usr/lib/xen-default/boot/hvmloader</loader>
<boot dev=’cdrom’/>
<boot dev=’hd’/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<clock offset=”utc”/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<vcpu>1</vcpu>
<devices>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<disk type=’block’ device=’disk’>
<source dev=’/dev/sda7’/>
<target dev=’hda’ bus=’ide’/>
</disk>
<disk type=’file’ device=’cdrom’>
<source file=’/root/Downloads/ubuntu-10.04.3-desktop-amd64.iso’/>
<target dev=’hdc’ bus=’ide’/>
<readonly/>
</disk>
<interface type=’bridge’>
<source bridge=’br0’/>
<mac address=’00:16:3e:6d:9c:aa’/>
</interface>
<input type=’mouse’ bus=’ps2’/>
<graphics type=’vnc’ port=’-1′ keymap=’en-us’/>
<console type=’pty’/>
<video>
<model type=’cirrus’/>
</video>
</devices>
</domain>

Mon, 25 Jul 2011 11:07:40 DEBUG Generated boot XML:
<domain type=’xen’>
<name>LynxHVM</name>
<currentMemory>1048576</currentMemory>
<memory>1048576</memory>
<uuid>c4e2746f-bc7c-17ef-84e4-e37defc696d3</uuid>
<os>
<type arch=’x86_64′>hvm</type>
<loader>/usr/lib/xen-default/boot/hvmloader</loader>
<boot dev=’hd’/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<clock offset=”utc”/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<vcpu>1</vcpu>
<devices>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<disk type=’block’ device=’disk’>
<source dev=’/dev/sda7’/>
<target dev=’hda’ bus=’ide’/>
</disk>
<disk type=’block’ device=’cdrom’>
<target dev=’hdc’ bus=’ide’/>
<readonly/>
</disk>
<interface type=’bridge’>
<source bridge=’br0’/>
<mac address=’00:16:3e:6d:9c:aa’/>
</interface>
<input type=’mouse’ bus=’ps2’/>
<graphics type=’vnc’ port=’-1′ keymap=’en-us’/>
<console type=’pty’/>
<video>
<model type=’cirrus’/>
</video>
</devices>
</domain>

Creating domain… | 0 B 00:00
Mon, 25 Jul 2011 11:07:40 DEBUG Started guest, connecting to console if requested
Mon, 25 Jul 2011 11:07:40 DEBUG Launching console callback

** (virt-viewer:5321): CRITICAL **: viewer_activate: assertion `viewer->display == NULL’ failed
Guest installation complete… restarting guest.
Mon, 25 Jul 2011 11:22:14 DEBUG Launching console callback

(virt-viewer:5844): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width 400 and height -2147483648

(virt-viewer:5844): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width 400 and height -2147483648

********************************************************************************
Define following XML profile LucidPV.xml utilizing same storage device (/dev/sda7) as HVM:
********************************************************************************

<domain type=’xen’>
<name>LucidPV</name>
<description></description>
<memory>2097152</memory>
<currentMemory>2097152</currentMemory>
<vcpu>2</vcpu>
<bootloader>/usr/lib/xen-4.1/bin/pygrub</bootloader>
<bootloader_args>-q</bootloader_args>
<os>
<type>linux</type>
<kernel></kernel>
</os>
<clock offset=’utc’/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/lib/xen-4.1/bin/qemu-dm</emulator>
<disk type=’block’ device=’disk’>
<driver name=’phy’/>
<source dev=’/dev/sda7’/>
<target dev=’xvda’ bus=’xen’/>
</disk>
<interface type=’bridge’>
<mac address=’00:16:3e:63:3b:51’/>
<source bridge=’br0’/>
<script path=’/etc/xen/scripts/vif-bridge’/>
<target dev=’vif10.0’/>
</interface>
<console type=’pty’ tty=’/dev/pts/3′>
<source path=’/dev/pts/3’/>
<target type=’xen’ port=’0’/>
</console>
<input type=’mouse’ bus=’xen’/>
<graphics type=’vnc’ port=’5900′ autoport=’yes’/>
</devices>
</domain>

Then run
# virsh define LucidPV.xml



References
1.Problem with Xen 4.1 on Ubuntu 11.10 ( Oneiric Ocelot) (HVM DomUs crash)