<?xml version="1.0" encoding="iso-8859-1"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
  <title>Disaggregate Technical Web Log</title>
  <link rel="alternate" type="text/html" href="http://www.Disaggregate.com/blog/technicalweblog/" />
  <modified>2005-12-08T14:42:26Z</modified>
  <tagline>Technical information and commentary on a variety of topics.</tagline>
  <id>tag:www.Disaggregate.com,2006:/blog/technicalweblog/1</id>
  <generator url="http://www.movabletype.org/" version="2.661">Movable Type</generator>
  <copyright>Copyright (c) 2005, Moshe Yudkowsky</copyright>
  <entry>
    <title>udev: eliminating scripts, setting GROUP, understanding variables</title>
    <link rel="alternate" type="text/html" href="http://www.Disaggregate.com/blog/technicalweblog/archives/000014.html" />
    <modified>2005-12-08T14:42:26Z</modified>
    <issued>2005-12-08T08:42:26-06:00</issued>
    <id>tag:www.Disaggregate.com,2005:/blog/technicalweblog/1.14</id>
    <created>2005-12-08T14:42:26Z</created>
    <summary type="text/plain">In response to a few queries, here&apos;s some more information about udev. %p or $devpath or DEVPATH is the path under /sys, but without the leading &quot;/sys.&quot; E.g., the device path will be /sys/block/sdc, and DEVPATH will be &quot;/block/sdc.&quot; $kernel...</summary>
    <author>
      <name>Moshe Yudkowsky</name>
      <url>http://www.Disaggregate.com</url>
      <email>moshe@pobox.com</email>
    </author>
    <dc:subject>General Technology</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.Disaggregate.com/blog/technicalweblog/">
      <![CDATA[<p>In response to a few queries, here's some more information about udev.</p>

<p>%p or $devpath or DEVPATH is the path under /sys, but without the leading "/sys." E.g., the device path will be /sys/block/sdc, and DEVPATH will be "/block/sdc." $kernel or %k is the path *under* dev, e.g., bus/usb/002/017, so /dev/%k is the actual path to the device name.</p>

<p>Using Program. PROGRAM runs *before* the anything is done in the rule. If PROGRAM fails, the entire rule fails. When I was making errors in PROGRAM  -- for example, when I was using the wrong SUBSYTEM, or I didn't give a full path name to umount -- then the SYMLINK wasn't created because PROGRAM returned an error.</p>

<p>So, let's say I want to mount a flash drive. I don't need an external script; I can use:</p>

<p><code>SUBSYSTEM=="block", ACTION=="add", SYSFS{product}=="Flash Disk", SYMLINK="ums", ENV{flashdrive}="%p", RUN+="/bin/mount -t vfat -o user,sync,umask=0000 /dev/%k /ums" </code></p>

<p>Note that you must give the full path name to "mount," otherwise RUN will assume it's a udev script and try to find it in /lib/udev or some other udev-specific location.</p>

<p>If I'd used "PROGRAM" instead of run, then udev would attempt to execute mount before adding the /dev entry, PROGRAM would return a non-zero exit code, and the rule would not execute and the /dev entry would not be made. (Well certainly the SYMLINK would not be made; it's possible the /dev entry is made, but I don't think it is.)</p>

<p>The man page mentions the ENV, but what are the contents of this mysterious variable? They can be viewed by using "udevmonitor --env" -- it gives a printout of each ENV variable as it's used/set. I suspect that there are more than the ones we see...</p>

<p>Aras Vaichas explains that "SUBSYSTEMs are what you find in /sys/class/ /sys/block/ /sys/bus/, e.g. usb, scsi, serio, etc." You can see the SUBSYSTEMs by using "udevmonitor --evn"  and looking for SUBSYTEM. The PHYSDEVDRIVER variable is the associated kernel module.</p>

<p>Finally, setting GROUP for a device you've hotplugged. Instead of using an external script as was the case with hotplug, you can use a simple rule instead. This is how I set GROUP when I mount my USB-enabled camera:</p>

<p><code>SUBSYSTEM=="usb_device", SYSFS{idVendor}=="04a9", SYSFS{idProduct}=="3051", GROUP="camera"</code></p>

<p>The trick is knowing that it's the "usb_device" SUBSYSTEM that creates the USB device entry that gtkam and libgphoto2 use, e.g., /dev/usb/002/017. Finding out what SUBSYSTEM to use is a trail-and-error process, but udevmonitor --env does display the /dev entry when it's created, and that's a very good start.</p>]]>
      
    </content>
  </entry>
  <entry>
    <title>Automounting Flash Drives and MP3 Players with udev </title>
    <link rel="alternate" type="text/html" href="http://www.Disaggregate.com/blog/technicalweblog/archives/000013.html" />
    <modified>2005-12-01T13:49:55Z</modified>
    <issued>2005-12-01T07:49:55-06:00</issued>
    <id>tag:www.Disaggregate.com,2005:/blog/technicalweblog/1.13</id>
    <created>2005-12-01T13:49:55Z</created>
    <summary type="text/plain">In my previous entry, I showed how to use hotplug to automount a flash drive. But that was under devfs; with udev, hotplug is no longer available. Here&apos;s some information on how to get UMS and MP3s to automount on...</summary>
    <author>
      <name>Moshe Yudkowsky</name>
      <url>http://www.Disaggregate.com</url>
      <email>moshe@pobox.com</email>
    </author>
    
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.Disaggregate.com/blog/technicalweblog/">
      <![CDATA[<p>In my previous entry, I showed how to use hotplug to automount a flash drive. But that was under devfs; with udev, hotplug is no longer available. Here's some information on how to get UMS and MP3s to automount on udev. It's not an optimal solution by any means, but it's the one I find useful.</p>

<p>First of all, I suggest you read Daniel Drake's <a href="http://www.reactivated.net/udevrules.php" target="_blank">introduction to udev rules</a>.  As he suggested, I used udevinfo to find an appropriate SYSFS. Please note that udevinfo is a bit buggy: you have to use "udevinfo -q path -a" and not "udevinfo -a -q path" if you want full information.</p>

<p>One you're finished, here's some additional information. Kay Sievers explained to me that 'Sysfs values are not readable at remove, cause the device directory is already gone. You need to match against properties which you can see in udevmonitor --env or you need to store a custom key with ENV{key}="value" in the database, which is imported on remove.'</p>

<p>In order to add and remove the flash drive, I use the following udev rules <em>(modified 20051207 to add SUBSYSTEM)</em>:</p>

<p><code><br />
SUBSYSTEM=="block", ACTION=="add", SYSFS{product}=="Flash Disk",  SYMLINK="ums", RUN+="/etc/hotplug/usb/ums", ENV{flashdrive}="%p"<br />
</code><br />
<code><br />
SUBSYSTEM=="block", ACTION=="remove", ENV{flashdrive}=="%p", RUN+="/etc/hotplug/usb/ums" <br />
</code></p>

<p>The first rule sets, on an "add," the custom environment variable "flashdrive" to the value of DEVPATH (%p). The 2nd rule checks, on a "remove," to see if the devpath that's being removed is the one for the flash drive -- if so, the designated script runs. </p>

<p>Which is great. Something similar works for the iRiver mp3 player too, expect that I use a different SYSFS. Now the problem becomes getting the ums script to work.</p>

<p>Here's what I use. This isn't a perfect solution, because udev calls the ums sript  multiple times (once for usb and once for scsi_generic events). I could eliminate these multiple calls, but I've decided not to bother. <em>Note added 20051207: By adding SUBSYTEM, I call the script just once. The trick is finding the right SUBSYSTEM; several are called during the plugin event. Eventually, I discovered that the "block" is the best one to use; it seems to be the one that handles all devices that need to be block-accessible, i.e., to act as if they were drives.</em></p>

<p>To summarize what the script does: if I receive an add event, and the expected /dev/ums is available, I mount the device to the /ums mount point. On a remove, I umount if it's mounted.</p>

<p>By the way, I've been reluctant to remove the legacy devfs code from the script until this script and udev have been in service for a while; when using udev, /dev/ums is either there or not, and there's no need to check other paths, which makes the "else" path for defining NEWDEV unnecessary.</p>

<p>To make this script work for an iriver, change "ums" to "iriver" in appropriate places.</p>

<p>Script:</p>

<p>#!/bin/bash<br />
##############################################<br />
# iRiver hotplug script<br />
# Written by Stefan Månsby (stefan@nis.nu)<br />
# Version: 0.05<br />
##############################################<br />
# modified MY 2005-01-09<br />
# modified for udev by Moshe Yudkowsky 2005-11-30<br />
MOUNTDIR="/ums"<br />
LOG=/var/log/usb-hotplug.log</p>

<p>ERRCODE=0	# for debugging, do not report errors</p>

<p>lap=$(date --rfc-3339=ns)</p>

<p># defvs: DEVICE seems pretty useless<br />
# need to search for "host*" in DEVPATH<br />
# udev: no need for host* at all<br />
plug() {</p>

<p>echo "...$lap: $DEVICE, $DEVPATH requested" >> $LOG</p>

<p>NEWDEV=""<br />
((count=10))</p>

<p>if [ -b /dev/ums ]<br />
then<br />
	NEWDEV=/dev/ums<br />
else<br />
	<br />
	<br />
	while [ -z $NEWDEV ]<br />
	do<br />
		# look for host* on DEVPATH<br />
		NEWDEV=$(find /sys${DEVPATH} -name "host*")	# find scsi host name<br />
		[[ ! -z $NEWDEV ]] &&<br />
			NEWDEV=$(basename $NEWDEV)		# find  at $(date)" that host<br />
		[[ $count -le 0 ]] && <br />
		{<br />
			echo "...$lap: unable to find $NEWDEV in /sys${DEVPATH}, exiting" >> $LOG<br />
			exit $ERRCODE 	# stop if too many attempts<br />
		}<br />
		((count -=1))<br />
		echo "...$lap: $DEVPATH was not ready, try again" >> $LOG<br />
		sleep 1<br />
	done</p>

<p>	NEWDEV=/dev/scsi/${NEWDEV}/bus0/target0/lun0/disc</p>

<p>fi</p>

<p>echo "...$lap: We wil use device $NEWDEV" >> $LOG</p>

<p>((count=10))</p>

<p>while [ ! -b $NEWDEV ]<br />
do<br />
	echo "...$lap: wait for $NEWDEV to show as device, $count attempts left" >> $LOG<br />
	sleep 1<br />
	((count -= 1))<br />
	[[ $count -le 0 ]] && <br />
	{<br />
		echo "...$lap: cannot get device, exiting" >> $LOG<br />
		exit $ERRCODE<br />
	}<br />
done</p>

<p>echo "...device $NEWDEV is ready" >> $LOG</p>

<p>if [ -b $NEWDEV ]<br />
then<br />
{<br />
	echo "...$lap: $(date) mounting $NEWDEV" >> $LOG</p>

<p>	# mount when plugged in<br />
	if (echo "..."; mount -t vfat -o user,sync,umask=0000 $NEWDEV $MOUNTDIR) >>$LOG 2>&1<br />
	then<br />
		echo "...$lap: mount succeeded" >> $LOG<br />
	else<br />
		echo "...$lap: mount failed" >> $LOG<br />
	fi<br />
}<br />
else<br />
	echo "...$lap: $DEVICE requested, unable to mount or find $NEWDEV" >> $LOG<br />
	reason=$(file $NEWDEV)<br />
	echo "...$lap: Reason: $reason" >> $LOG<br />
fi</p>

<p># create REMOVER script to umount when it unplugs<br />
# if [ ! -b /dev/ums ]<br />
# then<br />
# <br />
# 	:> $REMOVER<br />
# 	echo "umount -f $MOUNTDIR >> $LOG" >> $REMOVER<br />
# 	echo "echo \"$(date) $(time) unmounting /ums\" >> $LOG" >> $REMOVER<br />
# 	<br />
# 	chmod +x $REMOVER<br />
# fi<br />
# <br />
}</p>

<p>unplug() {</p>

<p>if [ ! -b /dev/ums ]<br />
then<br />
	mount | grep --quiet ums && umount $MOUNTDIR && echo "...$lap: umount suceeded"<br />
fi<br />
}</p>

<p># start script</p>

<p># lap=$(date --rfc-3339=seconds)</p>

<p>echo "ums/$lap: udev requested $ACTION" >> $LOG</p>

<p>case $ACTION in <br />
	"add") plug ;;<br />
	"remove") unplug ;;<br />
	*) echo "...No action taken" >> $LOG ;;<br />
esac</p>

<p>exit 0</p>]]>
      
    </content>
  </entry>
  <entry>
    <title>Migration from devfs to udev</title>
    <link rel="alternate" type="text/html" href="http://www.Disaggregate.com/blog/technicalweblog/archives/000012.html" />
    <modified>2005-12-01T12:54:10Z</modified>
    <issued>2005-12-01T06:54:10-06:00</issued>
    <id>tag:www.Disaggregate.com,2005:/blog/technicalweblog/1.12</id>
    <created>2005-12-01T12:54:10Z</created>
    <summary type="text/plain">I recently migrated from devfs to udev; although many users simply make the transition without any problems, I could&apos;t boot up without using devfs. Here&apos;s a mini &quot;how to&quot; that explains how to fix the basic migration from devfs to...</summary>
    <author>
      <name>Moshe Yudkowsky</name>
      <url>http://www.Disaggregate.com</url>
      <email>moshe@pobox.com</email>
    </author>
    <dc:subject>General Technology</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.Disaggregate.com/blog/technicalweblog/">
      <![CDATA[<p>I recently migrated from devfs to udev; although many users simply make the transition without any problems, I could't boot up without using devfs. Here's a mini "how to" that explains how to fix the basic migration from devfs to udev if you find that you can't boot.</p>

<p>Here's a summary of the problem I encountered and how I resolved it. </p>

<p>Problem: as I booted up, I got the usual deluge of reports; then I got three error messages:</p>

<p>/sbin/init: 432 cannot create /dev/null<br />
/sbin/init: 433 cannot open dev/console<br />
Kernel panic -- not syncing: Attempted to kill init!</p>

<p>After a bit of research and some asking around, I found that the answer was as follows.</p>

<p>There's a difference between devfs and udev. Devfs makes the <br />
"console" and "null" files available by the time the files are needed <br />
during the boot. udev starts later in the boot cycle, so you must supply your own copy of /dev/console and /dev/null. (There's a facility in udev that's supposed to create these files in advance (/etc/udev/links.conf in the Debian package), but it didn't work in my case.)</p>

<p>Therefore, before trying to boot using udev only, make certain you have a "console" and "null" file in /dev. Of course, if your system is running, you have these files now -- but the question is, were they part of the /dev directory, or did devfs put it there? Here's how to check.</p>

<p>* First, mount the root directory someplace other than /, so that the /dev <br />
directory can be examined as a standalone -- so it can be seen as it looks without stuff that devfs puts there. As root, issue the command:</p>

<p># mount -o bind / /mnt</p>

<p>(where /mnt is some random mouting point).</p>

<p><br />
* Next, look at /mnt/dev. You need to have two special files there, console and null:</p>

<p>crw------- root root 5, 1 Nov 28 16:50 console<br />
crw-rw-rw- root root 1, 3 Nov 28 16:51 null</p>

<p>If you have them already, you're all set. On my system, I had "null" and it was *not* a "c" (special character) file; it was an ordinary file. I got rid of that file and issued the following commands to create console and null:</p>

<p><br />
# mknod -m 660 console c 5 1<br />
# mknod -m 660 null c 1 3</p>

<p><br />
* Unmount the / file system:</p>

<p># umount /mnt.</p>

<p>* Make certain you have udev! Linux 2.6.14-2 requires udev to boot, but you are responsible for actually installing udev.</p>

<p>* Once /dev/console and /dev/null exist, you can boot using udev only. (For example, on my system, a boot using udev only is done by removing the "devfs=mount" command from lilo.) There's other stuff to do to convert completely to udev, but this gets you started.</p>]]>
      
    </content>
  </entry>
  <entry>
    <title>Hotplug for USB Mass Storage (UMS)</title>
    <link rel="alternate" type="text/html" href="http://www.Disaggregate.com/blog/technicalweblog/archives/000011.html" />
    <modified>2005-01-10T16:49:14Z</modified>
    <issued>2005-01-10T10:49:14-06:00</issued>
    <id>tag:www.Disaggregate.com,2005:/blog/technicalweblog/1.11</id>
    <created>2005-01-10T16:49:14Z</created>
    <summary type="text/plain">For some reason, getting USB mass storage (UMS) to work with hotplugging on Linux seems to be a bit of a mystery -- as far as I can tell, there&apos;s no documentation at all for the user. In this &quot;how-to&quot;...</summary>
    <author>
      <name>Moshe Yudkowsky</name>
      <url>http://www.Disaggregate.com</url>
      <email>moshe@pobox.com</email>
    </author>
    <dc:subject>General Technology</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.Disaggregate.com/blog/technicalweblog/">
      <![CDATA[<p>For some reason, getting USB mass storage (UMS) to work with hotplugging on Linux seems to be a bit of a mystery -- as far as I can tell, there's no documentation at all for the user. In this "how-to" note I'm going to discuss how I managed to get it working on my system. This same script works for my UMS-style iRiver MP3 player.</p>

<p>I have hotplugging installed on my Debian 2.6.9 version Linux system. Inside the /etc/hotplug directory is one file to examine, one file to alter, and one file to add.</p>

<p>Hotplugging works as follows. When I plug something into the USB bus, it generates an "add" event, and when I remove something it generates a "remove" event. The usb.agent file runs on either of these events, and is called with a list of information about the event:</p>

<p><code>idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info </code></p>

<p>The usb script also has access to these variables:<br />
<code><br />
# Kernel USB hotplug params include:<br />
#       ACTION=%s [add or remove]<br />
#       DEVPATH=%s [in 2.5 kernels, /sys/$DEVPATH]<br />
#       PRODUCT=%x/%x/%x<br />
#       INTERFACE=%d/%d/%d [ for interface 0, if TYPE=0/*/* ]<br />
#       TYPE=%d/%d/%d<br />
# And if usbfs (originally called usbdevfs) is configured, also:<br />
#       DEVFS=/proc/bus/usb [gone in 2.5]<br />
#       DEVICE=/proc/bus/usb/%03d/%03d<br />
</code></p>

<p>There's no formal documentation, as far as I can tell, what these mean, even though they are crucial to get hotplugging to work. Don't despair -- this note supplies these missing links.</p>

<p>The usb.agent executable now decides what to do next. It looks in usb.distmap and usb.usermap to determine if there's anything to be done.</p>

<p>The entries in usb.usermap and usb.distmap are as follows:</p>

<p><code><br />
usb module         match_flags idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info</code></p>

<p>"usb_module" is the name of an executable to run *if* the current event matches the information in the rest of the line. What has to match? "match_flags" tells you which items from the list must match:</p>

<p><code><br />
USB_MATCH_VENDOR=$((0x0001))<br />
USB_MATCH_PRODUCT=$((0x0002))<br />
USB_MATCH_DEV_LO=$((0x0004))<br />
USB_MATCH_DEV_HI=$((0x0008))<br />
USB_MATCH_DEV_CLASS=$((0x0010))<br />
USB_MATCH_DEV_SUBCLASS=$((0x0020))<br />
USB_MATCH_DEV_PROTOCOL=$((0x0040))<br />
USB_MATCH_INT_CLASS=$((0x0080))<br />
USB_MATCH_INT_SUBCLASS=$((0x0100))<br />
USB_MATCH_INT_PROTOCOL=$((0x0200))<br />
</code></p>

<p>To pick a non-random example: Let's say I have a UMS flash drive and I want to run a particular script every time it's plugged in. I used "match vendor" and "match product", which makes match_flags = 0x3, and if that UMS device is plugged in, a particular script runs. </p>

<p>The real mystery is how find the idVendor, idProduct, etc. I found that by using lsusb -v:<br />
<code><br />
Device Descriptor:<br />
  bLength                18<br />
  bDescriptorType         1<br />
  bcdUSB               2.00<br />
  bDeviceClass            0 (Defined at Interface level)<br />
  bDeviceSubClass         0<br />
  bDeviceProtocol         0<br />
  bMaxPacketSize0        64<br />
  idVendor           0x0ea0 Ours Technology, Inc.<br />
  idProduct          0x2168 Transcend JetFlash 2.0<br />
  bcdDevice            2.00<br />
  iManufacturer           1<br />
  iProduct                2<br />
  iSerial                 3<br />
  bNumConfigurations      1<br />
</code><br />
so the line in usb.usermap now looks like this:</p>

<p><code>ums (module to run) 0x3 (what to match) 0x0ea0 (vendor ID) 0x2168  (product ID)</code></p>

<p>and the rest all zeros. In actuality, the line looks like:</p>

<p><code>ums 0x0003   0x0ea0  0x2168  0x0000  0x0000 0x00   0x00   0x00  0x00 0x00 0x00 0x00000000</code></p>

<p>If I were feeling clever, and I may feel clever some day, I might decide to make a universal flash, mass storage mounting hotplug system. To do that, I'd use the rest of the lsusb -v information:</p>

<p><code><br />
      bLength                 9<br />
      bDescriptorType         4<br />
      bInterfaceNumber        0<br />
      bAlternateSetting       0<br />
      bNumEndpoints           3<br />
      bInterfaceClass         8 Mass Storage<br />
      bInterfaceSubClass      6 SCSI<br />
      bInterfaceProtocol     80 Bulk (Zip)<br />
      iInterface              0<br />
</code></p>

<p>Clearly, could use bInterfaceClass to select "mass storage" and write a module of that type. But I digress.</p>

<p>So, when I plug in my UMS device, usb.agent looks into user.usermap, finds the matching idVendor and idProduct, sees that it need only match those two, and attempts to run the module named on that line. That module is called "ums," and it resides in /etc/hotplug/usb.</p>

<p>"ums" accomplishes two tasks: (a) it mounts the flash drive and (b) has a script to umount the flash drive on disconnect. </p>

<p>Here's the ums script, part by part. First I create a log file:</p>

<p><code>MOUNTDIR="/ums"<br />
LOG=/var/log/usb-hotplug.log</code></p>

<p>Next I try to find where this usb device is mounted, which is *really hard* to do. On my system, on each hotplug, devfs  and sd_mod conspire to mount the drive on a different part of the SCSI chain. My goal is to find the SCSI device and mount it.</p>

<p>I log the DEVICE and DEVPATH that's inherited from the usb.agent script:</p>

<p><code><br />
# DEVICE seems pretty useless<br />
# need to search for "host*" in DEVPATH<br />
echo "$(date) $(time) $DEVICE, $DEVPATH requested" &gt;&gt; $LOG<br />
</code></p>

<p>Next, I search along DEVPATH to find a "host[0-9][0-9]" directory. DEVPATH looks like "/devices/pci0000:00/0000:00:10.3/usb4/4-2/4-2:1.0" , and it must be preceeded by "/sys" to point to a real directory structure. If I find a directory called, e.g., host21, I've seen on my system that this means that the flash drive is associated to /dev/scsi/host21/bus0/target0/lun0/disc.</p>

<p><code>NEWDEV=""<br />
((count=10))<br />
while [ -z $NEWDEV ]<br />
do<br />
        # look for host* on DEVPATH<br />
        NEWDEV=$(find /sys${DEVPATH} -name "host*")     # find scsi host name<br />
        NEWDEV=$(basename $NEWDEV)              # find just that host name<br />
        [[ $count -le 0 ]] && break     # stop if too many attempts<br />
        ((count -=1))<br />
        echo "$(date) $(time) $DEVPATH was not ready, try again" >> $LOG<br />
        sleep 1<br />
done</code></p>

<p><br />
This goes in a loop. The USB event happens immediately, but it takes time for sd_mod to create the SCSI entry, and so if it's not ready first time around I wait a second and try again, up to 10 times. It's never taken more than once.</p>

<p><code>NEWDEV=/dev/scsi/${NEWDEV}/bus0/target0/lun0/disc<br />
</code></p>

<p>The name of the SCSI drive that corresponds to the usb flash drive</p>

<p><code>((count=10))<br />
if [ ! -b $NEWDEV ]<br />
then<br />
        echo "$(date) $(time) wait for $NEWDEV to show as SCSI device" >> $LOG<br />
        sleep 1<br />
        ((count -= 1))<br />
        [[ $count -le 0 ]] && break<br />
fi</code></p>

<p>Wait to make certain that the drive is created by the SCSI software. <br />
Mount the drive if it exists:</p>

<p><code>if [ -b $NEWDEV ]<br />
then<br />
{<br />
        echo "$(date) $(time) mounting $NEWDEV" >> $LOG<br />
        # mount if plugged in<br />
         mount -t vfat -o user,sync,umask=0000 $NEWDEV $MOUNTDIR >>$LOG 2>&1<br />
}</code></p>

<p>If it doesn't exist, write a faliure to the log file:</p>

<p><br />
<code>else<br />
        echo "$(date) $(time) $DEVICE requested, unable to mount or find $NEWDEV" >> $LOG<br />
        reason=$(file $NEWDEV)<br />
        echo "Reason: $reason" >> $LOG<br />
fi<br />
</code><br />
usb.agent expects a script named $REMOVER to exist which explains what to do when the device is unplugged. Create this script, which  in our case will umount the drive, by echoing instructions into the file $REMOVER:</p>

<p><code># create REMOVER script to umount when it unplugs<br />
:> $REMOVER<br />
echo "umount -f $MOUNTDIR >> $LOG" >> $REMOVER<br />
echo "echo \"$(date) $(time) unmounting /ums\" &gt;&gt; $LOG" &gt;&gt; $REMOVER<br />
chmod +x $REMOVER<br />
</code></p>

<p>If you're curious, REMOVER will be found in /var/run/usb.</p>

<p>The reason for this roundabout way of finding the SCSI disk is because there doesn't really seem to be any other way of extracting the information. There's no file that I've found in the USB chain that says "this USB device is represented by the SCSI deviced named 'X'."</p>

<p>Log output:</p>

<p><code>Mon Jan 10 10:10:50 CST 2005  /proc/bus/usb/004/023, /devices/pci0000:00/0000:00:10.3/usb4/4-2/4-2:1.0 requested<br />
Mon Jan 10 10:10:50 CST 2005  /devices/pci0000:00/0000:00:10.3/usb4/4-2/4-2:1.0 was not ready, try again<br />
Mon Jan 10 10:10:51 CST 2005  mounting /dev/scsi/host21/bus0/target0/lun0/disc</code></p>

<p>At the same time, from the messages log:</p>

<p><code>Jan 10 10:10:50 bagpipes usb.agent[12238]:      usb-storage: already loaded<br />
Jan 10 10:10:50 bagpipes kernel: SCSI device sdb: 128000 512-byte hdwr sectors (66 MB)<br />
Jan 10 10:10:50 bagpipes kernel: sdb: assuming Write Enabled<br />
Jan 10 10:10:50 bagpipes usb.agent[12238]:      ums: loaded successfully<br />
Jan 10 10:10:50 bagpipes kernel:  /dev/scsi/host21/bus0/target0/lun0:<br />
Jan 10 10:10:50 bagpipes kernel: Attached scsi removable disk sdb at scsi21, channel 0, id 0, lun 0<br />
Jan 10 10:10:51 bagpipes scsi.agent[12240]: disk at /devices/pci0000:00/0000:00:10.3/usb4/4-2/4-2:1.0/host21/21:0:0:0<br />
</code></p>]]>
      
    </content>
  </entry>
  <entry>
    <title>Modules, Modprobe, and Modutils: Migration Issues from Linux 2.4 to 2.6</title>
    <link rel="alternate" type="text/html" href="http://www.Disaggregate.com/blog/technicalweblog/archives/000010.html" />
    <modified>2004-10-28T01:51:48Z</modified>
    <issued>2004-10-27T20:51:48-06:00</issued>
    <id>tag:www.Disaggregate.com,2004:/blog/technicalweblog/1.10</id>
    <created>2004-10-28T01:51:48Z</created>
    <summary type="text/plain">When I migrated from Linux 2.4 to 2.6, I had some trouble with modules loading. In particular, when I booted the machine, my bcm5700.ko module didn&apos;t get control of my Ethernet interface; instead, a module called &quot;eth1394&quot; did instead. And...</summary>
    <author>
      <name>Moshe Yudkowsky</name>
      <url>http://www.Disaggregate.com</url>
      <email>moshe@pobox.com</email>
    </author>
    <dc:subject>General Technology</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.Disaggregate.com/blog/technicalweblog/">
      <![CDATA[<p>When I migrated from Linux 2.4 to 2.6, I had some trouble with modules loading. In particular, when I booted the machine, my bcm5700.ko module didn't get control of my Ethernet interface; instead, a module called "eth1394" did instead. And then another module, tg3, took a whack at the interface as well; tg3 is the default ethernet driver, but Broadcom recommends their own bcm5700 module instead.</p>

<p>When my Ethernet insterface didn't work at all after booting into 2.6.8, I used "lsmod" to determine what modules were installed, and after loading and unloading modules, starting and stopping networking, and reading /var/log/messages to see how the boot went, discovered that bcm5700 wasn't loading but did work if loaded. This was very puzzling, because /etc/modules.conf was very explicit in trying to load bcm5700 for the eth0 interface.</p>

<p>I went to the /etc/modutils directly and tried to get the eth1394 (which is listed as "ip1394" in the log for unknown reasons) to stop loading. I used:</p>

<p>alias eth1393 off<br />
alias tg3 off</p>

<p>to get these two modules to never load. (The commands went into a file called "networking-A7V8X" that I use to control kernel modules related to networking.) I rebuilt /etc/modules.conf using update-modules, rebooted the machine &mdash; and the modules loaded anyway.</p>

<p>In other words, /etc/modules.conf was being ignored by modprobe during boot time.</p>

<p>Eventually I stumbled across the answer by <b>reading</b> the man page for modprobe instead of just skimming it. Modprobe has changed between 2.4 and 2.6. The old information my /etc/modutils and /etc/modules.conf is not read under 2.6, and the Debian upgrade process won't automatically migrate my custom configurations from 2.4 to 2.6.</p>

<p>2.6 uses a /etc/modprobe.d directory, and it does not need a "/etc/modprobe.conf" file; it reads all the appropriate *.conf files and compiles the information at boot time. Very handy, actually.</p>

<p>To solve the problem of the eth1394 and tg3 grabbing the Ethernet interface, I used the "alias x off" commands I list above, placed them in a file in /etc/modprobe.d, and rebooted. This time the system functioned as expected and the Ethernet system used the proper bcm5700.ko driver.</p>

<p>I realize that there are other ways to force a particular driver/module to associate with a particular physical interface (use the "mapping" keyword in /etc/network/interfaces), but this one works for me as I don't need eth1394 for anything at the moment.</p>]]>
      
    </content>
  </entry>
  <entry>
    <title>Migrating Broadcom bcm5700 from 2.4 to 2.6</title>
    <link rel="alternate" type="text/html" href="http://www.Disaggregate.com/blog/technicalweblog/archives/000009.html" />
    <modified>2004-10-28T01:29:52Z</modified>
    <issued>2004-10-27T20:29:52-06:00</issued>
    <id>tag:www.Disaggregate.com,2004:/blog/technicalweblog/1.9</id>
    <created>2004-10-28T01:29:52Z</created>
    <summary type="text/plain">Here&apos;s a technical note on how to migrate from a Broadcomm bcm5700 Ethernet driver under Linux 2.4.x (bcm5700.o) to a 2.6.x driver (bcm5700.ko). I did this migration on a Debian system based on an Asus A7V8X, and I&apos;ve found that...</summary>
    <author>
      <name>Moshe Yudkowsky</name>
      <url>http://www.Disaggregate.com</url>
      <email>moshe@pobox.com</email>
    </author>
    <dc:subject>General Technology</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.Disaggregate.com/blog/technicalweblog/">
      <![CDATA[<p>Here's a technical note on how to migrate from a Broadcomm bcm5700 Ethernet driver under Linux 2.4.x (bcm5700.o) to a 2.6.x driver (bcm5700.ko). I did this migration on a Debian system based on an Asus A7V8X, and I've found that the documentation on how to do this is a little scanty.</p>

<p>To start, get the source of the Broadcom driver:</p>

<p>apt-get install bcm5700-source</p>

<p>This will install itself in /usr/src as a gzip file. As root, go to the /usr/src directory and unpack the file:</p>

<p>tar zxf bcm5700-source.tar.gz</p>

<p>This creates a directory <i>modules</i>, under which will be a directory <i>bcm5700</i> which contains the source code.</p>

<p>The next step is to compile the bcm5700 source code. You don't need to be running 2.6.x to do this. You do need the current headers of your target kernel image. E.g., if you want bcm5700 to work for 2.6.8-1-k7, you will need the kernel headers for 2.6.8-1-k7. You don't need the source for the entire kernel.</p>

<p>To get the kernel headers, use</p>

<p>apt-get kernel-headers-2.6.8-1-k7</p>

<p>or whatever is appropriate for your target kernel. The headers will appear in your /usr/src directory as well.</p>

<p>You need to make /usr/src/linux point to these kernel headers. On my system, /usr/src/linux is simply a symlink to a real directory. I removed the old symlink (<i>rm linux</i>) and used</p>

<p>ln -s kernel-headers-2.6.8-1-k7 linux</p>

<p>to create the symlink. To compile the bcm5700.ko module, go to the /usr/src/linux directory and type</p>

<p>make-kpkg modules</p>

<p>This will make a Debian package in the /usr/src directory. You can then use</p>

<p>dpkg -i bcm5700-module-2.6.8_7.3.5-3+10.00.Custom_i386.deb </p>

<p>(or whatever the Debian is called on your sytsem) to install the driver. However, I could not figure out how to persuade make-kpkg to give the proper version to the Debian package; as you can see above it thinks it made a driver for 2.6.8, not 2.6.8-1-k7. This means that when I did the <i>dpkg -i</i> to install the Debian package, Debian failed partway through and  put the bcm5700.ko file into /lib/modules/2.6.8, instead of it's proper place in /lib/modules/2.6.8-1-k7. No worries -- I copied the driver from there to /lib/modules/2.6.8-1-k7/kernel/drivers/net/bcm5700.ko, and I was ready to go.</p>

<p>That's it for creating the driver module. Fairly straightforward.</p>

<p>However, that doesn't mean that the driver actually loaded when I booted up the sytsem &mdash something else grabbed control of the Ethernet interface. See my next technical note, about migrating from Linux 2.4 and its system of /etc/modules.conf to Linux 2.6 and its system of /etc/modprobe.d, for details on how to resolve this little problem.</p>]]>
      
    </content>
  </entry>
  <entry>
    <title>New Exploit: Two Part Phishing</title>
    <link rel="alternate" type="text/html" href="http://www.Disaggregate.com/blog/technicalweblog/archives/000008.html" />
    <modified>2004-07-26T15:51:29Z</modified>
    <issued>2004-07-26T10:51:29-06:00</issued>
    <id>tag:www.Disaggregate.com,2004:/blog/technicalweblog/1.8</id>
    <created>2004-07-26T15:51:29Z</created>
    <summary type="text/plain">I guess this isn&apos;t really phishing, but it&apos;s the most complex exploit I&apos;ve seen. Last night and today I received several bounce messages, each containing a zip file that I purportedly sent to myself. The bounce messages didn&apos;t smell quite...</summary>
    <author>
      <name>Moshe Yudkowsky</name>
      <url>http://www.Disaggregate.com</url>
      <email>moshe@pobox.com</email>
    </author>
    <dc:subject>Security</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.Disaggregate.com/blog/technicalweblog/">
      <![CDATA[<p>I guess this isn't really phishing, but it's the most complex exploit I've seen.</p>

<p>Last night and today I received several bounce messages, each containing a zip file that I purportedly sent to myself. The bounce messages didn't smell quite right, since they lacked copies of the original headers in the bounce message. Of course I discarded the entire message including the zip file immediately &mdash; I wasn't about to run a virus. </p>

<p>All the bounces theoretically had originated somehow with Pobox, the service I use to "wash" my email and stem off some of the flood of spam. And that should have raised a red flag, because pobox generally has impeccable bounce messages. And looking back after the fact, I can see that all the bounces were forged bounces.</p>

<p>Forged <i>bounces</i>? Why send forged bounces?</p>

<p>Part 2 of the exploit just arrived, a message "from pobox" which states:</p>

<p>> Your account was used to send a large amount of junk email messages during this week.<br />
> Obviously, your computer was compromised and now runs a trojaned proxy server.<br />
> <br />
> Please follow our instruction in order to keep your computer safe.</p>

<p>and includes a zip file -- which, by the way, doesn't trip online spam detectors. The message immediately tripped my internal bogosity detectors, and that's when I noticed that the message didn't originate with Pobox.</p>

<p>I've notified pobox, but this is the most sophisticated phishing expedition I've seen -- even if it doesn't technically count as phishing. The goal is to get the recipient to open the zip file included in the bounce messages.</p>

<p>It's clever, and I suspect it will be very effective. I've seen it against Pobox, but I'm starting to get bounce messages that lead me to believe it's about to be launched against other sites as well.</p>

<p><i>Further information, added 07-27</i>: It seems that this worm is a variant of My.Doom, and it actually is not a coordinated attack; it's just a coincidence that I got the bounce messages before I received the your-machine-is-compromised messages. I wonder how long until we see more sophisticated, coordinated attacks? </p>]]>
      
    </content>
  </entry>
  <entry>
    <title>Computer Crash? Blame Verizon</title>
    <link rel="alternate" type="text/html" href="http://www.Disaggregate.com/blog/technicalweblog/archives/000007.html" />
    <modified>2004-06-22T13:39:47Z</modified>
    <issued>2004-06-22T08:39:47-06:00</issued>
    <id>tag:www.Disaggregate.com,2004:/blog/technicalweblog/1.7</id>
    <created>2004-06-22T13:39:47Z</created>
    <summary type="text/plain"><![CDATA[If your PC is slow, crashing, or otherwise misbehaving, it may be because of Verizon. Or British Airways. Or one of another dozen large companies that have advertised through malware from Claria and WhenU. Claria, formerly Gator, installs malware &mdash;...]]></summary>
    <author>
      <name>Moshe Yudkowsky</name>
      <url>http://www.Disaggregate.com</url>
      <email>moshe@pobox.com</email>
    </author>
    <dc:subject>Blunders</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.Disaggregate.com/blog/technicalweblog/">
      <![CDATA[<p>If your PC is slow, crashing, or otherwise misbehaving, it may be because of Verizon. Or British Airways. Or one of another dozen large companies that have advertised through malware from Claria and WhenU.</p>

<p>Claria, formerly Gator, installs malware &mdash; specifically, "adware" that spies on your Internet browsing and pops up a window when you hit specific web sites. For example, L. L. Bean alleges in a lawsuit that Nordstrom and J. C. Penny, former Claria customers, would pop up ads for those companies when a potential customer visited the L. L. Bean web site. (Claria has sued L. L. Bean, in return, for filing a "sham lawsuit.")</p>

<p>How does Claria and WhenU software get onto a computer? Usually as part of installation of other software. A download of a "web browser search tool" will have a  note, buried deep in the disclaimers, that the software spies on your web browsing and pops up ad windows.  This makes installing the malware legal. Despicable, but legal.</p>

<p>In my experience, malware is one reason that people think their computers are "slowing down." I've done troubleshooting on slow computers only to find that malware (not necessarily Claria's and WhenU's) has made the computer utterly unusable. I believe that a good number of people purchase new computers because their old ones couldn't support all the malware loaded on it.</p>

<p>So, why blame Verizon? Verizon, by purchasing ads through Claria, helps to support the malware industry. They aren't ashamed of what they've done; their spokeman said that "it's much more efficient" than other forms of advertising. In other words, Verizon supports malware, and by doing so encourages an despicable industry that does despicable things.</p>

<p>Here's a list, as published in the Wall Street Journal and gleamed by me from the Claria web site, of current and former customers of Claria and WhenU:</p>

<ul>
<li>Verizon</li>
<li>Spritnt</li>
<li>Motorola</li>
<li>Orbitz</li>
<li>British Airways</li>
<li>Bank of America</li>
<li>eHarmony.com</li>
<li>Priceline.com</li>
<li>Shopping.com</li>
</ul>

<p>If you have a business relationship with one of these companies, you might want to make them of your opinion of malware. </p>]]>
      
    </content>
  </entry>
  <entry>
    <title>Not With the Program: Nosa Eke, Call Center Times</title>
    <link rel="alternate" type="text/html" href="http://www.Disaggregate.com/blog/technicalweblog/archives/000006.html" />
    <modified>2004-06-22T12:13:47Z</modified>
    <issued>2004-06-22T07:13:47-06:00</issued>
    <id>tag:www.Disaggregate.com,2004:/blog/technicalweblog/1.6</id>
    <created>2004-06-22T12:13:47Z</created>
    <summary type="text/plain">When I first thought of this category, industry blunders, I thought I&apos;d be discussing poorly-designed user interfaces. Instead, I find myself discussing errors and mis-steps. Our inaugural blunder comes from Nosa Eke, publisher of &quot;Call Center Times.&quot; After sending me...</summary>
    <author>
      <name>Moshe Yudkowsky</name>
      <url>http://www.Disaggregate.com</url>
      <email>moshe@pobox.com</email>
    </author>
    <dc:subject>Blunders</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.Disaggregate.com/blog/technicalweblog/">
      <![CDATA[<p>When I first thought of this category, industry blunders, I thought I'd be discussing poorly-designed user interfaces. Instead, I find myself discussing errors and mis-steps. </p>

<p>Our inaugural blunder comes from Nosa Eke, publisher of "Call Center Times." After sending me not just one but six copies of a piece of spam, I sent her a complaint and asked to be taken off her mailing list. </p>

<p>Her response? "If you have such a problem with being contacted," she writes, "have you considered removing your name as the point of contact in listings such as Buyer's Guides etc..? [sic]". Not only does she implicitly confess to harvesting my email address from a web site -- something I already knew -- she has the <i>chutzpah</i> to tell me that it's my tough luck. And her command of the English language makes me wonder about the magazine she publishes.</p>

<p>After getting more than a few more missives from her, I put here onto "autoreponse." It's a little script that I wrote that sends a couple of thousand complaint emails back to the originator, triggered by spam to me. Remarkably, she somehow managed to find the time to remove me from her list after just one autoresponse.</p>

<p>Nosa Eke's email address is neke@callcentertimes.com. You might want to put it on your blacklist.</p>]]>
      
    </content>
  </entry>
  <entry>
    <title>Online Servers for VoiceXML and CCXML</title>
    <link rel="alternate" type="text/html" href="http://www.Disaggregate.com/blog/technicalweblog/archives/000005.html" />
    <modified>2004-06-04T02:42:15Z</modified>
    <issued>2004-06-03T21:42:15-06:00</issued>
    <id>tag:www.Disaggregate.com,2004:/blog/technicalweblog/1.5</id>
    <created>2004-06-04T02:42:15Z</created>
    <summary type="text/plain"><![CDATA[There's a few &mdash; sometimes very well hidden &mdash; places on the Internet that allow developers to host VoiceXML or CCXML applications at no charge. You can write a VoiceXML or CCXML application, place the application on a telephony server,...]]></summary>
    <author>
      <name>Moshe Yudkowsky</name>
      <url>http://www.Disaggregate.com</url>
      <email>moshe@pobox.com</email>
    </author>
    <dc:subject>Speech Technology</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.Disaggregate.com/blog/technicalweblog/">
      <![CDATA[<p>There's a few &mdash; sometimes very well hidden &mdash; places on the Internet that allow developers to host VoiceXML or CCXML applications at no charge. You can write a VoiceXML or CCXML application, place the application on a telephony server, and then call into the server and interact with the application. Here's a list of the companies that I know about that provide free hosting services to developers; if I've left one out, please feel to contact me and let me know about it.<br />
<h3>Voxeo</h3><br />
<a href="http://www.voxeo.com">Voxeo</a> has the only <a href="http://community.voxeo.com">online server</a> that offers access to both VoiceXML 2.0 and CCXML interpreters. Voxeo is my favorite place to develop VoiceXML applications. They offer tutorials, documentation, space on their server to store scripts, a way to access scripts that are on your own server, pre-recorded voices, an online debugger (requires IE), and a PC-based application that lets you manipulate the applications.</p>

<p>Voxeo also offers access via 800 numbers and ordinary numbers; like most places they require access via a PIN. However you can request a unique telephone number for an application, which is convenient if you want to have other people access your demo. Voxeo also assigns each application a SIP telephone number.</p>

<p>What I like most about Voxeo is their "Extreme Support." Email to customer service is answered very quickly, generally within the hour, and their customer support people are very, very knowlegable. And it's also clear that their managers monitor customer support to make certain that questions are answered. Since there has never been and probably never will be a manual that answers all my questions, swift and accurate customer support is wonderful.</p>

<p><h3>Tellme</h3></p>

<p>Tellme</a> offers an <a href="http://studio.tellme.com">online server</a> for developers, but for some reason it's impossible (at least for me) to find it through their <a href="http://www.tellme.com">regular home page</a>. </p>

<p>Tellme offers VoiceXML 2.0, tutorials, documentation, code samples, some space on their server to store application (I haven't used it much), a way to access scripts on your own server, 800 access numbers (not unique), and pre-recorded voices. You can call the server to record your own prompts.</p>

<p>Tellme also offers a syntax checker, which lets you check your application's syntax without actually running it.</p>

<p><h3>Voicegenie</h3></p>

<p>I haven't actually tried <a href="http://www.voicegenie.com">Voicegenie's</a> <a href="http://developer.voicegenie.com/">online server</a> just yet. Voicegenie offers VoiceXML 2.0, documentation, an online syntax checker, a grammar wizard to help develop grammars, recording prompts over the phone, documentation, tutorials, sample code, and forum-based support.</p>

<p>Voicegenie does have some oddities. Some of their links lead to Voicegenie-supported websites that haven't been updated with developer information since 2002. And their developer agreement doesn't let developers "disclose results of any benchmark tests of such development tools to any third party without VoiceGenie Technologies' prior written approval."</p>

<p><h3>BeVocal</h3></p>

<p><a href="http://www.BeVocal.com">BeVocal's</a> claim to fame is that its <a href="http://cafe.bevocal.com">online server</a> has voice biometrics, such as speaker identification and verification. It makes for a nice demo (you can get one from <a href="http://www.disaggregate.com/tech/index-downloads.html">here</a> on my web site).</p>

<p>Otherwise, BeVocal offers everything: tutorials, documenation, online syntax checking, debugging tools, and a tool that lets you interact with your application in text mode. Files can be located on their server or your server. Support is via their forums, with turnaround times of up to one day.</p>

<p><h3>Closing Remarks</h3></p>

<p>I've used VoiceXML interpreters running on my laptop to demo VoiceXML; for example, IBM's VoiceXML interpreter downloaded from <a href="http://www.alphaworks.ibm.com/tech/voicexml">IBM Alphaworks</a>; CCXML is available both at IBM Alphaworks and elsewhere. However, I find that running my applcations on a remote online server that's connected into the PSTN &mdash; and now SIP! &mdash; provides me with tools that otherwise simply aren't available.</p>]]>
      
    </content>
  </entry>
  <entry>
    <title>Software to defend and fix your PC</title>
    <link rel="alternate" type="text/html" href="http://www.Disaggregate.com/blog/technicalweblog/archives/000004.html" />
    <modified>2004-05-31T14:38:52Z</modified>
    <issued>2004-05-31T09:38:52-06:00</issued>
    <id>tag:www.Disaggregate.com,2004:/blog/technicalweblog/1.4</id>
    <created>2004-05-31T14:38:52Z</created>
    <summary type="text/plain">This article provides a list of the software packages that I use to either secure a PC or to fix a PC that&apos;s been infected by viruses, trojans, malware, and the like....</summary>
    <author>
      <name>Moshe Yudkowsky</name>
      <url>http://www.Disaggregate.com</url>
      <email>moshe@pobox.com</email>
    </author>
    <dc:subject>Security</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.Disaggregate.com/blog/technicalweblog/">
      <![CDATA[<p>This article provides a list of the software packages that I use to either secure a PC or to fix a PC that's been infected by viruses, trojans, malware, and the like.</p>]]>
      <![CDATA[<p>All the software on this list is free of charge, but often you can get an upgraded version for a few dollars, or donate some money to the author to help support the program.</p>

<p><h4>Firewall</h4></p>

<p>For use with a laptop when traveling, or for use when people don't have a hardware firewall, I use ZoneAlarm from <a href="http://www.zonelabs.com/store/content/home.jsp">Zonelabs</a>. I use ZA to protect the PC from intrusion &mdash; ZA can be configured to check your email, but I use a different program to screen for viruses.</p>

<p>For home installations I prefer hardware firewalls that also do NAT. I do not like D-Link or Belkin firewalls, the former because the "D" seems to stand for "Don't", and the latter because of what I consider <a href="http://www.gripe2ed.com/scoop/story/2003/11/7/144457/945">egregious corporate misbehavior</a>.</p>

<p><h4>Anti-virus</h4></p>

<p>I use <a href="http://www.free-av.com">AntiVir</a>. Antivir seesm to do a credible job of finding and cleaning viruses. AntiVir also has a "scheduler" built-in that lets you schedule when to run a scan of the disk automatically; twice a week is sufficient in my opinion. AntiVir also does a very credible job of downloading and installing updates automatically, also using a scheduler.</p>

<p>Antivir is what I recommend to defend against downloading virus emails, files, etc. Set it to load and run on startup. And make certain that you never have two antivirus programs running at the same time.</p>

<p><h4>Anti-Malware</h4></p>

<p>I recommend two packages, <a href="http://www.lavasoft.de/">Lavasoft's AdAware</a>, and <a href="http://safer-networking.org/">Spybot</a>. Both programs have their strengths and weaknesses, so it's best to use both of them from time to time.</p>

<p>The main defense against malware is to not load disreputable programs onto your computer; I don't have problems with malware on my machine (that I'm aware of). Spybot lets you "immunize" Internet Explorer against malicious software downloads.</p>

<p><h4>Browser</h4><br />
Needless to say, the best way to avoid the terrible security problems of Internet Explorer and Outlook is to use other programs instead. Other programs are far more secure and have better features.</p>

<p>For a browser, I recommend <a href="http://www.mozilla.org">Mozilla</a>. Among other things, Mozilla has exellent security features built-in, such as a setting that surpresses pop-up windows.</p>

<p>Mozilla does include an email program, but for business use I prefer to use a separate program for email. I use <a href="http://www.eudora.com">Eudora</a>. Just as an example, a colleague of mine was being driven crazy by spam; I had him install Eudora, and its junk-mail filters immediately caught 99% of the spam.</p>

<p><h4>Anti-spam software</h4><br />
I use <a href="http://www.spamassassin.org">SpamAssassin</a>, but not on my PC -- I have it installed at the email server &mdash; my setup is rather elaborate as I hate spam with a passion. I've heard that SpamAssassin can be applied on a PC-level basis but I haven't tried it out just yet.  Mozilla and Eudora both come with anti-spam software. There's rumors that Microsoft will come out with anti-spam software one day, but I wouldn't trust their solution to be worth anything at all.</p>

<p><h4>Startup control</h4></p>

<p>One of the ways that viruses and malware take over your computer is through "startups," programs that run when you turn on your computer. For that matter, several otherwise well-behaved programs attempt to run at startup and put themselves into your PC's "tray." By running at startup the programs chew up memory and CPU on your computer, usually for no good reason (other than advertising the existence of the program). Very occassionally a program will attempt to register a one-time, post-install, post-bootup cleanup program. Startup control is a way of thwarting programs that attempt to register themselves to run at startup.</p>

<p>I use Mike Lin's <a href="http://www.mlin.net/StartupMonitor.shtml">StartupMonitor</a>, which informs me when a program attempts to register itself to run at startup. </p>

<p><a href="http://www.mlin.net/StartupCPL.shtml">Startup Control Panel</a> from the same author is even more useful: It lets me see what's already installed to run on startup. And I can turn things off (and on again afterwards) which is extremely useful when cleaning up a virus.</p>

<p><h4>Post-Virus/Malware Cleanup Tools</h4></p>

<p>There's nothing quite like sitting down at someone's computer, running a virus scanner, and finding 78 copies of different viruses. Here's some of the tools I've used (aside from the anti-virus and anti-malware scanners) to clean up infected computers. </p>

<p>One note about cleanups: Some viruses are very, very nasty indeed. They erase copies of anti-virus software and try to prevent you from downloading new ones. They keep multpile copies of themselves running, and they change their names to make them harder to erase. A really persistent infection -- and many people have these -- requires that the computer be started in "safe" mode, which is done by following the instructions for your PC (often it's to use the F8 key on startup). In safe mode, nothing much loads on the computer, and you can then run the antivirus and anti-malware software. Sometimes this requires several cycles to catch all the problems.</p>

<p>Startup Control Panel, mentioned in the previous section, is a very useful tool to clean up malware problems, and of course to get useless junk out of the "startup tray."</p>

<p><a href="http://www.spywareinfo.com/~merijn/downloads.html">HijackThis</a> recently let me rescue a system that simply couldn't be cleaned any other way. HijackThis lists everything that attempts to intercept your web browser. This is <b>not</b> an analysis tool -- you have to decide for yourself if you think a particular item is dangerous or beneficial! Use with extreme care. </p>

<p>(Note: Here's a malware test. I had a firewall connected to the PC, but the firewall was not connected to the network. When I tried to use the browser on the PC to access the firewall, I would time out &mdash it took forever. It was because the browser was being hijacked, and the slowdown happened as the malware tried to get to the net, not realizing that I was only connected to the firewall's web page server and not the 'net. If you have these symptoms, you probably have malware. And HijackThis was the only way I was able to fix it.)</p>

<p><a href="http://www.docsdownloads.com/dr-delete.htm">Dr. Delete</a> is a tool to remove a file at next bootup. Good for getting rid of a file that simply seems to be stuck on your system.</p>

<p><a href="http://cexx.org/lspfix.htm">lspfix</a> is a tool that fixes the TCP/IP chain if it's been damaged by malware. I've never had to use it.</p>

<p>And as a nice way to get some junk off your system, <a href="http://www.ccleaner.com/">CCleaner</a> removes temp files from across the system. And yes, I think the program would be a lot more popular if the name were less indelicate.</p>]]>
    </content>
  </entry>

</feed>