Tags: ubuntu

Building libvirt on CentOS5 (incomplete)

Originally published at The Pædantic Programmer. Please leave any comments there.

Much thanks to Brett for the pointers on rpm-fu.

http://grantmcwilliams.com/index.php?option=com_content&view=article&id=229:

$ sudo yum install \
xen-devel \
xhtml1-dtds \
hal-devel \
libpcap-devel \
cyrus-sasl-devel \
parted-devel \
numactl-devel \
avahi-devel \
slang-devel \
libvolume_id-devel \
openldap-devel

# device-mapper-devel \
# xmlrpc-c-devel \

for pkg in \
libssh2-devel-1.2.5-1.el5.pp.x86_64.rpm \
libssh2-1.2.5-1.el5.pp.x86_64.rpm \
libssh-0.2.1-0.2.svn193.el5.pp.x86_64.rpm \
libssh-devel-0.2.1-0.2.svn193.el5.pp.x86_64.rpm
do
wget ftp://ftp.pbone.net/mirror/ftp.pramberger.at/systems/linux/contrib/rhel5/x86_64/$pkg
rpm -i $pkg
done

wget http://www.fateyev.com/RPMS/RHEL5/x86_64/xmlrpc-c-devel-1.14.8-1.el5.x86_64.rpm
wget http://www.fateyev.com/RPMS/RHEL5/x86_64/xmlrpc-c-1.14.8-1.el5.x86_64.rpm
rpm -i xmlrpc-c-*1.14*el5*.rpm

wget ftp://ftp.icm.edu.pl/vol/rzm1/linux-fedora-secondary/development/source/SRPMS/corosync-0.95-2.fc11.src.rpm
alien -t corosync-0.95-2.fc11.src.rpm
mv corosync-0.95.tgz /tmp
cd ~/rpm/SOURCES
tar xfz /tmp/corosync-0.95.tgz
patch -p0

--- corosync.spec.orig  2010-05-26 19:17:15.000000000 +0000
+++ corosync.spec       2010-05-26 19:21:39.000000000 +0000
@@ -39,11 +39,7 @@
 fi
 %endif

-%{_configure}  CFLAGS="$(echo '%{optflags}')" \
-               --prefix=/usr \
-               --sysconfdir=/etc \
-               --localstatedir=/var \
-               --libdir=%{_libdir}
+%{configure}   CFLAGS="$(echo '%{optflags}')"

 %build
 make %{_smp_mflags}
@@ -52,8 +48,8 @@
 rm -rf %{buildroot}

 make install DESTDIR=%{buildroot}
-install -d %{buildroot}%{_initddir}
-install -m 755 init/redhat %{buildroot}%{_initddir}/corosync
+install -d %{buildroot}%{_sysconfdir}/init.d
+install -m 755 init/redhat %{buildroot}%{_sysconfdir}/init.d/corosync

 ## tree fixup
 # drop static libs
@@ -95,7 +91,7 @@
 %{_sbindir}/corosync-fplay
 %{_sbindir}/corosync-pload
 %config(noreplace) /etc/corosync.conf
-%{_initddir}/corosync
+%{_sysconfdir}/init.d/corosync
 %dir %{_libexecdir}/lcrso
 %{_libexecdir}/lcrso/coroparse.lcrso
 %{_libexecdir}/lcrso/objdb.lcrso

rpmbuild -bb corosync.spec
sudo rpm -i ~/rpm/RPMS/x86_64/corosynclib*.rpm

wget ftp://ftp.icm.edu.pl/vol/rzm1/linux-fedora-secondary/development/source/SRPMS/openais-0.94-1.fc11.src.rpm
alien -t openais-0.94-1.fc11.src.rpm
mv openais-0.94.tgz /tmp
cd ~/rpm/SOURCES
tar xfz /tmp/openais-0.94.tgz
rpmbuild -bb openais.spec
sudo rpm -i ~/rpm/RPMS/x86_64/openaislib-*.rpm

wget ftp://ftp.icm.edu.pl/vol/rzm1/linux-fedora-secondary/development/source/SRPMS/lvm2-2.02.45-4.fc11.src.rpm
alien -t lvm2-2.02.45-4.fc11.src.rpm
mv lvm2-2.02.45.tgz /tmp
cd ~/rpm/SOURCES
tar xfz /tmp/lvm2-2.02.45.tgz
rpmbuild -bb lvm2.spec

GSoC 2010

Originally published at The Pædantic Programmer. Please leave any comments there.

Earlier this month, I applied to the Mono Project (and the University of Washington, and Ubuntu, and Debian, and The Perl Foundation) requesting a mentor to get Perl6 hosted on the DLR.

Last Tuesday, Miguel contacted me and asked that I chat with Michael Hutchinson about possibly taking up a different project. It seems that the group did not have any mentors who felt comfortable mentoring the Perl6 project. After a bit of consideration, I agreed to modify my application and take up a project to revive the regular expression compiler from 2.2.

Today, the project was officially accepted, and I met with my mentor for the first time (hi Rodrigo!).

I will also be working with Matthew Wilson (aka @diakopter), since he has purportedly implemented a number of regex-to-IL compilers ;) He also offered to mentor me if The Perl Foundation had accepted my application, and since he has already implemented a perl6 compiler in javascript, I have been looking forward to poking some code with him.

Although the GSoC doesn’t officially get started until 5/24, I’m making a git-svn checkout now. I’ve always committed the code directly to svn, but I’ve enjoyed working with git, and it seems about time to start contributing via git-svn. It will be easier to have local branches this way, too.

Anyway, I’m looking forward to it ;)

Getting started with gtk♯

Originally published at The Pædantic Programmer. Please leave any comments there.

This is a quick tutorial for getting a first gtk-sharp app up and going.

Install MonoDevelop

$ sudo apt-get install monodevelop libgtk2.0-cil-dev

Start MonoDevelop

It’ll be in your GNOME application menu under Applications->Programming->MonoDevelop

Create a new Gtk# Project

Create New Project

Create New Project

Select Gtk# 2.0 Project

Select Gtk# 2.0 Project

Select Project Features

Select Project Features

Hello World

Hello World

Run project

You can run this boilerplate by pressing Ctrl-F5

Using the Designer

Double-click on the file named MainWindow.cs in the Solution section. When the file opens, click the Designer button below the code view.

The Designer

The Designer

The Toolbox

To add the Toolbox, press Alt-Shift-B or click View->Toolbox.

Drag a VBox widget from the Toolbox to the main window.

Add VBox

Add VBox

Drop a Menu Bar widget into the top cell of the VBox, and a Statusbar into the bottom.

Insert Menu and Status Bar

Insert Menu and Status Bar

Properties grid

Drop a Button widget into the middle cell of the VBox.
Add the Properties grid from the View menu (Alt+Shift+P or View->Properties).
Select the new button by clicking on it.
In the Properties grid, expand the Button Properties section and click the value of the Label field. Delete the default content and replace it with a different string.

Button with new Label

Button with new Label

Adding a Click handler

Select the button in the Designer view
In the Property grid, select the Signals tab
Click twice on the text in the column to the right of the Clicked and replace Click here to add a new handler with MyButtonClickHandler

Add a click handler

Add a click handler

Click on the Source Code button below the viewer window to switch to the C♯ code. You can use the find tool to search for the new handler you created, called MyButtonClickHandler. Ctrl-F will bring up the find dialogue.

Browse to click handler

Browse to click handler

Add some code to update the status bar.

	protected virtual void MyButtonClickHandler (object sender, System.EventArgs e)
	{
		var contextId = this.statusbar1.GetContextId("clicked");
		this.statusbar1.Push(contextId, "Clicky-Clicky" );
	}
Click handler code

Click handler code

Modify button layout

The size of the running window is a little weird. I fixed mine by un-setting the Auto Size boolean and setting the Expand and Fill in the Box Child Layout section of the Properties grid.

Button layout changes

Button layout changes

Exercise button click handler

Run your application with Ctrl-F5 and click on the button. You should see the new string show up in the status bar at the bottom left of the window.

Not yet clicked

Not yet clicked

Clicked + Status update

Clicked + Status update

Add Menu items

Create File Menu Entry

Create File Menu Entry

Create File->Quit Menu Item

Create File->Quit Menu Item

Add Quit event handler

Add Quit event handler

Add Clear Statusbar Activate Handler

Add Clear Statusbar Activate Handler

dlr-languages 20090805+git.e6b28d27+dfsg-1 in squeeze, -2 uploaded, nearly in lucid

Originally published at The Pædantic Programmer. Please leave any comments there.

Yay! The dlr-languages package has been migrated to testing, which means that it will be included in squeeze, the next release of Debian. Jo has uploaded the -2 version and it is now in sid. This version addresses the issues brought up in the Ubuntu Feature Freeze exception (FFe) bug, so I expect that it will be accepted shortly. Still lots of “ifs”, but this is pretty exciting for me, since this is my first debian package, and I’ve been intending to get it in for over two years.

I’m not just sitting on my hands while this happens. I’ve been working with Ivan, Ankit, Dino and Michael to get the next version of the package put together. I’m currently merging Ivan’s latest branch into the changes I’ve made for DFSG compliance. Dino recommended that the next release include IronRuby 1.0 and IronPython 2.6.1, which should be released by upstream around the middle of April.

IronRuby on OS X

Originally published at The Pædantic Programmer. Please leave any comments there.

We had a visitor on #ironruby today asking for help getting IR running on his mac. I gave him the following directions, and they seemed to work aside from one glitch. I tested them on my wife’s mac, and it worked for me, too.

Install Mono

You can grab the Mono .dmg from go-mono.com. This will install the framework and put the required programs (mono, xbuild) in your PATH.

Fetch the IronRuby source

Since Jim Deville likes macs, I’m sure more recent versions will work, but this is the one we’ve recently packaged up for Debian and tested on Ubuntu. If you want to be certain that the IronRuby code you write on Debian works on OS X, then you should probably build from the same version of the source. You should probably also install version 2.4.3 of Mono, but that may be more effort than it’s worth ;)

http://github.com/mletterle/ironru…

Unpack the tarball

Open up a terminal and unpack the thing you just downloaded:

$ mkdir ~/src/
$ cd ~/src/
$ tar xfz ~/Desktop/mletterle-ironruby-e6b28d2.tar.gz
$ cd mletterle-ironruby-e6b28d2/

Build IronRuby

At this point, you should be able to build the IronRuby assemblies using xbuild. I don’t recommend using rake, as it has some dependencies, and I’m not a fan of dependencies.

$ xbuild /p:TreatWarningsAsErrors=false Merlin/Main/Languages/Ruby/Ruby.sln
<snip/>
Build succeeded.
	 2817 Warning(s)
	 0 Error(s)

Time Elapsed 00:00:28.8378230

Run the IronRuby interactive interpreter

Our guest mentioned that he was using a terminal with a white background. Do note that the font color of the interactive interpreter (aka Read-Eval-Print Loop or REPL) is white, so if you’re using a white background, you might want to change it. IIRC, there is a way to change the font color using a configuration setting. Figuring it out is left as an exercise for the reader.

$ mono Merlin/Main/Bin/Debug/ir.exe
IronRuby 0.9.0.0 on 2.6.3 (tarball Wed Mar 10 18:18:12 MST 2010)
Copyright (c) Microsoft Corporation. All rights reserved.

>>> 1+2
=> 3
>>> exit()

Extra credit: IronPython

The tarball you downloaded also included the source to IronPython. The procedure to build/run IronPython is pretty similar to IronRuby.

Build IronPython

Unlike IronRuby’s .sln, this version of IronPython’s .sln does not have a default configuration parameter, so we need to specify it with the /p:Configuration=Debug argument.

$ xbuild /p:TreatWarningsAsErrors=false /p:Configuration=Debug Merlin/Main/Languages/IronPython/IronPython.sln
<snip/>
	 69 Warning(s)
	 0 Error(s)

Time Elapsed 00:00:38.8057450

Run the IronPython interactive interpreter

IronPython has a REPL interface like IronRuby’s. Or is it the other way around? Anyway, here’s an example.

$ mono .//Merlin/Main/Bin/Debug/ipy.exe
IronPython 2.6 Beta 2 DEBUG (2.6.0.20) on .NET 2.0.50727.1433
Type "help", "copyright", "credits" or "license" for more information.
>>> 1+2
3
>>> ^D

Locale configuration post-Intrepid

Originally published at The Pædantic Programmer. Please leave any comments there.

I was reminded this morning after a bit of chatter on #debian-cli that my previous write-up on setting one’s locale on Ubuntu is out-of-date. Instead of running dpkg-reconfigure locales and selecting your locale, the new incantation is as follows:

Magic

$ sudo locale-gen en_US.UTF-8

Environment Variables

You’ll also want to set some environment variables. Put something like the following in your ~/.bashrc:

LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_ALL=en_US.UTF-8

export LANG LANGUAGE LC_CTYPE LC_MESSAGES LC_ALL

You would of course replace en_US.UTF-8 with whichever locale you want to generate.

Connecting to MySQL with ODBC on Mono

Originally published at The Pædantic Programmer. Please leave any comments there.

We had a visitor on #mono today who needed help with his homework. It seems that Reggie is happy to have forgotten everything about using ODBC to connect to MySQL. I was curious and feeling helpful, so I figured it out.

Install the MySQL ODBC driver

$ sudo apt-get install libmyodbc

You can also grab the package directly from MySQL

Configure the MySQL ODBC driver

ODBC looks in /etc/odbcinst.ini for driver configuration. In order to let it know about the MySQL ODBC libraries, append the following to your /etc/odbcinst.ini file:

[MySQL]
Description	= MySQL driver
Driver	= /usr/lib/odbc/libmyodbc.so
Setup		= /usr/lib/odbc/libodbcmyS.so
CPTimeout	=
CPReuse	=

Configure your DSN

If you expect that you will be using this database connection often, you may want to create a short name for it, so you don’t have to enter all of the parameters every time you want to connect. ODBC uses something called DSNs (Data Source Names, if I recall correctly) to make it easier on the user.

If you want to create a DSN, append something like the following to your /etc/odbc.ini file:

[myodbc3]
Driver       = MySQL
Description  = MySQL ODBC 3.51 Driver DSN
Server       = mysql
Port         =
User         = testuser
Password     = password
Database     = test
Option       = 3
Socket       =

You will also need to update the ODBC Data Sources list near the top of the file to mention the new DSN:

[ODBC Data Sources]
myodbc3     = MySQL ODBC 3.51 Driver DSN

C♯ ODBC connection example

Here is some example code to get you connected:

using System;
using System.Data;
using System.Data.Odbc;

class ODBCTest {
  public static void Main(String[] args) {
    // Connection string using explicit parameters
    string ConStr = String.Format(
      "DRIVER={0};SERVER={1};DATABASE={2};UID={3};PWD={4}",
      "{MySQL}","mysql","test","testuser","password" );

    // Connection string using DSN
//  string ConStr = String.Format("DRIVER={0};DSN={1}",
//                                "{MySQL}","myodbc3");                       

    //Create the connection object
    var OdbcCon = new OdbcConnection( ConStr );

    try {
      Console.Write("Opening connection... ");

      //open the database connection
      if (OdbcCon.State == ConnectionState.Closed)
        OdbcCon.Open();

      Console.WriteLine("connection opened!");
    } catch (OdbcException Ex) {
      Console.WriteLine(Ex.Message);
    } finally {
      //close the database connection
      OdbcCon.Close();
    }
  }
}

PPA installation on karmic

Originally published at The Pædantic Programmer. Please leave any comments there.

I don’t know how long add-apt-repository has been around, but I’ve found it very useful for installing some of the bleeding edge stuff I want to test:

$ for ppa in do-core team-xbmc nvidia-vdpau chromium-daily directhex/monoxide
do
  sudo add-apt-repository ppa:$ppa
done
$ apt-get update
$ apt-get install chromium-browser nvidia-glx-195 gnome-do xbmc monodevelop

Is there anything like this for debian proper, I wonder?

AoE root for KVM guests

Originally published at The Pædantic Programmer. Please leave any comments there.

Intro

So. I’m trying to get familiar with libvirt and friends. To this end, I’ve set up a Lucid virtual machine booting from PXE into an initrd environment which does a pivot_root to an AoE block device.

The #virt channel on irc.oftc.net told me that in order to have libvirt provide PXE capability, I would have to install a recent version of libvirt. I built version 0.7.5-3 from sid on my karmic laptop and it seems to be working okay.

I decided to set up the pxe root directoy in /var/lib/tftproot just because that’s what the example code had in it.

Configure the Virtual Network

I had to manually configure a virtual network. Here is the XML config file:

$ sudo virsh net-dumpxml netboot
<network>
  <name>netboot</name>
  <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
  <forward mode='nat'/>
  <bridge name='virbr1' stp='off' delay='1' />
  <domain name='example.com'/>
  <ip address='192.168.123.1' netmask='255.255.255.0'>
    <tftp root='/var/lib/tftproot' />
    <dhcp>
      <range start='192.168.123.2' end='192.168.123.254' />
      <bootp file='pxelinux.0' />
    </dhcp>
  </ip>
</network>

Install syslinux

This, of course, depends on the pxelinux.0 file. Luckily, this is packaged up in syslinux and can be installed with a simple


$ sudo apt-get install syslinux
$ sudo mkdir /var/lib/tftproot
$ sudo cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftproot

Configure PXE boot parameters

I had to create a pxelinux config file for the virtual machine (indexed by mac address). Note that I put a console=ttyS0,115200 argument on the kernel command line so that I can attach to the serial port from the host system for copy/paste debugging. Also of importance is the root=/dev/etherd/e0.1p1 argument, specifying which block device we’ll be doing the pivot_root to eventually.


$ mkdir /var/lib/tftproot/pxelinux.cfg/
$ cat /var/lib/tftproot/pxelinux.cfg/01-52-54-00-44-34-67
DEFAULT linux
LABEL linux
SAY Now booting the kernel from PXELINUX...
KERNEL vmlinuz-lucid0
APPEND ro root=/dev/etherd/e0.1p1 console=ttyS0,115200 initrd=initrd.img-lucid0

I decided to use the karmic kernel for lucid initially. I’ll eventually switch over to the lucid kernel ;)


$ sudo cp /boot/vmlinuz-2.6.31-17-generic /var/lib/tftproot/vmlinuz-lucid0

Customize initramfs-tools

I copied /etc/initramfs-tools to ~/tmp/lucid so that I didn’t mess up the system initrd scripts:


$ mkdir -p ~/tmp/lucid && cp -r /etc/initramfs-tools ~/tmp/lucid/

Since mkinitramfs doesn’t currently have a system for AoE root, I had to do a bit of fiddling. I copied the NFS root boot script and made a couple of modifications.

$ diff -u /usr/share/initramfs-tools/scripts/nfs ~/tmp/lucid/initramfs-tools/scripts/aoe
--- /usr/share/initramfs-tools/scripts/nfs	2008-06-23 23:10:21.000000000 -0700
+++ /home/cjac/tmp/lucid/initramfs-tools/scripts/aoe	2010-01-15 14:56:28.098298027 -0800
@@ -5,59 +5,25 @@
 retry_nr=0

 # parse nfs bootargs and mount nfs
-do_nfsmount()
+do_aoemount()
 {
-
 	configure_networking

-	# get nfs root from dhcp
-	if [ "x${NFSROOT}" = "xauto" ]; then
-		# check if server ip is part of dhcp root-path
-		if [ "${ROOTPATH#*:}" = "${ROOTPATH}" ]; then
-			NFSROOT=${ROOTSERVER}:${ROOTPATH}
-		else
-			NFSROOT=${ROOTPATH}
-		fi
-
-	# nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
-	elif [ -n "${NFSROOT}" ]; then
-		# nfs options are an optional arg
-		if [ "${NFSROOT#*,}" != "${NFSROOT}" ]; then
-			NFSOPTS="-o ${NFSROOT#*,}"
-		fi
-		NFSROOT=${NFSROOT%%,*}
-		if [ "${NFSROOT#*:}" = "$NFSROOT" ]; then
-			NFSROOT=${ROOTSERVER}:${NFSROOT}
-		fi
-	fi
+        ip link set up dev eth0

-	if [ -z "${NFSOPTS}" ]; then
-		NFSOPTS="-o retrans=10"
-	fi
+        ls /dev/etherd/

-	[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-premount"
-	run_scripts /scripts/nfs-premount
-	[ "$quiet" != "y" ] && log_end_msg
+        echo > /dev/etherd/discover

-	if [ ${readonly} = y ]; then
-		roflag="-o ro"
-	else
-		roflag="-o rw"
-	fi
+        ls /dev/etherd/

-	nfsmount -o nolock ${roflag} ${NFSOPTS} ${NFSROOT} ${rootmnt}
+        mount ${ROOT} ${rootmnt}
 }

-# NFS root mounting
+# AoE root mounting
 mountroot()
 {
-	[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-top"
-	run_scripts /scripts/nfs-top
-	[ "$quiet" != "y" ] && log_end_msg
-
-	modprobe nfs
-	# For DHCP
-	modprobe af_packet
+	modprobe aoe

 	# Default delay is around 180s
 	# FIXME: add usplash_write info
@@ -67,17 +33,13 @@
 		delay=${ROOTDELAY}
 	fi

-	# loop until nfsmount succeds
+	# loop until aoemount succeds
 	while [ ${retry_nr} -lt ${delay} ] && [ ! -e ${rootmnt}${init} ]; do
 		[ ${retry_nr} -gt 0 ] && \
-		[ "$quiet" != "y" ] && log_begin_msg "Retrying nfs mount"
-		do_nfsmount
+		[ "$quiet" != "y" ] && log_begin_msg "Retrying AoE mount"
+		do_aoemount
 		retry_nr=$(( ${retry_nr} + 1 ))
 		[ ! -e ${rootmnt}${init} ] && /bin/sleep 1
 		[ ${retry_nr} -gt 0 ] && [ "$quiet" != "y" ] && log_end_msg
 	done
-
-	[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-bottom"
-	run_scripts /scripts/nfs-bottom
-	[ "$quiet" != "y" ] && log_end_msg
 }

(below is the full file in case udiff is less convenient)

$ cat ~/tmp/lucid/initramfs-tools/scripts/aoe
# NFS filesystem mounting			-*- shell-script -*-

# FIXME This needs error checking

retry_nr=0

# parse nfs bootargs and mount nfs
do_aoemount()
{
	configure_networking

        ip link set up dev eth0

        ls /dev/etherd/

        echo > /dev/etherd/discover

        ls /dev/etherd/

        mount ${ROOT} ${rootmnt}
}

# AoE root mounting
mountroot()
{
	modprobe aoe

	# Default delay is around 180s
	# FIXME: add usplash_write info
	if [ -z "${ROOTDELAY}" ]; then
		delay=180
	else
		delay=${ROOTDELAY}
	fi

	# loop until aoemount succeds
	while [ ${retry_nr} -lt ${delay} ] && [ ! -e ${rootmnt}${init} ]; do
		[ ${retry_nr} -gt 0 ] && \
		[ "$quiet" != "y" ] && log_begin_msg "Retrying AoE mount"
		do_aoemount
		retry_nr=$(( ${retry_nr} + 1 ))
		[ ! -e ${rootmnt}${init} ] && /bin/sleep 1
		[ ${retry_nr} -gt 0 ] && [ "$quiet" != "y" ] && log_end_msg
	done
}

There was also a small modification to the initramfs.conf file:

$ diff -u /etc/initramfs-tools/initramfs.conf ~/tmp/lucid/initramfs-tools/initramfs.conf
--- /etc/initramfs-tools/initramfs.conf	2008-07-08 18:37:42.000000000 -0700
+++ /home/cjac/tmp/lucid/initramfs-tools/initramfs.conf	2010-01-15 14:33:38.088295207 -0800
@@ -47,14 +47,16 @@
 #

 #
-# BOOT: [ local | nfs ]
+# BOOT: [ local | nfs | aoe]
 #
 # local - Boot off of local media (harddrive, USB stick).
 #
 # nfs - Boot using an NFS drive as the root of the drive.
 #
+# aoe - Boot using an AoE drive as the root of the drive.
+#

-BOOT=local
+BOOT=aoe

 #
 # DEVICE: ...

I also needed to add aoe to the list of modules included in the initramfs:


$ echo aoe >> ~/tmp/lucid/initramfs-tools/modules

In order to generate the initrd.img file from this new config, I ran the following:


$ sudo mkinitramfs -d ~/tmp/lucid/initramfs-tools/ -o /var/lib/tftproot/initrd.img-lucid0

Install OS to virtual block device

I created a lucid VM by installing from the desktop install disk. You can grab the ISO here:

http://cdimage.ubuntu.com/daily-li…

I’ll leave the creation of the virtual machine and installation as an exercise for the reader. I put the filesystem on an lvm volume group called vg0 in a logical volume called lucid0 (ie, /dev/vg0/lucid0).

Create virtual machine definition with virsh

At this point, I created a new virtual machine called lucid0. Here is the xml for the domain:

$ sudo virsh dumpxml lucid0
<domain type='kvm' id='1'>
  <name>lucid0</name>
  <uuid>96fbad21-4f25-5700-ddd8-1a565c7170ee</uuid>
  <memory>524288</memory>
  <currentMemory>524288</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc-0.11'>hvm</type>
    <boot dev='network'/>
  </os>
  <features>
    <pae/>
  </features>
  <clock offset='localtime'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <interface type='network'>
      <mac address='52:54:00:44:34:67'/>
      <source network='netboot'/>
      <target dev='vnet0'/>
    </interface>
    <serial type='pty'>
   <source path='/dev/pts/4'/>
      <target port='0'/>
    </serial>
  <console type='pty' tty='/dev/pts/4'>
   <source path='/dev/pts/4'/>
      <target port='0'/>
    </console>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5901' autoport='yes' listen='127.0.0.1' keymap='en-us'/>
    <sound model='es1370'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
    </video>
  </devices>
</domain>

Start AoE target

Now we’re ready to start the AoE target and launch the virtual machine. If you don’t have vblade installed, do so now:


$ sudo apt-get install vblade

Start the target up with the following command:


$ sudo vbladed 0 1 virbr1 /dev/vg0/lucid0

Boot the virtual machine

Now, if all goes well, you should be able to watch the virtual machine boot up and do its thing like so:


$ sudo virsh start lucid0 && sudo screen -S lucid0 `sudo virsh ttyconsole lucid0` 115200

If you get errors about /dev/etherd/e0.1p1 not existing (these might look like this):

Begin: Retrying AoE mount ...
err         discover    interfaces  revalidate  flush
err         discover    interfaces  revalidate  flush
mount: mounting /dev/etherd/e0.1p1 on /root failed: No such file or directory
Done.

then you might want to try restarting vbladed like this:


$ sudo kill -9 `ps auwx | grep vblade | grep -v grep | awk '{print $2}' ` && sudo vbladed 0 1 virbr1 /dev/vg0/lucid0

Questions? Comments?

So. Now you should have a lucid gdm in your virt-manager console. Any questions? #virt on irc.oftc.net

Also, feel free to email me