Category Archives: Technology

Things humans make that weren’t there before.

Programming Injury

No, it’s not carpal tunnel syndrome. I seem to be immune from that because I didn’t learn to type from an idiot.

A couple of days ago, I was actually programming in the same position for so long that I managed to bruise the tissue at the tip of my tailbone. The irony is that I program in a comfy chair which should by no means be capable of such a thing. You really don’t know how often your tailbone is involved in ordinary activities like sitting, leaning, climbing stairs, or sleeping until it’s bruised. Perhaps I need a standing desk to avoid further injury.

Also: How pathetic is it to be injured while programming? On a scale of “twisted ankle trying on new shoes” to “severed nose while bowling” I’d say it’s somewhere around “pulled hamstring while making toast.”

Bride of Ubuntu

My wife was starting to have strange problems with her XP laptop which ended up being spyware/malware that grew and thrived in the petri dish that is Windows XP, an eXPerimental operating system by Microsoft, a convicted monopolist. Rather than go through the effort of joining the expensive and time-consuming arms race against malware on Windows XP, I booted the Ubuntu 8.04 live CD, rsynced her files to my RAID box, and then nuked Windows XP and installed Ubuntu 8.04.

She really doesn’t care what OS she uses, “as long as it works.” So far, it does. She doesn’t get strange windows popping up and ironically insisting that she buy software to fix her computer’s malware infections. Showing her how to run Firefox and OpenOffice in Ubuntu was 99% of the solution and took 20 seconds, and while the other 1% will realistically take most of the time and effort, it’ll be worth not having to worry about malware in Windows XP.

I do have one remaining problem that I have just begun to look into, involving really loud beeping and inconsistent wakeup from hibernation. Given the sheer volume of the Ubuntu community, I have confidence that I’ll resolve this soon, or at least work around it.

UI Lies

I have a RAZR v3 which features a 3-level battery charge indicator on the UI.  Sometimes, the phone indicates a 3/3 charge, but when I plug it in, it shows a 1/3 when it begins to charge back up to full.  It’s as if the phone is putting on a brave face while it’s starving, and when you finally feed it, it admits that it was really in bad shape and would have passed out from hunger had you not intervened.

The inconsistency of the indicator between the plugged and unplugged states must be a UI design decision, though the only reason I can fathom for it is that they wanted to give the appearance of long battery life at the expense of an accurate battery charge indicator.  If you leave your phone on for a day and it still shows a 3/3 charge, you may extrapolate that you could get at least 3 days of use on a single charge.  Uninformed users may compare that pleasant lie with the harsh truth of another phone’s battery indicator and falsely conclude that the lying phone lasts longer.

A reference eludes me at the moment, but IIRC, there was a bit of a kerfluffle over gas gauge indicators when Honda first started selling cars in the US.  Honda’s decision was to provide an accurate gas gauge, where empty meant empty, whereas the unspoken rule in US car design was that empty meant “nearly” empty, where “nearly” could sometimes mean 50%.  Much hilarity ensued when Americans learned that the gas gauges were “broken” and would no longer lie to them.  The unspoken standard may have changed over time, since all the cars I’ve driven recently will activate a Blinkenlight(tm) when the gas is down to 2-4 gallons, depending on the car.

I’m curious to learn what lies you’ve all been told by various UIs that you use.

Ubuntu RAIDbox: Part 3

In general, this part of the instructions assumes that you are using storage devices (disks and CF) that contain nothing that you care about. If this is not the case, please either first copy the data you want to keep to a safe location, or learn how to adapt these steps to preserve what you have.

Boot your RAIDbox hardware and launch the Ubuntu installation process.

  1. Choose Manual Partitioning
  2. For each disk displayed, delete every partition.
  3. Once complete, partition your CF card as a single ext3 partition with / as its mount point.
    1. Move the cursor to the single row underneath its drive descriptor, e.g. :
      IDE1 master (hda) - 8.0 GB TRANSCEND
              pri/log    8.0 GB     FREE SPACE
    2. Press ENTER
    3. Select Create a new partition and press ENTER
    4. Press ENTER to accept the default size, which is all of your disk space.
    5. Select Primary and press ENTER
    6. If Use as: is not Ext3 journaling file system, then
      Select Use as: and press ENTER
      Select Ext3 journaling file system and press ENTER
    7. If Mount point: is not /, then
      Select Mount point
      Select / – the root file system
    8. If Bootable flag: is not on, then
      Select Bootable flag: and press ENTER.
    9. Press ESC to return to the partition menu.
  4. For each hard disk, first create a 384 MB RAID partition at the end of the disk:

Move the cursor to the single row underneath its drive descriptor, e.g. :

SCSI4 (0,0,0) (sda) - 500.1 GB ATA ST3500841A
         pri/log  500.1 GB     FREE SPACE

Press ENTER

Select Create a new partition and press ENTER

Press BACKSPACE until the partition size field is empty. Then type 384 MB and press ENTER

Select Primary and press ENTER

Select END and press ENTER

Select Use as: and press ENTER

Select physical volume for RAID and press ENTER

Press ESC to return to the partition menu.

After all disks are complete, fill out the remaining space with another RAID partition:

Move the cursor to the row underneath its drive descriptor that shows FREE SPACE, e.g. :

SCSI4 (0,0,0) (sda) - 500.1 GB ATA ST3500841A
         pri/log  499.7 GB     FREE SPACE
        #1 primary  378.4 MB   K raid

Press ENTER

Select Create a new partition and press ENTER

Press ENTER to accept the default size, which is the rest of your disk space.

Select Primary and press ENTER

Select Use as: and press ENTER

Select physical volume for RAID and press ENTER

Press ESC to return to the partition menu.

Scroll back up to the top of the Partition disks page, select Configure software RAID and press ENTER.

If asked to Write the changes to the storage devices and configure RAID, select Yes and press ENTER.

To clear out results from previous attempts, select Delete MD device and press ENTER. Delete all devices until there are no more defined.

Once all MD devices are deleted, select Create MD device and press ENTER.

Select RAID5 and press ENTER.

Press BACKSPACE until the default number of active devices for the RAID5 array is deleted, then type 4 and press ENTER.

If the default number of spare devices for the RAID5 array is not 0, press BACKSPACE until the number is deleted, then type 0 and press ENTER.

One by one, move the cursor to each of the 4 lines that ends in 1 (e.g. /dev/sda1) and press SPACE to select it. When done, press ENTER.

Repeat the above steps, but this time, select all the lines that end in 2 (e.g. /dev/sda2) which should be the only 4 options remaining.

Select Finish and press ENTER.

When the partitioner is done, it’ll take you back to show you the results of your RAID work. From this point on, leave your actual disk partitions alone and only work with the RAID5 device entries. e.g.

RAID5 device #0 - 1.1 GB Software RAID device
      #1   1.1 GB

and

RAID5 device #1 - 1.5 TB Software RAID device
      #1   1.5 TB

Select the line under the smaller RAID5 device and press ENTER.

Select Use as: and press ENTER

Select swap area and press ENTER

Press ESC to return.

Select the line under the larger RAID5 device and press ENTER.

Select Use as: and press ENTER

Select Ext3 journaling file system and press ENTER

If Format the partition: is not set to yes, format it, then select it and press ENTER.

Select Mount point: and press ENTER

Select Enter manually

Change the default to /raid and press ENTER.

Press ESC to go back.

When back at the Partition disks screen, review your partitions one final time and then scroll down to select Finish partitioning and write changes to disk, then press ENTER.

The rest of the installation process is just like a normal Ubuntu installation, except with more simultaneous disk activity. When your system boots, Ubuntu will be entirely on the CF card, and your swap partition will be on one raid array, and a giant chunk of storage will be mounted at /raid.

The only thing that remains is to get /var off the CF as soon as /raid is mounted, because CF cards can only take a certain number of write cycles, and we don’t want logging to kill our boot disk.

Once your RAIDbox boots for the first time, log in as your main user account. If you run the command ‘df -h’ then you should see something like this:

Filesystem            Size  Used Avail Use% Mounted on

/dev/hda1             7.4G  660M  6.4G  10% /

varrun                188M   44K  188M   1% /var/run

varlock               188M     0  188M   0% /var/lock

udev                  188M  112K  188M   1% /dev

devshm                188M     0  188M   0% /dev/shm

lrm                   188M   34M  154M  19% /lib/modules/2.6.22-14-generic/volatile

/dev/md1              1.4T  198M  1.3T   1% /raid

As you can see, our CF disk is mostly underused, and we want to keep it that way to ensure a long life. More on that later.

Ubuntu RAIDbox: Part 2

With the hardware assembled, the next step is to install Ubuntu Server 7.10. I did not want to use an optical drive, but if you want to hook up an optical drive and install from the CD, you can just insert Ubuntu Server 7.10, configure the BIOS to boot from the optical drive, reboot, and go to Part 3.

For the adventurous, here’s how to PXE boot Ubuntu Server 7.10 on your RAIDbox (or any PXE-capable machine, for that matter) from another Linux server on your LAN.

Pick a Linux machine on your LAN to act as the PXE server for the PXE boot process on your RAIDbox. I chose a server running 64-bit Ubuntu Server 7.04, but I anticipate any recent version of Ubuntu would have the same setup process. Here’s everything you need to do on the PXE server:

Download (or copy from another machine) the .iso file for Ubuntu Server 7.10.

Install dnsmasq and prepare the tftpboot directory:

sudo apt-get update
sudo apt-get install dnsmasq
sudo mkdir /tftpboot
sudo chmod 755 /tftpboot
sudo chown nobody: /tftpboot

Run these commands to extract needed files from the Ubuntu Server 7.10 image:

sudo mount -o loop /location/of/your/ubuntu-7.10-server-i386.iso /mnt
sudo cp -a -r /mnt/install/netboot/ubuntu-installer /tftpboot
sudo cp -a  /mnt/install/netboot/pexlinux.0 /tftpboot
sudo cp -a -r  /mnt/install/netboot/pexlinux.cfg /tftpboot

Edit /etc/dnsmasq.conf. The lines you add will look something like this. You need to provide an IP address that you want your RAIDbox to have, you need to specify the IP address of the PXE server you’re configuring, and you need to provide the IP address of the gateway you use to get to the internet, which is usually your LAN’s regular DHCP server. You must also list the MAC address of the network device you’ll use on the RAIDbox when PXE booting. (This makes sure no other devices on your LAN connect to the PXE server.) If your PXE server also has a human-readable name on your LAN, you can list it here. Otherwise, leave it blank.

dhcp-range=IPADDRESS.FOR.YOUR.RAIDBOX,IPADDRESS.FOR.YOUR.RAIDBOX,12h
dhcp-host=MAC:ADDRESS:OF:YOUR:RAID:BOX,IPADDRESS.FOR.YOUR.RAIDBOX
dhcp-boot=pxelinux.0,HUMAN_READABLE_NAME_OF_YOUR_SERVER,IPADDRESS.OF.YOUR.SERVER
dhcp-option=3,IPADDRESS.OF.YOUR.GATEWAY
enable-tftp
tftp-root=/tftpboot

Here’s how it might look:

dhcp-range=192.168.0.240,192.168.0.240,12h
dhcp-host=aa:bb:cc:dd:ee:ff,192.168.0.240
dhcp-boot=pxelinux.0,presence2,192.168.0.34
dhcp-option=3,192.168.0.10
enable-tftp
tftp-root=/tftpboot

(Re-)launch dnsmasq:

sudo /etc/init.d/dnsmasq restart

Ubuntu RAIDbox: Part 1

I needed a RAIDed NAS box that I could rsync to for backing up Linux filesystems. While there are commercial offerings for around the same price, none of them provided native Linux filesystems or allowed SSH access and/or rsync, so I decided to roll my own. This is one way you can make a cost-competitive and low-power RAIDed NAS box in Ubuntu that does ssh/rsync, nfs, and samba. All prices listed are approximate, since I bought more than I needed initially (see below for explanation), but prices do include shipping.

You can probably do it cheaper if you have different requirements. I wanted to reduce the number of moving parts and keep power consumption low, so I went with a passively-cooled mini-ITX motherboard and a CF boot disk. You could easily save about $300 by using more conventional motherboards, but keep an eye out for how much it costs to run the box constantly. My design only has 6 moving parts: 4 SATA HDDs and 2 cooling fans for the HDD enclosure. When off, the power brick consumes 4W (there are likely better models available). On boot, it spikes to 133W while the HDDs power on. At idle, it consumes 67W, and when the RAID is under heavy access, it consumes 77W.

Once all your parts are in, assemble the system. The only tricks involve the power converter board and the hot-swap enclosure. Stick the unprinted part of the power converter motherboard into the PCI Express slot on the motherboard, to keep it away from metal. I also recommend that you attach your enclosure’s topmost SATA drive slot to SATA connector 1 on your motherboard, following the progression down to the bottommost SATA drive slot connecting to SATA connector 4 on your motherboard. This way, if, say, /dev/sda1 fails, you’ll know it’s behind the topmost door in the enclosure.


(*) I ordered more parts than I needed to, and if I avoided the waste with a second RAIDbox, I think the price would be closer to $900. Specific areas of waste were due to cabling and necessary PSU upgrades.

Warranty Madness

I got a deep fryer for Festivus and just hooked it up on Sunday, upon which it immediately made a loud “pop!” noise and blew the breaker it was on.  After much troubleshooting, I determined that the electronics module had sacrificed itself in the name of some unknown cause.  This particular model is modular, and the electronics module is a small part of the overall unit.  I called the manufacturer, T-Fal, to return the defective bit under warranty, and I was told that the warranty “only covers the entire unit, not individual components.”  I asked if the rep realized the absurdity of that, since warranties are usually restrictive in the opposite direction.  I was told, though, that if I wanted to replace just the failed component, I could always just buy one.  Nice!

The reason I was given for the whole “all or nothing” stance is that they’d be doing what amounts to integration testing on the whole unit before sending it back, and if they couldn’t fix the problem, they’d send me a new unit.  Thanks, but I think the mechanical components are fine, based on my previous assembly, and all I need is a replacement electronics module.  My end result will be the same: a working unit.  The bottom line is that I just don’t want to pay more than I have to for shipping to get it.

I’ve been on the other end of this warranty issue, too, and I use the same philosophy.  On rare occasions when there have been component failures with computer systems that I sell, I’ve always complied with customer requests to just send back individual components.  If I know full well that one stick of RAM is bad, why in the world should I make the customer send a 35-pound computer back just so I can swap it for them?  It’s only when the problems couldn’t be remotely diagnosed or addressed that I’ve needed the entire system back.

A supervisor is supposed to call me back in 1-2 days to either try to convince me why I should pay extra for shipping, or to listen to what I want and make it happen.  In the meantime, let’s all think about what’d happen if your aftermarket car stereo’s warranty required that you send them your entire car so that they could do proper integration testing on a replacement unit, or if your rechargeable battery warranty required you to send them any and all devices you used with the batteries so they could test the replacement batteries.

Wind Turbine Research

We occasionally get very strong winds, but it’s often dead calm. I was toying with the idea of getting a good wind speed gauge to get some idea how much electricity I’d get out of various wind turbines, but then I came across the Beaufort Scales which offer a decent heuristic for wind speed and cost nothing. It’s by no means as accurate as a wind gauge, but it’s close enough to get some idea of whether or not a wind turbine would be feasible.

Today, we have 25mph-32mph winds, by my rough estimation. If I got a low-end $538 turbine (and the cost doesn’t include shipping or installation) it seems that I’d get between 250W and 500W(*) right now. At 9.5c/kWhr in my area, $538 would buy 5,663kWhrs (5,663,000 Whrs) of electricity. Doing the math, it’d take the turbine between 1.29 and 2.58 years to produce that amount of electricity if the wind were always as strong as it were today. That isn’t really feasible, given that wind speed here is usually low. I guess I’ll just have to wait for nanosolar to sell to the general public.


(*) The specs say it can do 400W max, but the chart indicates 500W max. It’s not clear which to believe.

rsync for Windows: Quick and Easy

If you have used UNIX/Linux/BSD for very long, then you know about rsync, which allows you to do incremental copies or backups between network-attached UNIX/Linux/BSD systems. Such a free facility is sorely lacking on Microsoft(R) Windows(tm), an expensive proprietary Operating System made by a convicted monopolist, Microsoft(R).

If you have an unencrypted filesystem on Windows(tm), and you need an easy way to do incremental backups of all your data, I recommend booting the Windows(tm) box with a KNOPPIX live CD, which will boot Linux on your Windows(tm) box without actually installing it. From there, you can access all your Windows(tm) data and rsync to another UNIX/Linux/BSD box, and, until you boot back into Windows(tm), you won’t need to use an OS made by a convict.