Wednesday, July 15, 2009

Saturday, July 11, 2009

Constrained disk space, whoops, patents

So I'm setting up a Linux instance under Qemu (actually, under Kju). I want the whole root filesystem to fit in a 2GB-or-smaller qcow file, so the image can be easily carried around on a FAT32-formatted USB flash drive. (NTFS isn't universally available, nor is my preferred HFS+.) I know there are other ways to do this (I could go up to 4GB on a FAT32 volume, or have multiple volumes and use LVM, or...), but consider this a bored geek's exercise in -- filesystem economy? (Man, I remember when a 2GB drive was huge, we figured we'd never need any more space on our Univel UnixWare box (a 486DX2/66 with 32MB RAM and 32 serial ports courtesy an ISA Digi DigiBoard C/X and a pair of DigiCon/16 RJ45 serial port boxes, serving up terminal access to a hundred or so students and faculty)...)

Anyway, getting a modern distribution shoehorned into that space is an exercise in frustration. Even 9.04 Xubuntu won't fit! I went back to Fedora Core 9 and did a completely bare-bones install, customized package load with all packages de-selected (including everything in Base). Whoops. Didn't realize how completely cut off that would leave that instance. Solution: Setup a small (100MB) qcow filesystem under a Windows instance as a FAT32 volume and manually copy some RPMs (ftp, lynx, etc) from a Fedora Core 9 mirror. Shutdown the Windows instance and connect the FAT32 volume to the Linux machine, boot it, and mount the FAT32 volume under /mnt, using `rpm -ivh` to manually install the RPM files.

The things we do when we're bored (and putting off reading the Order Granting Motion for Summary Judgment of Invalidity of '427 Patent in Dealertrack v. Huber et al., CV 06-2335 AG (C.D. Cal., July 7, 2009) (use your PACER login), which evidently applies In Re Bilski (wow, that list of amici reads like the plaintiff list in a Jonathon Lee Riches complaint!) to invalidate a software patent...

Friday, July 3, 2009

Geek-friendly keyboard for the Dell Mini 9

There's something to be said for online forums; intrigued by mention of an "international" keyboard for the Dell Mini 9 (Inspiron 910) in the UbuntuMini group, I set out to learn more about this wonder. Found it. Note the keyboard layout differences -- [{ and }] and the | pipe etc. are no longer modifier-required keys, but honest-to-gods standalone plastic. If you've ever programmed, or authored a document in LaTeX, etc., you'll quickly realize the person who designed the standard US keyboard for the Mini 9 ... hasn't. The "fixed" keyboard is en route to me as I type this, $23 shipped to California, Dell part number U061H, described as: Keyboard,66,US-INTL,Single Pointing,Qiao Hong,Windows. Looking forward to it.

Thursday, July 2, 2009

Your world in your pocket

I've been excited by the idea of a truly portable operating environment for a while. I'd love to be able to sit down at any workstation and fire up my world -- my documents, my web browser bookmarks, everything. We're a long way away from that still (I'd love for everything to be in some sort of reliable, secure, always-on inexpensive cloud, with native-desktop-speed access to that...), but getting closer.

I'm theoretically entering a situation where I won't have access to my personal computers, but will have access to workstations in an unknown but presumed locked down configuration -- pretty typical for many who access the world through libraries, university (or high school) computer labs, want a way to catch up on personal email during lunch breaks at the office, at a business center at a hotel, whatever. (Always adhering to the local usage and access policies, of course!) Being able to fire up my VPN and encrypted volumes to have secure access to my work is a Good Thing.

As such, I want to have an environment (Windows with Cygwin, I guess, to straddle both worlds but still have native access to, e.g., Acrobat Pro and Microsoft Office, two essential tools for a lawyer, though I've used scan2pdf and with some success) I can carry with me and run as an unprivileged (non-administrator) user.

I had high hopes for VMware ACE, but alas it requires the installation of VMware Player, which requires administrator access. MokaFive and its ilk all seem to likewise require admin rights. So far, the only real option seems to be QEMU, through Qemu Manager. So far so good, except I think I found an issue with the "File Transfer" functionality -- when using PASV mode it reports an IP address of, rather than the the client will need to connect to. It's also not quite as fast as VMware, but otherwise appears to be as capable as I need it to be, especially once I transferred it from my fast, but nowhere near native hard drive speed, USB drive onto my laptop's internal drive for the purpose of setting up software. (I'll move it back to the USB drive for its intended use, obviously.)

Saturday, June 27, 2009

MAC Address fiddling

Changing the MAC address of your Linux workstation is an incredibly easy task (in this example, from :a9 to :aa)...

  1. Determine the existing MAC address of the interface to be changed:
    $ sudo ifconfig wlan0
    wlan0 Link encap:Ethernet HWaddr 00:24:2c:e3:c8:a9

  2. Bring the interface down:
    $ sudo ifconfig wlan0 down

  3. Set the new MAC address:
    $ sudo ifconfig wlan0 hw ether 00:24:2c:e3:c8:aa

  4. Bring the interface back online:
    $ sudo ifconfig wlan0 up

  5. Verify the change took:
    $ sudo ifconfig wlan0 | grep HWaddr
    wlan0 Link encap:Ethernet HWaddr 00:24:2c:e3:c8:aa


Friday, June 26, 2009

Connectivity, ancient Slackware, and other stuff

So sitting in the passenger seat of my brother's sedan, I was able to get online with my (sadly discontinued; it was a great, cheap, Linux portable, and all-important for me, it was the only then-available netbook without a camera; the replacement Mini 10, and the Vostro A90, are both camera-laden, as are all the other netbooks on the market now that I'm aware of) Dell Mini 9 and my Millenicom mobile broadband adapter ($50/month for truly unlimited service, pay-as-you-go), and got some client work done. Nothing huge, just reviewing a contract, adding a few lines to an addendum, and bouncing it back to him. On the way to the family farm, in the middle of nowhere.

While I was there, in the middle of corn fields, I was able to use my BlackBerry to send a copy of a fax I'd sent out using TrustFax to another party via email (downloaded the preview from their web interface and attached it as a file using the standard OS 4.5 BlackBerry mail application). Tech can be, at times, maddeningly frustrating when it doesn't work, or when it connects you to the drama at the office when you'd rather not have seen the flashing red "message waiting" light... But the times it lets you spend time with family and still get done the time-critical tasks that need doing -- yeah.

So while at the farm I stumbled across one of the first Linux distributions I ever used, a Slackware 3.0 CD-ROM from the Linux System Administrator's Survival Guide. This wasn't my first go-around with Linux; that was Slackware 2.2.0 (with August 1995's 1.2.13 kernel; of course, kernel 2.0 wouldn't be released until the summer of 1996, and the first Linux box I put into production went online in January 1996) I got bundled with the book Linux Unleashed. (Eventually I outgrew the books and just started buying dirt-cheap CD-ROMs from Cheap*Bytes. This was in the days before my college had high speed connectivity; I think the entire campus was sharing a 56k leased line. Once, I signed up for an MSN dial-up account -- which came with 100 free hours -- to download a Linux distribution.)

Anyway, with a few magical incantations:

$ sudo dd if=/dev/sr0 of=/media/PNY/Slackware3.iso
$ eject cdrom
$ sudo mount -o loop /media/PNY/Slackware3.iso /mnt

I have an ancient piece of my history I can play around with a little bit. Maybe fire up VirtualBox and see if I can get it to live again (like Arren did with the DV-8).

Thursday, June 25, 2009

In-Flight Internet

I was on an old MD-80 last night, flying from LAX to the midwest with American Airlines. As soon as we got the "approved portable electronic devices" go-ahead I pulled out my ThinkPad and fired it up, and as I went to kill the onboard WiFi I was surprised to see a hotspot. I connected to it and sure enough, after clicking through the "try it on us!" greeting, I had a fully working Internet connection. At 30,000'! Gogo Inflight. It didn't appear to be restricted in any real way; I was able to SSH and FTP out, send SMTP messages, access my IMAP server, browse the web, etc. I'm a bad geek, in that I didn't run a connection speed test (instead I hopped on Facebook and posted a bunch of "OMG I'm FLYING and talking to you on Facebook!" inanity) or otherwise determine the parameters of the link...

It was (only?) a decade ago I was totally enamored with the 9600 baud connections available through cabling a laptop's internal model (or PCMCIA card modem) via the RJ11 port provided on seatback telephone handsets, billed at like $2.00/minute, that would at least allow me to check mail / SSH in to an errant server or whatever, while en route to Europe. (I couldn't find a lot of information on this, was kind of a flash-in-the-pan thing that didn't last very long. Here's a blog post with pictures, and someone else remembering that tech...)

Tuesday, June 23, 2009

Netbook bag

I picked up a cheap Targus bag, ostensibly for netbooks, at Best Buy for $30 about a month ago, mostly because it was (a) the only netbook case they carried and (b) was being offered in a promotion with an adorable free Ultra Mini Retractable Optical Mouse which made the bag almost free.  But it never felt quite right,  it didn't seem setup for netbooks.  When I began idly looking for a replacement case, it became clear why -- it wasn't a netbook case, it was (based on the DVD301-WM model number, and the inordinate number of 5" disc shaped pockets (in a case for a device that, as a rule, doesn't have an optical drive) a portable DVD player case.  Sigh.

My needs aren't great, but I did want things like a cellphone pouch and pen loops -- when I'm grabbing the Mini 9 to hit the road, it's with the expectation I'm going to do some work.  That, for me, involves at least one carry-along pen.  (And usually a bottle of Noodler's Polar, or Luxury, Blue, but I've digressed.  Yeah, fountain pens and bottled ink.  I kick it old-school, as I boot into my alpha release Linux environment...)

Anyway, just a shout out to the Targus TSM097US, which appears to be everything I need in a netbook case.  Not sure why more netbook cases don't provide at least pen loops, seems so basic.  This one actually seems useful for the urban bedouin.  No affiliation, just, if you're looking for what I was looking for, maybe now you'll find it.  (Though Best Buy didn't have it in with their cases, I had to hunt for it and found one lonely sample shoved back behind other bags under their netbook display models.  I'd looked it up online and knew it was in the store (or at least carried by the store), and flying out tomorrow afternoon, I was ... determined.

Firefox Easter Egg

Found this amusing (let's see if it works): About robots.

(I'm geeky enough I didn't have to google for most of the references... The first one is Asimov's First Law of Robotics (ah, memories of plowing through those books as a fifth grader); I'm pretty sure the second is from Bladerunner; the third ... okay, had to Google it, Marvin (do I have to relinquish my Geek Card for not having HHGTTG memorized?); the fourth is a reference to Bender. Oh, and Cylons. The Cylons have a plan.

Oh, and Klaatu Barada Nikto is a phrase everyone should have memorized, whether because it might end up on your cubicle wall or because misspeaking it while retrieving the Necronomicon (in the event you're ever dragged back in time by a vengeful evil) can have dramatic consequences.

ThinkPad SL500 and Linux

I like the ThinkPad SL500. I know it catches flack for basically being an IdeaPad in ThinkPad clothing, but I don't care. It works well enough and the price was certainly right. Linux works almost flawlessly on it, out of the box (caveats, I don't have a fingerprint reader or Bluetooth; I use the SDHC card reader, trackpad, WiFi, USB drives, etc). The few things that didn't work were, e.g., the volume controls, hotkeys, and the screen brightness. These were all cured with a relatively painless kernel upgrade. I'm running Ubuntu 9.04 which, as of this writing, is using a 2.6.28-13 kernel; these steps bring it up to the 2.6.30 kernel with an additional ThinkPad SL500 (and perhaps other SL models) specific driver module.

  1. Obtained the Latest kernel from: (e.g., Files I downloaded for my Intel Core 2 Duo SL500:

    • linux-headers-2.6.30-020630_2.6.30-020630_all.deb

    • linux-headers-2.6.30-020630-generic_2.6.30-020630_i386.deb

    • linux-image-2.6.30-020630-generic_2.6.30-020630_i386.deb

    • linux-source-2.6.30_2.6.30-020630_all.deb

  2. Install the kernel:
    $ sudo dpkg -i linux-headers-2.6.30-020630_2.6.30-020630_all.deb
    $ sudo dpkg -i linux-headers-2.6.30-020630-generic_2.6.30-020630_i386.deb
    $ sudo dpkg -i linux-image-2.6.30-020630-generic_2.6.30-020630_i386.deb
    $ sudo dpkg -i linux-source-2.6.30_2.6.30-020630_all.deb

  3. Reboot.

  4. Download kernel module from: (I clicked through to download the 'raw' versions of Makefile and README and lenovo-sl-laptop.c to a local directory). Change into the directory where those files reside and:
    $ make all
    $ sudo cp lenovo-sl-laptop.ko /lib/modules/`uname -r`/kernel/drivers/misc
    $ sudo depmod -v

  5. Configure the rest of the system:
    $ sudo depmod
    $ sudo gedit /etc/modprobe.d/blacklist.conf
    blacklist thinkpad-acpi # added (anywhere in the file)

    $ sudo gedit /etc/modprobe.d/lenovo-sl-laptop.modprobe.conf
    options lenovo-sl-laptop control_backlight=1

    $ sudo gedit /etc/rc.local
    # Added before the exit 0 line:
    echo 0 > /sys/module/video/parameters/brightness_switch_enabled
    modprobe lenovo-sl-laptop

    $ sudo /etc/rc.local

And voila, the brightness control, volume, etc., should be working! I love it when a plan comes together.

Cross-platform fonts

Working on a document in OpenOffice on the Mac, Windows (occasionally), and Linux works well enough, but sometimes you don't want to use FreeSerif, whatever ideological purity might be found therein. I like Georgia, and Garamond. The following command will, on an Ubuntu box, install the semi-free (as in speech) Microsoft TrueType core fonts, which include Georgia:

$ sudo apt-get install ttf-mscorefonts-installer

Ubuntu Touchpad Tweaks (or, making it more like the Mac)

I'm a Mac user for the most part, but Macs all come with cameras (yeah, I know you can have an Apple Certified Technician disable the internal camera, but it's a hassle I'm not going to go through), so I have a ThinkPad SL500 and a Dell Mini 9, both of which are cameraless, that I can tote with me to secured locations. (My cellphone is a BlackBerry 8830 for the same reason.) So I have Ubuntu Linux (9.04 Desktop on the ThinkPad, 9.10 Alpha 2 UNR on the Mini) to carry around with me. With OpenOffice it's all I really need on the go.

One thing the Mac makes ridiculously easy and intuitive (I suspect they eat their own dogfood in Cupertino, just a hunch) is touchpad operation. For instance, it will ignore taps made while typing, and having the touchpad disabled when an external mouse is hooked up is a simple checkbox in the mouse control panel. Easy.

To do the same thing under Ubuntu is possible, but, erm, no so easy. It was actually kind of hair pulling for me. But I eventually got it, with some help from a fellow Ubuntu user (he's an expert, I'm a well situated amateur). Here are the steps I took, in hopes these help others...

  1. Setup a udev rule.
    This runs whenever I connect, or disconnect, a mouse (it doesn't catch when the system is started up with a mouse already attached; I'll work on that eventually). Here are the contents of /etc/udev/rules.d/89-mouse-touchpad.rules (use the terminal to run the command 'sudo gedit <filename^gt;' to edit system files):
    ACTION=="add", SUBSYSTEM=="input", ID_CLASS="mouse", RUN+="/usr/local/bin/touchpad"
    ACTION=="remove", SUBSYSTEM=="input", ID_CLASS="mouse", RUN+="/usr/local/bin/touchpad"

  2. Determine what driver the touchpad is using
    $ /usr/bin/hal-find-by-capability --capability input.touchpad

    $ /usr/bin/hal-get-property --udi \
    /org/freedesktop/Hal/devices/platform_i8042_i8042_AUX3_port_logicaldev_input \
    --key input.x11_driver

  3. Enable SHMConfig for the touchpad via HAL
    by creating the file /etc/hal/fdi/policy/shmconfig.fdi (Note that this is considered a potential security issue.):
    <?xml version="1.0" encoding="UTF-8"?>
    <deviceinfo version="0.2">
    <match key="input.x11_driver" string="synaptics">
    <merge key="input.x11_options.SHMConfig" type="string">True</merge>

  4. Configure syndaemon
    syndaemon is used to deactivate the touchpad while typing; it's part of the package xserver-xorg-input-synaptics and almost certainly installed by default. Set it up to run at system boot by adding the line /usr/bin/syndaemon -i 2.5 -d before the exit 0 line in /etc/rc.local The command man syndaemon will reveal other options that may be useful (e.g., not disabling the touchpad when modifier keys are pressed, or disabling taps but not movement).

  5. Install the /usr/local/bin/touchpad script:
    use warnings;
    use strict;

    # Interact with environment; set DISPLAY;
    # determine what ACTION script invoked to handle:
    $ENV{'DISPLAY'} = ':0.0';
    my $action = $ENV{'ACTION'} || "unknown";
    my $devicemodel = $ENV{'ID_MODEL'} || "[ID_MODEL unset]";
    my $logstring = $0 . " called for ACTION '"
    . $action . "' of device " . $devicemodel;
    `/usr/bin/logger '$logstring'`;

    # Open the X server to accept controls from xinput
    # (potential security risk...):
    my $xhost_result = `/usr/bin/xhost + 2>&1`;
    `/usr/bin/logger 'xhost run with result: $xhost_result'`;

    # Find the Unique Device Identifier (UDI) for every touchpad on
    # the system (there's probably only just the one, but...) and
    # cycle through them:
    my @udis = `/usr/bin/hal-find-by-capability --capability input.touchpad`;
    foreach my $udi (@udis) {
    chomp $udi;

    # Find the info.product value(s) for this touchpad's UDI and
    # cycle through it (them?):
    my $cmd = "/usr/bin/hal-get-property --udi $udi --key info.product";
    my @results = `$cmd`;
    foreach my $product (@results) {
    chomp $product;
    my $xinput = "/usr/bin/xinput set-int-prop \""
    . $product . "\" \"Device Enabled\" 8 ";
    my $message;
    if($action eq 'add') {
    $message = "Disabling $udi";
    $xinput .= "0";
    } else {
    $message = "Enabling $udi";
    $xinput .= "1";
    `/usr/bin/logger $message`;

    # Actually disable / enable the touchpad by toggling
    # the Device Enabled property (1 or 0) via xinput:
    my $cmdoutput = `$xinput 2>&1`;
    `/usr/bin/logger '$xinput result: $cmdoutput'`;
    my $lclcmd = "/usr/bin/xinput list-props \""
    . $product
    . "\" | /bin/grep 'Device Enabled' "
    . "| /usr/bin/tr -d '\011'";
    $cmdoutput = `$lclcmd 2>&1`;
    `/usr/bin/logger 'Current state of $product is: $cmdoutput'`;
    (I may have gone a little overboard on the logging, and there may be a more secure way to do this than by using xhost. Caveat lector.)

  6. Run xhost on login
    Until this step is taken, the system is in a bit of a catch-22; xhost (run from the touchpad script) can't connect to the X server to tell it to allow xinput to connect to the X server, because xhost hasn't been run to allow xhost to connect... So, on a 9.04 Desktop box, click through to: System -> Preferences -> Startup Applications and Add the following entry:
    Name: Xhost
    Command: /usr/bin/xhost +
    Comment: Enable mouse defeat of touchpad

And we're done. Reboot (necessary for the hal configuration to take effect; /etc/init.d/hal restart doesn't seem to do it) and enjoy!

Obligatory intro

I'm a geek from way back. I tried to write a multi-tasking multi-user networked operating system for my 8-bit 65c02-powered Apple IIe. When I was 12. At one point I made my living as a UNIX administrator, moonlighting as a code hack and technical reviewer for books with names like Professional PHP4. I even have my name on the cover of a book on arcane MySQL explorations.

Then I went to law school. Got the highest grade in the class in Computer Law. Would have been disappointed had it been otherwise. Have been trying to scratch out a career in that field, and still find myself moonlighting as a code hack and occasional sysadmin.

I'm going to write about nifty things I've managed to figure out setting up my Ubuntu Linux systems (I caught the bug when I got a Dell Mini 9 with their 8.04 LTS distribution on it; it's now running 9.10 Alpha 2 UNR, and when I got a Lenovo ThinkPad SL500 the first thing I did was repartition it to have Ubuntu 9.04 available -- I'm typing this under that OS), Java code I've hacked together (I may even plug a book I'm working on, if it ever gets ready for prime time), and developing legal matters (or just pet peeves) in the area of cyberspace.