Tags: software

IE error “expected identifier, string or number”

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

This probably means that you’ve got a trailing comma after an object/hash definition:

var myObj = {
  key0: 'val0',
  key1: 'val1',
  key2: 'val2', // ←
};         // ↑

You’re on your own for trying to figure out which file it’s talking about and translating the line number into the correct value.

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 ;)

John Hodgman is using software that I helped to write

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

A recent blog post by The Hodg Man mentions that he uses (AND ENJOYS) a product I’ve helped to build. Yay.

***

FULL DISCLOSURE NUMBER TWO

FAITHFUL READERS OF THIS IMITATION BLOG know that, having crashed my own website repeatedly while linking to it Twitterphonically, I experimented with NEW INTERNET TECHNOLOGY to try to fix this problem.

SPECIFICALLY, my host, LiquidWeb, called and offered their cloud computing solution STORM ON DEMAND. I think this means that instead of being stored on a single regular computer, my whole website is instead stored on dozens of semi-mechanical, murderous black clouds on various uncharted islands.

Cloud Computing at Work

THIS EXPERIMENT WAS SUCCESSFUL. So, in the spirit of full disclosure,

I AM USING STORM ON DEMAND FOR A REDUCED PRICE, and unless it grabs me and pulls me in to the woods to murder me, I will continue to USE AND ENJOY IT.

***

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?

Font for composing Lushootseed

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

At the recommendation of David Beck, I have installed a TTF font from http://www.languagegeek.com/. It took a few minutes for me to figure out how to get it going, but it was pretty straightforward after that. Here are some quick instructions for those of you running Debian variants such as Ubuntu.

  1. Fetch the zip files from languagegeek.com and unpack:
    $ sudo mkdir -m777 -p /usr/local/share/fonts/truetype/languagegeek/
    $ cd /usr/local/share/fonts/truetype/languagegeek/
    $ for zip in AboriginalSerif.zip AboriginalSans.zip
    do
      wget http://www.languagegeek.com/font/$zip &&
      unzip $zip &&
      rm $zip
    done
    $ sudo chmod -R 755 .
    
  2. Register these fonts with the system using defoma (the debian font manager):
    $ for font in *.ttf
    do
      sudo defoma-font register truetype $PWD/$font
    done
    

While performing the defoma registration, I was presented with a number of warning-ish-looking messages for each file processed. For better or worse, I am ignoring them:

No CIDSupplement specified for Dotum-Bold, defaulting to 0.
No CIDSupplement specified for Batang-Regular, defaulting to 0.
No CIDSupplement specified for ZenHei-CNS, defaulting to 0.
No CIDSupplement specified for Batang-Bold, defaulting to 0.
No CIDSupplement specified for ZenHei, defaulting to 0.
No CIDSupplement specified for Dotum-Regular, defaulting to 0.

I used gnome-appearance-properties (System → Preferences → Appearance) to set my document font to Aboriginal Sans:


After telling Chromium that it should use these fonts, it renders all of the Lushootseed characters quite nicely.


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-live/current/

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

Lushootseed characters

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

Here are some of the characters used to represent text in the Lushootseed languages. This is an imperfect representation. There doesn’t seem to be a COMBINING LATIN SMALL LETTER W, so I’m using a second character in these cases. I also can’t find any fonts that render a c with both a caron and a comma.

ʔ – glottal stop
ƛ̕ – barred lamda with comma above, right
á – lower-case a with acute
à – lower-case a with grave
í – lower-case i with acute
ì – lower-case i with grave
č – c with caron
č̓ – c with caron and comma
c̕ – c with comma above, right
ə – lower-case schwa
gʷ – g with raised lower-case w
ǰ – j with caron
kʷ – k with raised lower-case w
k̕ – k with comma above, right
k̕ʷ – k with comma above, right and raised lower-case w
ɬ – lower-case l with stroke
l̕ – l with comma above, right
p̕ – p with comma above, right
qʷ – q with raised lower-case w
q̕ – q with comma above, right
q̕ʷ – q with comma above, right and raised lower-case w
š – s with caron
t̕ – t with comma above, right
ù – u with a grave accent
ú – u with an accute accent
w̕ – w with comma above, right
xʷ – x with raised lower-case w
x̣ʷ – x with raised lower-case w and dot below
y̕ – with comma above, right

I’ve checked this in to the University of Washington Linguistics Department’s subversion server. Ping me for credentials if you care.

svn://guest@lemur.ling.washington.edu/shared/lushootseed/trunk/characters

SAN configuration (AoE)

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

With the help of a couple of friends, we’ve put a 4.5T RAID-5 machine on our network and I’m trying to figure out how to share the storage with the rest of the hosts. In the past, I have used NFS and CIFS/Samba to provide access to remote hosts. This has generally worked okay so long as the server stays online.

I don’t know if the results are going to be much different, but I am now trying a different approach. I plan to run an iSCSI server, and I’ve already configured AoE (ATA over Ethernet). I’ve exported a block device on the network segment and mounted it on a remote host. This was pretty easy to configure. There is a bit of documentation on the internet already, but I’ll give another quick overview.

I gave the storage server the unoriginal name ’san0′. This host is running debian lenny. I am testing the configuration from my debian sid development host, which has the similarly unoriginal name ‘dev0′. So, think server when you see ’san0′ and client when you see ‘dev0′.

I assume that you’ve already got an LVM volume group set up. Mine is called ‘vg0′. Correct the following examples to account for any differences. You can use disk partitions instead of LVM logical volumes.


Create a logical volume to be exported:

cjac@san0:~$ sudo lvcreate /dev/vg0 -n e0.1 -L 5G

Load the AoE kernel module:

cjac@san0:~$ sudo modprobe aoe

Install the package containing the vblade block device export server:

cjac@san0:~$ sudo apt-get install vblade

Export the block device. Note that the ethernet bridge on which I export the device is called ‘loc’:

cjac@san0:~$ sudo vbladed 0 1 loc /dev/vg0/e0.1

Install the AoE discovery tools on the client:

cjac@dev0:~$ sudo apt-get install aoetools

Load the AoE kernel module:

cjac@dev0:~$ sudo modprobe aoe

Probe for exported AoE devices:

cjac@dev0:~$ sudo aoe-discover

Verify that our exported device was discovered:

cjac@dev0:~$ test -e /dev/etherd/e0.1 && echo "yep"
yep


You can now treat /dev/etherd/e0.1 as you would any other block device. You can format it directly, or partition it and format a partition, use it as a device in your software RAID array, use it as swap space (ha), or something completely different.

Now to figure out this iSCSI stuff…

building unmodified_drivers

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

This is the gist of it:

$ cd /usr/src/
# $ sudo chmod a+rwx .
$ wget ftp://ftp.suse.com/pub/projects/kernel/kotd/SLE11_BRANCH/src/kernel-source-2.6.27.39-0.0.0.25.15a4c6f.src.rpm
$ alien -tg kernel-source-2.6.27.39-0.0.0.25.15a4c6f.src.rpm
$ cd kernel-source-2.6.27.39
$ tar xfj linux-2.6.27.tar.bz2
$ for f in patches.*.tar.bz2; do
tar xfj $f || break;
done
$ for p in $(./guards x86_64 < series.conf); do
patch -d linux-2.6.27 -p1 < $p || break
done
$ cd linux-2.6.27
$ fakeroot make-kpkg debian
$ fakeroot make-kpkg build
$ sudo make install modules_install
$ cd /usr/src
$ hg clone http://xenbits.xen.org/xen-unstable.hg
$ cd xen-unstable.hg/unmodified_drivers/linux-2.6
$ XEN=/usr/src/xen-unstable.hg/xen XL=/usr/src/kernel-source-2.6.27.39/linux-2.6.27 ./mkbuildtree x86_64
$ make -C /usr/src/kernel-source-2.6.27.39/linux-2.6.27 M=$PWD modules
$ sudo make -C /usr/src/kernel-source-2.6.27.39/linux-2.6.27 M=$PWD modules_install