<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Anthony&#039;s Blog</title>
	<atom:link href="http://www.anthonyldechiaro.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.anthonyldechiaro.com/blog</link>
	<description>Thoughts, ideas, and ramblings on Linux, electronics and science</description>
	<lastBuildDate>Sat, 21 Jan 2012 01:59:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>mdadm: Device or resource busy error</title>
		<link>http://www.anthonyldechiaro.com/blog/2012/01/20/mdadm-device-or-resource-busy-error/</link>
		<comments>http://www.anthonyldechiaro.com/blog/2012/01/20/mdadm-device-or-resource-busy-error/#comments</comments>
		<pubDate>Sat, 21 Jan 2012 01:59:01 +0000</pubDate>
		<dc:creator>Anthony DeChiaro</dc:creator>
				<category><![CDATA[blurb]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mdadm]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=569</guid>
		<description><![CDATA[I recently needed to rebuild a RAID1 array after a reboot for some odd reason and afterwards I was unable to assemble the array.  mdadm came back and reported &#8220;Device or resource busy&#8221; on one of the drives.  I couldn&#8217;t figure out what the issue was originally as it wasn&#8217;t mounted and no other processes [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I recently needed to rebuild a RAID1 array after a reboot for some odd reason and afterwards I was unable to assemble the array.  mdadm came back and reported &#8220;Device or resource busy&#8221; on one of the drives.  I couldn&#8217;t figure out what the issue was originally as it wasn&#8217;t mounted and no other processes were using the drive via lsof.  Eventually I tracked it down to a changed UUID &#8211; my fstab was trying to mount the old mdadm array and it locked the resource.  I checked it by doing &#8216;ls&#8217; on /dev/disk/by-uuid/.  Updating fstab with a new UUID, rebooting to clean up things and reassembling the array solved it.  Just a useful item to keep in mind.</p>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=569" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/2012/01/20/mdadm-device-or-resource-busy-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging logcheck rules and security events</title>
		<link>http://www.anthonyldechiaro.com/blog/2011/11/20/debugging-logcheck-rules-and-security-events/</link>
		<comments>http://www.anthonyldechiaro.com/blog/2011/11/20/debugging-logcheck-rules-and-security-events/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 04:39:15 +0000</pubDate>
		<dc:creator>Anthony DeChiaro</dc:creator>
				<category><![CDATA[blurb]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[troubleshooting]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[logcheck]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=566</guid>
		<description><![CDATA[I&#8217;ve been a big fan of logcheck for monitoring my servers, when properly configured it works very well and is pretty flexible.   Unless you are using a centralized logging system such as Splunk most of us are guilty of not thoroughly checking our logs.  I like to use logcheck to perform a simple audit of what [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I&#8217;ve been a big fan of <a href="http://logcheck.org/" target="_blank">logcheck</a> for monitoring my servers, when properly configured it works very well and is pretty flexible.   Unless you are using a centralized logging system such as Splunk most of us are guilty of not thoroughly checking our logs.  I like to use logcheck to perform a simple audit of what my systems are up to, it&#8217;s not perfect but certainly better then nothing.</p>
<p style="text-align: justify;">My configuration has been tweaked a bit, adding some custom regex&#8217;s for ignoring a few common items.  I found a nice debugging tip on a old posting from the logcheck-devel mailing list which <a href="http://lists.alioth.debian.org/pipermail/logcheck-devel/2006-July/002796.html" target="_blank">mentions</a> using egrep to test new rules:</p>
<pre>cat &lt;logfile&gt; | egrep -v -f /etc/logcheck/ignore.d.workstation/regex</pre>
<p style="text-align: justify;">This has saved me a lot of time and frustration when making the final tweaks to a regex.  However, recently I had some difficulties ignoring what seemed to be particularly stubborn security events.  From best I could tell, grep suggested that my expression was filtering properly, yet logcheck was still reporting on these events.  Finally reading through the <a href="http://logcheck.org/docs/README.logcheck-database" target="_blank">README</a> I discovered patterns cancelling security alarms must be places in violations.ignore.d, not ignore.d.workstation/server.  Something to be mindful of.</p>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=566" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/2011/11/20/debugging-logcheck-rules-and-security-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NFS root on SheevaPlug with Debian</title>
		<link>http://www.anthonyldechiaro.com/blog/2011/10/20/nfs-root-on-sheevaplug-with-debian/</link>
		<comments>http://www.anthonyldechiaro.com/blog/2011/10/20/nfs-root-on-sheevaplug-with-debian/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 01:41:18 +0000</pubDate>
		<dc:creator>Anthony DeChiaro</dc:creator>
				<category><![CDATA[embedded]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[nfsroot]]></category>
		<category><![CDATA[sheevaplug]]></category>
		<category><![CDATA[uboot]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=561</guid>
		<description><![CDATA[I broke out my SheevaPlug the other day and decided to tinker with it a bit&#8230; recently I had some new projects ideas where it would be of use.  I also wanted to configure it with an NFS root to avoid flash wear issues and a way to easily back up the device.  This is [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I broke out my SheevaPlug the other day and decided to tinker with it a bit&#8230; recently I had some new projects ideas where it would be of use.  I also wanted to configure it with an NFS root to avoid flash wear issues and a way to easily back up the device.  This is an attempt at documenting the process in the hope it may help someone else with all the issues I ran into.  YMMV, damnum absque injuria, etc&#8230;</p>
<p style="text-align: justify;">The plug had previously been sitting in my closet for some time, in fact it&#8217;s been so long that the Ubuntu Jaunty 9.04 install it came with was very outdated by this point.  Unfortunately the idea of upgrading to any more recent Ubuntu release <a href="http://www.plugcomputer.org/plugforum/index.php?topic=885.0" target="_blank">will not work</a> as they are compiled for newer ARM architectures; the CPU in the SheevaPlug is only an ARMv5 and 9.04 was the last version to support this core.  Ubuntu 9.10 was built for v6 and 10.04 and later target the Cortex ARMv7 core.</p>
<p style="text-align: justify;">However we&#8217;re still in luck as <a href="http://www.debian.org/ports/arm/" target="_blank">Debian has an ARM port</a> which supports Marvell&#8217;s Kirkwood platform.  And thanks to some wonderful work by Martin we have an easy to follow process for <a href="http://www.cyrius.com/debian/kirkwood/sheevaplug/install.html" target="_blank">installing Squeeze</a> on the SheevaPlug.  There&#8217;s a few caveats and issues to contend with and you will probably have to <a href="http://www.cyrius.com/debian/kirkwood/sheevaplug/uboot-upgrade.html" target="_blank">upgrade U-Boot</a> (Marvell shipped their own variant which added support for plug computers but newer versions support it directly now).  This is all explained very well on Martin&#8217;s Debian installation page.  I recommend choosing the option for loading the installer via TFTP as you will need it later if you want to use NFS root.  I also initially installed Debian on an SD card, for some reason trying a USB drive did not work.</p>
<p style="text-align: justify;">Once the installation is done, boot into your new Squeeze install and prepare an NFS mount on another box somewhere which will serve your rootfs.  I perused the <a href="https://help.ubuntu.com/community/DisklessUbuntuHowto" target="_blank">DisklessUbuntuHowTo</a> doc to get a basic idea of how it works, you&#8217;ll be doing something similar except the initrd update process will be different &#8211; this will be explained below.  Once your NFS share is created on the server side, mount it on the SheevaPlug and copy the files over (obviously replacing the IP&#8217;s as necessary):</p>
<pre style="text-align: justify;">mount -t nfs 192.168.1.2:/nfsroot /mnt
cp -ax /. /mnt/.
cp -ax /boot/. /mnt/boot/.</pre>
<p style="text-align: justify;">The Ubuntu HOW-TO also lists copying <strong>/dev</strong> but this will not be needed as it is mounted via udev.  On my install <strong>/boot</strong> was a separate partition so make sure you include that as well.  Edit a few files in the new rootfs on the server-side to reflect a few things &#8211; <strong>/nfsroot/etc/network/interfaces</strong> to assign a static IP and <strong>/nfsroot/etc/fstab</strong> to replace your rootfs device with <strong>/dev/nfs</strong>.</p>
<p style="text-align: justify;">You&#8217;ll also want to copy over the uImage and uInitrd files from <strong>/nfsroot/boot</strong> over to your TFTP folder as they&#8217;ll be needed to boot the plug.</p>
<p style="text-align: justify;">Now comes the fun part, creating a new initrd.  Unfortunately the one installed by Debian did not support a NFS root so we need to build a new one.  Do this on the server-side as the new initrd will be copied to the TFTP folder as well.  The steps are relatively straight-forward but I recommend you read through the details first to get an better understanding.  The steps I outline are taken from a <a href="http://www.thegeekstuff.com/2009/07/how-to-view-modify-and-recreate-initrd-img/" target="_blank">post on editing initrd&#8217;s</a> and another on <a href="http://blog.bofh.it/debian/id_265" target="_blank">Debian SheevaPlug installation</a>.</p>
<p style="text-align: justify;">The process consists of the following: copy the kirkwood initrd image, extract it, update the initramfs.conf, re-compress, then rebuild it adding a special header for u-Boot.</p>
<pre style="text-align: justify;">~$ mkdir tmp

~$ cd tmp

~/tmp$ cp /home/exports/sheeva_squeeze_nfs_root/boot/initrd.img-2.6.32-5-kirkwood ./initrd.img-2.6.32-5-kirkwood.gz

~/tmp$ gunzip initrd.img-2.6.32-5-kirkwood.gz 

~/tmp$ mkdir initrd

~/tmp$ cd initrd/

~/tmp/initrd$ cpio -id &lt; ../initrd.img-2.6.32-5-kirkwood
25329 blocks

~/tmp/initrd$ ls
bin  conf  etc  init  lib  sbin  scripts</pre>
<p>At this point you&#8217;ll have the initrd extracted.  Edit the <strong>conf/initramfs.conf</strong> file and search for <strong>BOOT=local</strong>, change it to <strong>BOOT=nfs</strong>.</p>
<pre>~/tmp/initrd$ vim conf/initramfs.conf

~/tmp/initrd$ find . | cpio --create --format='newc' &gt; ../initrd.img-2.6.32-5-kirkwood-nfs
25329 blocks

~/tmp/initrd$ cd ..

~/tmp$ ls
initrd  initrd.img-2.6.32-5-kirkwood  initrd.img-2.6.32-5-kirkwood-nfs

~/tmp$ gzip -c initrd.img-2.6.32-5-kirkwood-nfs &gt; initrd.img-2.6.32-5-kirkwood-nfs.gz

~/tmp$ ls
initrd  initrd.img-2.6.32-5-kirkwood  initrd.img-2.6.32-5-kirkwood-nfs  initrd.img-2.6.32-5-kirkwood-nfs.gz

~/tmp$ mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n 'Debian ramdisk' -d initrd.img-2.6.32-5-kirkwood-nfs.gz initrd.img-2.6.32-5-kirkwood-nfs
Image Name:   Debian ramdisk
Created:      Thu Oct 20 20:43:31 2011
Image Type:   ARM Linux RAMDisk Image (gzip compressed)
Data Size:    5473115 Bytes = 5344.84 kB = 5.22 MB
Load Address: 0x00000000
Entry Point:  0x00000000

~/tmp$ ls
initrd  initrd.img-2.6.32-5-kirkwood  initrd.img-2.6.32-5-kirkwood-nfs  initrd.img-2.6.32-5-kirkwood-nfs.gz

~/tmp$ cp initrd.img-2.6.32-5-kirkwood-nfs /var/lib/tftpboot/uImage-nfsroot</pre>
<p style="text-align: justify;">Now that you have the new initrd created you&#8217;ll need to update your uBoot environment variables.  This can be quite complex in-and-of itself.  The previous u-Boot environment variables I had did not work with this new setup, my attempts at abstracting away most of the complexity into many variables did not seem to work, there were many instances where variables referenced in commands and other variables were not getting set properly.  I basically re-worked it from the ground up using sample material at DENX&#8217;s (developers of u-Boot) website.  Their <a href="http://www.denx.de/wiki/bin/view/DULG/Manual" target="_blank">manual</a> has a lot of information, you&#8217;ll probably want to reference the <a href="http://www.denx.de/wiki/view/DULG/CommandLineParsing" target="_blank">CommandLineParsing</a>, <a href="http://www.denx.de/wiki/view/DULG/UBootCmdGroupEnvironment" target="_blank">UBootCmdGroupEnvironment</a>, and <a href="http://www.denx.de/wiki/view/DULG/LinuxNfsRoot" target="_blank">LinuxNfsRoot</a> pages primarily.  The working copy of my u-Boot environment is listed below:</p>
<pre style="text-align: justify;">addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off panic=1
addmisc=setenv bootargs ${bootargs}
addtty=setenv bootargs ${bootargs} console=ttyS0,${baudrate}
baudrate=115200
boot_mmc=setenv bootargs $(bootargs_console); run bootcmd_mmc; bootm ${kernel_addr_r} ${fdt_addr_r}
boot_nfs=tftpboot ${kernel_addr_r} ${bootfile}; tftpboot ${fdt_addr_r} ${fdt_file}; run nfsargs addip addtty; bootm ${kernel_addr_r} ${fdt_addr_r}
bootargs=root=/dev/nfs rw nfsroot=192.168.1.2:/home/exports/sheeva_squeeze_nfs_root ip=192.168.1.11:192.168.1.2:192.168.1.1:255.255.255.0:sheeva:eth0:off panic=1 console=ttyS0,115200
bootargs_console=console=ttyS0,115200 mtdparts=orion_nand:0x00100000@0x00000000(uBoot)ro,0x00400000@0x00100000(uImage),0x1fb00000@0x00500000(rootfs)
bootargs_nfs=$(bootargs_console) root=/dev/nfs rw nfsroot=$(serverip):$(rootpath) ip=$(ipaddr):$(serverip):$(gateway):$(netmask):sheeva:eth0:none
bootcmd=run boot_nfs
bootcmd_mmc=mmc init; ext2load mmc 0:1 0x00800000 /uImage; ext2load mmc 0:1 0x01100000 /uInitrd
bootcmd_nfs=tftpboot ${kernel_addr_r} ${bootfile}; tftpboot ${fdt_addr_r} ${fdt_file}
bootdelay=3
bootfile=uImage.sheeva.squeeze
console=console=ttyS0,115200 mtdparts=nand_mtd:0x00100000@0x00000000(uBoot)ro,0x00400000@0x00100000(uImage),0x1fb00000@0x00500000(rootfs)
ethact=egiga0
ethaddr=00:50:43:xx:xx:xx
fdt_addr=0x01100000
fdt_addr_r=0x01100000
fdt_file=uInitrd-nfsroot
fileaddr=800000
filesize=539CDD
gatewayip=192.168.1.1
hostname=sheeva
ipaddr=192.168.1.11
kernel_addr_r=0x00800000
netdev=eth0
netmask=255.255.255.0
nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath}
rootpath=/home/exports/sheeva_squeeze_nfs_root
serverip=192.168.1.2
stderr=serial
stdin=serial
stdout=serial
x_bootargs=console=ttyS0,115200 mtdparts=orion_nand:512k(uboot),4m@1m(kernel),507m@5m(rootfs) rw
x_bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs
x_bootcmd_kernel=nand read 0x6400000 0x100000 0x400000
x_bootcmd_sata=ide reset;
x_bootcmd_usb=usb start;</pre>
<p style="text-align: justify;">By default it&#8217;s set to boot from NFS via the <strong>bootcmd=run boot_nfs</strong> line.  If you&#8217;re having issues getting NFS root to work, you may want to remove the <strong>panic=1</strong> from the addip variable, this way it can drop you to an initrd prompt.  The <strong>boot_mmc</strong> variable is adapted from Martin&#8217;s example.  You may need to modify these slightly if your SheevaPlug is different, specifically the bootargs_console variable &#8211; <strong>mtdparts</strong> reflects the flash partition setup on my plug, update if yours differs (I think these are the factory default settings), <strong>/proc/mtd</strong> will have this information in it if you boot again from the Debian install.  Also I changed it to <strong>orion_nand</strong>, I believe it used to be orion_mtd initially.</p>
<p>That&#8217;s basically it.   Hope this is of use to someone!</p>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=561" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/2011/10/20/nfs-root-on-sheevaplug-with-debian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Verizon/Samsung 4G MiFi and Ubuntu</title>
		<link>http://www.anthonyldechiaro.com/blog/2011/10/06/verizon-samsung-sch-lc11-4g-mifi-and-ubuntu/</link>
		<comments>http://www.anthonyldechiaro.com/blog/2011/10/06/verizon-samsung-sch-lc11-4g-mifi-and-ubuntu/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 23:24:41 +0000</pubDate>
		<dc:creator>Anthony DeChiaro</dc:creator>
				<category><![CDATA[blurb]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[troubleshooting]]></category>
		<category><![CDATA[desktop]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[wifi]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=537</guid>
		<description><![CDATA[I recently got a MiFi card for my on-call rotation with work and had some issues getting it to play nice with the Ubuntu install on my laptop.  It&#8217;s a Samsung SCH-LC11 and various iMac&#8217;s in the office connected to it just fine.  My laptop would connect, then almost immediately disconnect.  Pretty much unusable.  I [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I recently got a MiFi card for my on-call rotation with work and had some issues getting it to play nice with the Ubuntu install on my laptop.  It&#8217;s a Samsung SCH-LC11 and various iMac&#8217;s in the office connected to it just fine.  My laptop would connect, then almost immediately disconnect.  Pretty much unusable.  I connected to the office wifi just fine so I know that wasn&#8217;t an issue.</p>
<p style="text-align: justify;">A quick search found a solution on the <a href="http://ubuntuforums.org/showthread.php?t=1724771" target="_blank">ubuntu forums</a>.  Basically, you need to connect to the device (obviously using a Windows or Mac) and log into the web admin page (default of 192.168.1.1).  Check the wifi configuration security; the encryption protocol is probably set to WPA with TKIP.  You need to set it to WPA2 with AES.</p>
<p>&nbsp;</p>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=537" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/2011/10/06/verizon-samsung-sch-lc11-4g-mifi-and-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Samba shares multple connections to a shared resource</title>
		<link>http://www.anthonyldechiaro.com/blog/2011/10/06/samba-shares-multple-connections-to-a-shared-resource/</link>
		<comments>http://www.anthonyldechiaro.com/blog/2011/10/06/samba-shares-multple-connections-to-a-shared-resource/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 23:14:08 +0000</pubDate>
		<dc:creator>Anthony DeChiaro</dc:creator>
				<category><![CDATA[troubleshooting]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[blurb]]></category>
		<category><![CDATA[samba]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=530</guid>
		<description><![CDATA[I don&#8217;t normally post much about Windows here as I have a limited presence with it at home &#8211; only a VM for Lightroom &#8211; but I came across this counter-intuitive problem earlier in the week.  When building a new VM I discovered for some odd reason Windows would not allow me to map multiple [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I don&#8217;t normally post much about Windows here as I have a limited presence with it at home &#8211; only a VM for Lightroom &#8211; but I came across this counter-intuitive problem earlier in the week.  When building a new VM I discovered for some odd reason Windows would not allow me to map multiple shares to my Samba server under different paths with the same credentials.  I kept getting the error:</p>
<pre>Multiple connections to a server or shared resource by the same user,
using more then one user name, are not allowed.</pre>
<p style="text-align: justify;">Now I was using the same user name on all of these and it worked perfectly fine on my old 2k3 VM and I changed nothing on the Samba side.  No attempts at removing the shares and recreating them or reboots (even 3 of them!) seemed to help.  Sigh&#8230;  A bit of Googling suggested deleting all the shares explicitly on the command line, then try recreating them.  This seemed to fix it!</p>
<pre>net use * /delete</pre>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=530" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/2011/10/06/samba-shares-multple-connections-to-a-shared-resource/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More sensor interfacing with the Bus Pirate</title>
		<link>http://www.anthonyldechiaro.com/blog/2011/07/27/more-sensor-interfacing-with-the-bus-pirate/</link>
		<comments>http://www.anthonyldechiaro.com/blog/2011/07/27/more-sensor-interfacing-with-the-bus-pirate/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 05:06:15 +0000</pubDate>
		<dc:creator>Anthony DeChiaro</dc:creator>
				<category><![CDATA[buspirate]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[embedded]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[sensors]]></category>
		<category><![CDATA[weather]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=517</guid>
		<description><![CDATA[After interfacing the TMP102 temperature sensor recently with the Bus Pirate, the next step on my agenda was to integrate this with the Web Platform along with a HH10D humidity sensor.  Unfortunately I realised a bit late (entirely my fault rushing an order) that although the HH10D was an I2C sensor, the humidity was actually [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">After <a href="http://www.anthonyldechiaro.com/blog/2011/04/18/interfacing-sensors-with-the-bus-pirate/" target="_blank">interfacing the TMP102</a> temperature sensor recently with the Bus Pirate, the next step on my agenda was to integrate this with the Web Platform along with a <a href="http://www.sparkfun.com/products/10239" target="_blank">HH10D humidity sensor</a>.  Unfortunately I realised a bit late (entirely my fault rushing an order) that although the HH10D was an I2C sensor, the humidity was actually read through a frequency output pin; the I2C EEPROM was only for calibration data.  Bus Pirate to the rescue once again!</p>
<p style="text-align: justify;">This, like the TMP102 is an 3.3V sensor and needs pullup resistors on the I2C bus to read the EEPROM.  I <del>wasted</del> spent a number of hours with this getting nothing but garbage data with the first sensor I tried (the calibration values were completely wrong), on the second try with a backup sensor I had much better luck, getting good results almost immediately.</p>
<p style="text-align: justify;">We&#8217;ll be doing a similar setup to the TMP102: using I2C and turning on the power supplies but in this case the AUX pin should be set to HIGH-Z for input/reading.</p>
<pre style="text-align: justify;">HiZ&gt; m
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. KEYB
9. LCD
x. exit(without change)

(1)&gt; 4
Set speed:
 1. ~5KHz
 2. ~50KHz
 3. ~100KHz
 4. ~400KHz

(1)&gt; 3
Ready
I2C&gt; c
a/A/@ controls AUX pin
I2C&gt; @
AUX INPUT/HI-Z, READ: 0
I2C&gt; W
Power supplies ON
I2C&gt; (1)
Searching I2C address space. Found devices at:
0xA2(0x51 W) 0xA3(0x51 R)</pre>
<p>Good.  Now if you take a look at the <a href="http://datasheet.octopart.com/M24C02-BN6-STMicroelectronics-datasheet-2222.pdf">datasheet for the M24C02</a> EEPROM to do a random address read you&#8217;ll need to send a start bit, device select (read only; R/W set to 0), address, then another start bit, device select again (but with R/W set to 1), then read commands.  The <a href="http://www.sparkfun.com/datasheets/Sensors/Temperature/HH10D.pdf">HH10D datasheet</a> mentions there are 2 calibration factors we need to read: sensitivity and offset and each are 2 byte integers, making a total of 4 bytes.  These start at address EEPROM address 10.  Using the BP, we do the following:</p>
<pre style="text-align: justify;">I2C&gt; [0xa2 0x0a [0xa3 r:4
I2C START BIT
WRITE: 0xA2 ACK
WRITE: 0x0A ACK
I2C START BIT
WRITE: 0xA3 ACK
READ: 0x01  ACK 0x8B  ACK 0x1E  ACK 0x32
I2C&gt;</pre>
<p style="text-align: justify;">This is in big-endian format so the sensitivity value (at address 0&#215;10) reads <strong>0x018B</strong> and the offset is <strong>0x1E32</strong>.  We&#8217;ll also do a frequency read, the first as baseline with my AC running nearby and the second breathing on the sensor:</p>
<pre style="text-align: justify;">I2C&gt; f
AUX Frequency:  autorange 7,169 Hz
I2C&gt; f
AUX Frequency:  autorange 6,790 Hz</pre>
<p style="text-align: justify;">The formula in the datasheet states the RH = (offset-freq) * sensitivity/4096.  Plugging these in we get <strong>54%</strong> and <strong>90.6%</strong> RH which seems to match the other humidity sensor in my room.  Success!</p>
<p style="text-align: justify;">Next step was getting this working on my Web Platform.  I have some very bare-bones code working with the TMP102 already, just need to work on the HH10D a bit more and I&#8217;ll post my example up here.</p>
<p style="text-align: justify;">
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=517" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/2011/07/27/more-sensor-interfacing-with-the-bus-pirate/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Interfacing sensors with the Bus Pirate</title>
		<link>http://www.anthonyldechiaro.com/blog/2011/04/18/interfacing-sensors-with-the-bus-pirate/</link>
		<comments>http://www.anthonyldechiaro.com/blog/2011/04/18/interfacing-sensors-with-the-bus-pirate/#comments</comments>
		<pubDate>Tue, 19 Apr 2011 03:27:44 +0000</pubDate>
		<dc:creator>Anthony DeChiaro</dc:creator>
				<category><![CDATA[electronics]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[buspirate]]></category>
		<category><![CDATA[i2c]]></category>
		<category><![CDATA[sensors]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=506</guid>
		<description><![CDATA[Spring has come and with it, storm season.  In light of the recent historic multi-day tornado outbreak I&#8217;ve decided it was time to replace my initial Arduino weather station with something a bit more capable.  The Arduino is a decent platform for a quick prototype, but I&#8217;ve been interested in PIC&#8217;s for some time and [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Spring has come and with it, storm season.  In light of the recent <a href="http://www.wunderground.com/blog/JeffMasters/comment.html?entrynum=1781">historic</a> <a href="http://www.wunderground.com/blog/JeffMasters/comment.html?entrynum=1782">multi-day</a> <a href="http://www.wunderground.com/blog/JeffMasters/comment.html?entrynum=1783">tornado</a> <a href="http://www.wunderground.com/blog/JeffMasters/comment.html?entrynum=1784">outbreak</a> I&#8217;ve decided it was time to replace my initial <a href="http://www.anthonyldechiaro.com/blog/2010/10/07/arduino-onewirepachube-project-uploaded/">Arduino weather station</a> with something a bit more capable.  The Arduino is a decent platform for a quick prototype, but I&#8217;ve been interested in PIC&#8217;s for some time and really would like some more experience with them.  I recently picked up a <a href="http://dangerousprototypes.com/docs/Web_Platform">Web Platform</a> by Dangerous Prototypes and was impressed with its features, thought it would make a great platform for my new weather station.  A quick order from SparkFun provided me with a few I²C sensors to experiment with.</p>
<p style="text-align: justify;"><strong>Sidenote</strong>: The only downsides I thought of so far will be the inability to toss lots of sensors all on one bus.  The 1-wire protocol provides each sensor with a unique address, somewhat similar to a MAC.  However a basic weather station would only need a very few of these at the most (indoor/outdoor?) and this likely could easily be accomplished.  Most sensors I&#8217;ve seen are configurable to allow at least 2-4 devices per bus and if needed more then one I²C bus could always be implemented on the PIC.</p>
<p style="text-align: justify;">I figured some tinkering with my Bus Pirate to interface the sensors first would be a good start.  This is a quick reference/demo for a few of SparkFun&#8217;s breakout sensors.  Some of this is adapted from the example code provided on their website.</p>
<p><a href="http://www.sparkfun.com/products/9418"><strong>TMP102 &#8211; Digital Temperature Sensor Breakout (SEN-09418)</strong></a></p>
<p>This is a tiny I²C sensor which provides a great resolution (12 bits), accuracy (<del>0.5°</del> 2° C), and nice features including programmable high/low alerting temperatures and low power consumption.</p>
<p>The ADDR/A0 pin allows for configuring the slave address to allow up to 4 devices on the same bus.  It can be connected to either GND, V+, SDA or SCL; in my example here I&#8217;ve tied it to GND (using the AUX output of the Bus Pirate and setting it to low)  I must state that it&#8217;s important to tie it to something, left floating the sensor did not seem to operate correctly.  If using a different address reference the <a href="http://www.sparkfun.com/datasheets/Sensors/Temperature/tmp102.pdf">datasheet</a> to see the necessary changes (Table 12).  Also keep in mind this sensor needs 3.6V MAX, not 5V!  Pullup resistors do not need to be enabled as they are already provided on the breakout board.</p>
<p>Set mode to I2C, set AUX low and turn on the power supplies:</p>
<pre>HiZ&gt; m
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. KEYB
9. LCD
x. exit(without change)

(1)&gt; 4
Set speed:
 1. ~5KHz
 2. ~50KHz
 3. ~100KHz
 4. ~400KHz

(1)&gt; 3
Ready
I2C&gt; W
Power supplies ON
I2C&gt; c
a/A/@ controls AUX pin
I2C&gt; a
AUX LOW
I2C&gt; (1)
Searching I2C address space. Found devices at:
0x00(0x00 W) 0x90(0x48 W) 0x91(0x48 R)</pre>
<p>To read the temperature you need to generate a start bit, send the device address, then specify the register to read (temperature read-only):</p>
<pre>I2C&gt; [0x90 0x00
I2C START BIT
WRITE: 0x90 ACK
WRITE: 0x00 ACK
I2C&gt; [0x91 r r
I2C START BIT
WRITE: 0x91 ACK
READ: 0x19
READ:  ACK 0x60</pre>
<p>Our temperature data is 0&#215;1960.  The first byte is the MSB and the second LSB does not need to be read if not needed, in this case for a test it can be ignored &#8211; our temperature is 25°C (0&#215;19).  After pressing my finger on the sensor for a few seconds taking a second reading results in a MSB of 0x1F &#8211; 31°C, it indeed seems to work just fine.</p>
<p>&nbsp;</p>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=506" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/2011/04/18/interfacing-sensors-with-the-bus-pirate/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Wisdom, Learning and Education</title>
		<link>http://www.anthonyldechiaro.com/blog/2011/03/14/wisdom-learning-and-education/</link>
		<comments>http://www.anthonyldechiaro.com/blog/2011/03/14/wisdom-learning-and-education/#comments</comments>
		<pubDate>Mon, 14 Mar 2011 23:31:53 +0000</pubDate>
		<dc:creator>Anthony DeChiaro</dc:creator>
				<category><![CDATA[blurb]]></category>
		<category><![CDATA[knowledge]]></category>
		<category><![CDATA[learning]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=495</guid>
		<description><![CDATA[I wrote some time ago learning and briefly discussed how important it is for one to be continually learning.  Along the same topic I recently stumbled across a posting by Ben Rockwood regarding knowledge, wisdom, and information.  He wrote a very nice summary of the ideas of Russell Ackoff and W. Edwards Deming, Ackoff&#8217;s &#8220;Wisdom [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I wrote <a href="/blog/2009/05/07/learning/" target="_blank">some time ago</a> learning and briefly discussed how important it is for one to be continually learning.  Along the same topic I recently stumbled across a posting by Ben Rockwood regarding knowledge, wisdom, and information.  He <a href="http://cuddletech.com/blog/?p=520" target="_blank">wrote a very nice summary</a> of the ideas of Russell Ackoff and W. Edwards Deming, Ackoff&#8217;s &#8220;Wisdom Hierarchy&#8221; being my favorite of the two.  I won&#8217;t go into detail here, please read his excellent post for the juicy tidbits but it basically outlines the progression of things: from the low-level raw data, climbing up through information to knowledge, then understanding and finally (hopefully) arriving at wisdom.</p>
<p style="text-align: justify;">It&#8217;s definitely something you can gloss over at first and think &#8220;yeah that&#8217;s obvious&#8221; but I highly recommend you read it and check out his <a href="http://cuddletech.com/blog/?p=534" target="_blank">second post with embedded videos</a> from Dr. Ackoff himself on the subject.  It&#8217;s very thought provoking and I think hits home the core reason behind a large amount of problems in the world around us today.  One of the things I love the most is when he says there is a fundamental issue with our system of education; it&#8217;s not effective &#8211; who in the classroom learns the most?  I&#8217;d have to agree with his answer &#8211; the teacher.  We learn by teaching, not by being taught.  This is definitely true and reminded me of recently watching a  <a href="http://www.ted.com/talks/salman_khan_let_s_use_video_to_reinvent_education.html" target="_blank">wonderful video on TED</a> by Salman Khan of the <a href="http://www.khanacademy.org/" target="_blank">Khan Academy</a>, where he came to the same conclusion.  The Khan Academy is an online compendium of educational videos which are helping to revolutionize the classroom and Salman is seeing the changes video teaching is bringing to students &#8211; peers are able to teach each other and therefore get a better grasp on the material themselves.</p>
<p style="text-align: justify;">All in all, some very interesting ideas.  I just wish this was more widely known among the general public.</p>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=495" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/2011/03/14/wisdom-learning-and-education/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migrating mail server VM to a new host</title>
		<link>http://www.anthonyldechiaro.com/blog/2011/02/19/migrating-mail-server-vm-to-a-new-host/</link>
		<comments>http://www.anthonyldechiaro.com/blog/2011/02/19/migrating-mail-server-vm-to-a-new-host/#comments</comments>
		<pubDate>Sat, 19 Feb 2011 22:24:42 +0000</pubDate>
		<dc:creator>Anthony DeChiaro</dc:creator>
				<category><![CDATA[blurb]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[complaints]]></category>
		<category><![CDATA[FAIL]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=490</guid>
		<description><![CDATA[I&#8217;ve been working on migrating a virtual host over to Rackspace which mainly runs a mail server among a few other small items.  I wasn&#8217;t 100% sure how smooth the process would be, expecting to hit at least a few road bumps along the way.  The first one I encountered was issues surrounding MX entries [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I&#8217;ve been working on migrating a virtual host over to Rackspace which mainly runs a mail server among a few other small items.  I wasn&#8217;t 100% sure how smooth the process would be, expecting to hit at least a few road bumps along the way.  The first one I encountered was issues surrounding MX entries and the simplistic nature of the DNS record editor at Rackspace &#8211; most of my emails sent from my home PC were bouncing back 550 failed recipient verification.  This was just a dry run however as when the domain was with my previous hoster I just used my registrar&#8217;s DNS, when I switched back the problem seemed to be resolved.</p>
<p style="text-align: justify;">However the second issue I hit had me stumped for a few days.  One of the reasons I migrated (besides price) was greater flexibility; Rackspace gave me more options for distros to choose from and I thought their overall interface was cleaner and designed better.  So when I provisioned the new VM I gave Ubuntu a shot since I run it on my home network I&#8217;m a bit more familiar with how I want to configure the box for the software I run at least.  After the DNS/mail issue was resolved everything seemed solid except for a random, albeit fairly minor problem.  For some odd reason hostname resolution replied with &#8220;hostname: temporary failure in name resolution&#8221; randomly.  I was getting emails from cronjobs running with this error which I found a bit strange.  While I was tinkering with the mail problem I also built a CentOS VM real quick and didn&#8217;t notice the error occurring with that host.  I double-checked and made sure the resolv.conf was identical, then /etc/hosts, then nsswitch.conf and so on, all the files seemed the same or at least close enough that I didn&#8217;t think it would be a problem.  I made sure DNS resolution worked on the machine and ensured any iptables rules were not in place.  What caught me as the strangest part was the fact it randomly worked and randomly didn&#8217;t, there did not seem to be any sort of reproducibility in the issue.  I even ran an strace and compared logs from instances it worked and when it didn&#8217;t.  &#8216;hostname -f&#8217; also took a second or two to reply rather then an immediate response.</p>
<p style="text-align: justify;">Eventually I figured I&#8217;d just add an alias to /etc/hosts with the local non-FQDN hostname.  I also noticed then that the /etc/hosts didn&#8217;t seem to have an extra carriage return at the end, I put one in and bingo!  Problem fixed.  Looking back through the strace logs I saw upon closer inspection that it didn&#8217;t actually read in the second line which had the FQDN hostname, the first for localhost was OK but then it stopped further parsing.  For some reason CentOS behaves differently as I saw &#8211; the hosts file was identical (except for the IP&#8217;s of course) &#8211; it too was missing a carriage return but strace revealed that it parsed the file just fine.  Just in case any one is wondering I was testing this on Ubuntu Lucid 10.04.2 LTS and CentOS 5.5.</p>
<p style="text-align: justify;">::sigh::  Ah well at least I can cancel the plan with my original hoster now. <img src='http://www.anthonyldechiaro.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=490" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/2011/02/19/migrating-mail-server-vm-to-a-new-host/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Permission issues on slave BIND nameservers</title>
		<link>http://www.anthonyldechiaro.com/blog/2011/01/21/slave-bind-nameserver-issues/</link>
		<comments>http://www.anthonyldechiaro.com/blog/2011/01/21/slave-bind-nameserver-issues/#comments</comments>
		<pubDate>Fri, 21 Jan 2011 05:07:50 +0000</pubDate>
		<dc:creator>Anthony DeChiaro</dc:creator>
				<category><![CDATA[blurb]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[dns]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=486</guid>
		<description><![CDATA[I&#8217;m working on several projects at work to enhance our infrastructure and bring automation to our environment through tools such as Cobbler/Puppet/Kerberos and most of these rely on a working DNS system to operate correctly.  After a quick refresh with BIND a primary nameserver was up and running pretty quickly.  The zonefiles were populated easily [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I&#8217;m working on several projects at work to enhance our infrastructure and bring automation to our environment through tools such as Cobbler/Puppet/Kerberos and most of these rely on a working DNS system to operate correctly.  After a quick refresh with BIND a primary nameserver was up and running pretty quickly.  The zonefiles were populated easily enough after hacking together some Python to auto-generate configuration files from our server MySQL database.  However I encountered issues when getting the slave nameserver up and running; I was getting errors such as &#8220;permission denied&#8221; when the slave was attempting to transfer the master zonefile.  I was pretty sure it was configured correctly, it only seemed to fail when creating the temporary file.  I checked the user permissions in the chroot and it all looked good, then I remembered this box was running SELinux.  Checking the <a href="http://www.bind9.net/BIND-FAQ">BIND FAQ</a> I quickly found the answer: by default named is only allowed to write to the following directories:</p>
<ul>
<li>$ROOTDIR/var/named/slaves</li>
<li>$ROOTDIR/var/named/data</li>
<li>$ROOTDIR/var/tmp</li>
</ul>
<p>with $ROOTDIR being the chroot specified in /etc/sysconfig/named.  The configuration files are in $ROOTDIR/var/named and of course I was naming my file &#8220;sec.ourdomain.net&#8221; as opposed to &#8220;slaves/sec.ourdomain.net&#8221;.  Oops.  Have to keep this one in mind!</p>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=486" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/2011/01/21/slave-bind-nameserver-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

