If you are looking for the epic motorcycle journey blog that I've written, please see the Miles By Motorcycle site I put together. 
  • Subscribe to this RSS Feed
  • Holiday shopping season prediction
    11/30/2007 12:38PM
    The hottest holiday gift this year for parents will be a home lead testing kit.  Stock up now before they're gone.
  • Kubuntu 7.10 on Dell Vostro 400n
    11/23/2007 8:15PM
    There is an issue with recent 2.6 kernels and some ATA/SATA controllers which I have run into while trying to install both CentOS 5 and Kubuntu 7.10 (Gutsy Gibbon). Initially, even the boot CD would not work from the builtin DVD reader. To boot the first time I used an external USB DVD.
    The relevant error was "failed to set xfermode".
    See http://fak3r.com/2007/06/22/failed-to-set-xfermode-solved/ for more info.

    Essentially you need to add irqpoll to the linux boot line. You can do this, after install, by editing /boot/grub/menu.lst and adding irqpoll to the #defoptions line. At the the end of the install process before rebooting open a terminal and do a "chroot /target /bin/sh". Then cd to /boot/grub and edit menu.lst.

    If you do not have a USB cdrom available see this post about passing kernel options to grub on boot:

    http://www.redhatmagazine.com/2007/03/21/using-grub-to-overcome-boot-problems/

    Since I had a USB drive available I did not have to do this.

  • OpenOffice XHTML XSLT export filter
    09/18/2007 1:59PM
    As part of large project I'm working on, I need to create some kind of context sensitive online help system for a web application. I've used LyX in the past and exported that to DocBook which I then ran through an HTML filter but it's clumsy and there's no good maintainable way to link sections of the webapp to the generated html pages. For a given bit of help information you don't know which page it will end up on.

    I decided instead of using a hodgepodge of technologies, I would try to use OpenOffice.

    OpenOffice has an XSLT engine useful for transforming ODT files to other formats including XHTML. They have a sample XHTML export filter which works fairly well but, at the present moment, only seems to generate a single monolithic page. I'll deal with that later.

    The concept I had was, somehow, to include specially formatted <a name=""> tags in the generated HTML to mark points that I want to link to from my application. I figure I could use some standard naming scheme like "special_prefix|section|feature". I could then write a quick  indexer that could crawl through the generated HTML files looking for the special_prefix and create an index identifying which features are documented in which HTML files. Then it's a simple matter of writing a little index lookup utility; pass it the section and the feature you want the documentation for and have it displayed. Of course since the OpenOffice XHTML export only supports a single monolithic file, this isn't strictly necessary, but eventually I want to get the filter to generate multiple pages and the last thing I want to have to do is crawl through the app and update links every time I change the documentation.

    OpenOffice doesn't seem to support much in the way of metadata, so as a proof of concept I used the bookmark feature. I created a sample document and dropped bookmarks at various places.

    The stock XHTML export filter ignores bookmarks so I had to modify the share/xslt/export/xhtml/body.xsl filter definition to include a section to turn ODT bookmark tags which look like:

    <text:bookmark text:name="ecommerce|customer_list"/>

    to <a name=""> tags like:

    <a name="_fv_HELP|ecommerce|customer_list" />

    in the generated HTML. the _fv_HELP is just a arbitrarily chosen string that I can be relatively sure will not be present in any other <a name=""> tags so I can use that to search on to find the tags I'm interested in.

    After much trial and error, I added:

        <xsl:template match="text:bookmark">
            <xsl:param name="globalData" />

            <xsl:element name="a">
                <xsl:attribute name="name">_fv_HELP::<xsl:value-of select="@text:name"/></xsl:attribute>
            </xsl:element>

        </xsl:template>

    to body.xsl right above the first link definitions and it seems to work. The <a name=""> tags are exported to the right places in the generated HTML.

  • Tricks for Virtualizing a Redhat 6.1 installation.
    07/28/2007 12:46PM
    The machine this site is running on is an old dual PIII 600. The unfortunate thing is that some of the software running on it uses binary-only components that won't run under later versions of linux. So while I work on a replacement for those components, we're stuck running dns1 for the foreseeable future.

    The machine is getting long in the tooth so I needed a fall back plan.

    In the past I successfully virtualized a win95 machine using vmware. So I decided to try the same thing on dns1.

    dns1 has two drives. The first has four partitions on it. The second has one.

    See the article below on getting knoppix to boot off a USB CD ROM drive. The ATAPI cdrom on dns1 had long since died.

    Using dd I created single file images of each machine. In my case, I used had a second USB port on the machine and plugged an ext3 formatted external drive into it.

    First do an fdisk of your two drives and use the 'p' option to print out the partition table of each. You will need this information later when you go to edit your VMWare virtual machine configuration.

    In my case, the two drives were /dev/sda and /dev/sdb.

    fdisk /dev/sda
    press 'p' and hit enter. Copy the information it prints. Exit and repeat for /dev/sdb.

    dd if=/dev/sda  of=sda.dd
    dd if=/dev/sdb  of=sdb.dd

    (obviously you need to be in a directory where you want to deposit the files, either on a large usb drive or possibly samba mounted over some network. In my case I used a large USB drive formatted with the ext3 filesystem. FAT32 won't work as it has a 2gig file size limit.)

    7.5 hours later .... 

    I then copied the two nine gig image files over to a laptop where I could work with them.

    For creating the virtual machine setup I referred to this article. See the bottom of the article as you will most likely want to image the entire drive, not just individual partitions.

    http://www.davidlaporte.org/tutorials/ghostinthemachine.html

    Using VMWare 5.5.1 I created a new blank virtual machine with two 9 gig SCSI drives. To add the second drive go to "Edit this virtual machine" after you've created it. Click on hard disk. Click the Add button at the bottom.

    Some notes on what I did:

    Copy the image files to the directory where you created your new virtual machine.

    Per instructions in the article above edit the two vmdk files to match the geometry of your physical drives.

    In my case, the partition tables on the two drives looked like this:

    Disk /dev/sda: 255 heads, 63 sectors, 1106 cylinders
    Units = cylinders of 16065 * 512 bytes

       Device Boot    Start       End    Blocks   Id  System
    /dev/sda1   *         1       392   3148708+  83  Linux
    /dev/sda2           393      1106   5735205    5  Extended
    /dev/sda5           393       784   3148708+  83  Linux
    /dev/sda6           785       817    265041   82  Linux swap
    /dev/sda7           818      1106   2321361   83  Linux

    Disk /dev/sdb: 255 heads, 63 sectors, 1106 cylinders
    Units = cylinders of 16065 * 512 bytes

       Device Boot    Start       End    Blocks   Id  System
    /dev/sdb1   *         1      1106   8883913+  83  Linux

    The image files were:

    -rw-r--r-- 1 root root 9105018880 Jul 26 17:33 sda.dd
    -rw-r--r-- 1 root root 9105018880 Jul 26 17:33 sdb.dd

    When you edit the vmdk files use "vi". There will be some binary code leading up to the first text strings. Do not touch any of the binary, just edit the text.

    Since my two drives are identical, the two vmdk files are almost identical:

    # Disk DescriptorFile
    version=1
    CID=8a2fdbad
    parentCID=ffffffff
    createType="monolithicFlat"

    # Extent description
    RW 17767890 FLAT "sda.dd" 0

    # The Disk Data Base
    #DDB

    ddb.virtualHWVersion = "4"
    ddb.geometry.cylinders = "1106"
    ddb.geometry.heads = "255"
    ddb.geometry.sectors = "63"
    ddb.adapterType = "buslogic"
    ddb.toolsVersion = "0"

    It has to be "monolithicFlat' for the createType since you have a single image file. For the extent description the referenced article says that you take the size of the dump file and divide it by 512. That yielded 17783240 which is different than multiplying
    63 * 255 * 1106 = 17767890. I used the latter number and it seemed to work fine. Note that if you do not add the "0" at the end of the line, which I did by mistake in my first test, vmware will fail to recognize the drive.

    Also note that vmware does not support emulating an adaptec controller. There are two options, LSI and BusLogic. As the particular install of Redhat 6.1 I had on the old PIII did not have an LSI driver I opted to use the BusLogic driver. This causes a few complications which are dealt with below. The release notes for vmware indicated there may be some problems with the BusLogic driver under Redhat 6.1 but I have not noticed any yet.

    You may also have to edit the .vmx file if you did not choose to create virtual "SCSI" disks in the vmware step. See the references article for more details.

    You can try to boot your VMware virtual machine now and the you should get a boot prompt if you did everything correctly in the steps above, however your old Redhat 6.1 install will not find the file systems and will kernel panic.

    In order to get Redhat 6.1 to be able to talk to your new virtual drives you need to replace the driver you were originally using, in my case Adaptec, with a BusLogic driver. This means rebuilding the "initrd" file, which ended up being a real pain.

    You must find a boot CD that has the same major version of the kernel on it as your old distribution. In this case, RedHat 6.1 runs a Linux 2.2 kernel. Originally I tried to boot using a 2.4 Knoppix CD, but the mkinitrd script would fail. Duh, different major kernel versions.

    So I borrowed a RedHat 6.1 install CD and booted it in rescue mode. (i.e. type linux rescue at the prompt).

    The problem I now faced was the the old RedHat 6.1 CD did not create device entries for /dev/sda1, which is my boot partition.

    To create the device file manually you need to cd to the /dev/ directory and run the command:

    mknod sda1
    b 8 1

    Now you'll have a device file for the partition so you can mount it. (If your boot partition is another device, do a google search on "mknod and the name of the device you want to create and you'll find the parameters)

    Mount your boot partition, which in my case was an ext2 filesystem:

    mkdir /mnt/sda1
    mount -t ext2 /dev/sda1 /mnt/sda1

    You need to chroot into it:

    cdroot /mnt/sda1

    Now you can edit /etc/modules.conf to change your driver which in my case contained:

    alias scsi_hostadapter aic7xxx

    which I changed to

    alias scsi_hostadapter BugLogic

    then cd to /boot and run:

    mkinitrd -v -f /boot/initrd-2.x.y-zz.img 2.x.y-zz,

    Where x.y.-zz is the version of the kernel on your old machine, not the version that's running on the CD.

    Now in my case since it's an old RedHat 6.1 install I needed to run lilo for the changes to take effect.

    Shutdown and reboot and your virtualized copy of your physical machine should boot just fine.

    For additional information refer to these two articles:

    http://www.vmwiz.com/

    http://virtualaleph.blogspot.com/2007/05/virtualize-linux-server-with-vmware.html

    If you have any questions about what I did here please feel free to contact me.
  • Article about the 0.1 release of Linux
    07/27/2007 11:36AM
    Cool article covering a bit of increasingly ancient linux history:

    Linux: The 0.01 Release

    The first Linux distribution I used was SLS and included the .99pl12 kernel if I remember correctly. I had been working under SCO Unix for quite a while at that point and encountering Linux freed me from that hell. It's been my main development OS ever since.