<?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>Brian C. Lane &#187; Linux</title>
	<atom:link href="http://blog.brianlane.com/category/os/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.brianlane.com</link>
	<description>Programming and Other Witty Things</description>
	<lastBuildDate>Sun, 27 Jun 2010 16:58:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Streaming Local Video With Your Roku</title>
		<link>http://blog.brianlane.com/2009/12/20/streaming-local-video-with-your-roku/</link>
		<comments>http://blog.brianlane.com/2009/12/20/streaming-local-video-with-your-roku/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 00:38:42 +0000</pubDate>
		<dc:creator>Brian Lane</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Roku]]></category>

		<guid isPermaLink="false">http://blog.brianlane.com/?p=53</guid>
		<description><![CDATA[<p>Ever since I switched from Dish Network to a Roku player a few months ago I have had a couple of things I wanted my player to be able to do. The ability to categorize my Netflix queue is at the top of my list and it would be very cool to be able to play <span style="color:#777"> . . . &#8594; Read More: <a href="http://blog.brianlane.com/2009/12/20/streaming-local-video-with-your-roku/">Streaming Local Video With Your Roku</a></span>]]></description>
			<content:encoded><![CDATA[<p>Ever since I switched from Dish Network to a <a href="http://www.roku.com">Roku</a> player a few months ago I have had a couple of things I wanted my player to be able to do. The ability to categorize my <a href="http://www.netflix.com">Netflix</a> queue is at the top of my list and it would be very cool to be able to play video from a local server. The SDK won&#8217;t help me modify the Netflix application, but streaming from a local source is actually not a huge problem.</p>
<p>On Friday Roku finally released the SDK for their handy little Roku Video player (sometimes called a Netflix box since that was originally the only content you could stream). The SDK is free, all you have to do is signup at the <a href="http://www.roku.com/developer">developer page</a>. The zip archive contains everything you need to get started hacking together a new channel for your Roku player.</p>
<p>For the most part development is cross platform. You are restricted to using their language, BrightScript, so there are no compilers or IDE needed. It helps if you have the make utility available on your system, the examples come with makefiles that will zip up the application and install it into your player with a single command. If you want nice images to show up while scanning through a video you will need to capture them from the file and create a BIF file to tell the player when to show the images. The biftool is currently only available on linux and Windows.</p>
<p>To be able to upload software to your player you need to enable developer mode. This is accomplished with a set of remote control keypresses. For some reason it took me about 10 tries before I got it to work. I&#8217;m still not sure if it depends on where you start from, but what finally worked for me was being at the top level channel menu with something other than settings selected.</p>
<p>Once that is done the box now has a simple server running on port 80 and a debug port on 8085 where you can view debug output from your app or from the system if the upload failed, or if parsing the script files failed. That&#8217;s all there is to it. No cumbersome app signing needed at this point. It makes it very easy to edit, upload, try, debug, repeat. If you want to actually publish your application as a new channel for the world to use the process is more involved and requires Roku to approve your application.</p>
<p>The SDK includes, among other things, a couple of video examples. One simply points to a URL and plays it (the URL is hard-coded into the application). The other is more fully featured and uses TED talk videos. It allows you to setup a hierarchy of categories using a couple of XML files. This is a good place to start for streaming local content.</p>
<p>The first thing I did was setup an Apache 2.2.13 server on my son&#8217;s Fedora11 system. I simply aliased the directory of mp4 videos and it was up and running. As a side note, Chrome (at least on OSX) can stream mp4 videos over http without installing anything else.</p>
<p>I then played around with the simple stream example to make sure I could actually watch the videos. They were encoded using Handbrake on either a OSX or Fedora system. Most are 1G in size or less, and I left most of the encode settings alone. I found that about the first hour streams fine, but after that point the player starts to rebuffer every minute or so. It appears to depend on the location in the file, so it may have something to do with how it was encoded.</p>
<p>The documentation included appears to be fairly complete. The have extensive documentation on BrightScript, and on the Roku extensions that you use to access to features of the player. I did find a couple of things that weren&#8217;t described in detail, but at this point that hasn&#8217;t hindered progress at all. BrightScript is a fairly simple language and anyone with programming experience should have no trouble catching on quickly.</p>
<p>The example video app uses a hard-coded URL for the source of the XML driving it. I added a keyboard page that prompts the user to enter the host or IP address of their video server. It saves this to the registry (persistent storage) so it only needs to be entered once. For the moment, this is really the only change I needed to make to the example application. Everything else happens on the server side.</p>
<p>I slapped together a Python script to take the names of my mp4 videos and generate the feed XML to drive the player. I used mp4info to pull the video&#8217;s bitrate and format from the file and insert into the movie&#8217;s description page. I don&#8217;t have cover art for them, so that got hard-coded to a default image. The script generates a static XML file for the Roku to load when my custom application is run.</p>
<p>At this point I can browse the movies and play them. Mostly. I&#8217;ve run into a couple of glitches, and am not sure exactly what the solution for them is yet. One is that it seems that at about the 1 hour point in the video playback it starts to rebuffer every minute or two. If I stop playback, restart and skip to the 1 hour marks it still happens, so it appears to depend on the point in the file, not the time spent playing.</p>
<p>The other is that the aspect ratio of many of the videos isn&#8217;t quite right. All of them seem to be squished to some degree or another. This is probably due to the Handbrake parameters I used when encoding them from the original DVDs. They look fine when played back on a PC but the Roku either isn&#8217;t properly sizing them, or I&#8217;m doing something wrong (more than likely).</p>
<p>Overall I am very happy with the Roku and the SDK. They have done an excellent job of documenting the system, providing example code and especially keeping it from turning into a brick. Several times I have managed to get it to lock up and reset itself. It has always come right back up with no problems. I am looking forward to seeing what other channels people come up with. On the top of the list for me is Hulu streaming, but I&#8217;ll leave that up to someone else to implement.</p>
<p>You can look at my code, for what its worth, at my <a href="http://bitbucket.org/bcl/homevideo/">bitbucket homevideo repository</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brianlane.com/2009/12/20/streaming-local-video-with-your-roku/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Backups, Archives and Overheating Processors</title>
		<link>http://blog.brianlane.com/2009/11/10/backups-archives-and-overheating-processors/</link>
		<comments>http://blog.brianlane.com/2009/11/10/backups-archives-and-overheating-processors/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 06:32:42 +0000</pubDate>
		<dc:creator>Brian Lane</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[BackupPC]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[RAID5]]></category>

		<guid isPermaLink="false">http://brianlane.wordpress.com/?p=22</guid>
		<description><![CDATA[<p>A few (ahum) years ago I wrote an article for Linux Journal on building a RAID system. While that exact system no longer exists, I do still have a RAID5 setup that I use with BackupPC to backup all the systems on my LAN. As I wrote about in my KVM article, I have updated my <span style="color:#777"> . . . &#8594; Read More: <a href="http://blog.brianlane.com/2009/11/10/backups-archives-and-overheating-processors/">Backups, Archives and Overheating Processors</a></span>]]></description>
			<content:encoded><![CDATA[<p>A few (ahum) years ago I <a href="http://www.linuxjournal.com/article/6558">wrote an article</a> for Linux Journal on building a RAID system. While that exact system no longer exists, I do still have a RAID5 setup that I use with <a href="http://backuppc.sourceforge.net/">BackupPC</a> to backup all the systems on my LAN. As I wrote about in my <a href="http://brianlane.wordpress.com/2009/11/07/kvm-on-fedora11/">KVM article</a>, I have updated my main Linux box to Fedora11. It had been out of backup rotation for about a year, since I have mostly been using my Mac Mini and everything on the Linux box was checked out of a remote <a href="http://subversion.tigris.org/">Subversion</a> repository. I wanted to archive the old system&#8217;s backup and add it to the backup rotation again.</p>
<p>In all my years of using BackupPC I had somehow missed the archive feature. I&#8217;ve used it to recover files by writing them to a /tmp/ directory on a remote system or download a tar of selected files but hadn&#8217;t realized that you could also create a gigantic tar of all the files in the current backup. To get this setup I had to do several things:</p>
<ul>
<li>Add a new dns alias for the system to write the archive to. I use the same system that BackupPC runs on for this.</li>
<li>Add a new host in the &#8216;Edit Hosts&#8217; page, I named it the same thing as the new DNS alias</li>
<li>Edit the new host&#8217;s config and in the &#8216;Xfer&#8217; page set &#8216;XferMethod&#8217; to Archive instead of rsync</li>
<li>Change the &#8216;ArchiveSplit&#8217; option to 1000 to split the tar into 1G files to make it easy to handle</li>
</ul>
<p>And presto! I could now dump archives of the backups to the local system and then burn them to DVD. I also wanted to include a directory of all the files along size the archive. Since the tar is actually split up into pieces you need to join them together in order to get a full listing out of them. Since tar was written to be used with streaming tapes this means all you need to do is cat them to a tar process reading from standard input and write the output into a file. Like this: <code>cat host.tar.bz2.a? | tar tvjf - &gt; ./directory.txt</code></p>
<p>This streams all the archive files to tar which is reading from standard input and writes the output to the directory.txt file. This can take quite a while.</p>
<p>So at this point in the day I finally had the old system image written to a couple of DVD&#8217;s. Now it was time to switch the backup back on and catch up with the current system image. I added a few new directories to the list to backup (I usually only backup /etc, /root and /home). This included my new libvirt virtual images. In all it amount to about 96G worth of files. The LAN bottleneck is the 100Mb NIC in the backup system. It was pushing around 45Mb for several hours, chugging its way through the backup. Then something strange happened.</p>
<p>The backup server turned off. No warning, just click. nothing. I rebooted it, it ran its filesystem checks with no problems. I dug through the logfiles and there was nothing in them to indicate a problem of any kind. So I restarted the backup and it ran for about another 30 minutes before doing the same thing. This system <strong>never</strong> dies on me, or at least ever since I put in an Antec 500W power supply it doesn&#8217;t just die.</p>
<p>I started with the obvious, checking for bus errors in the logs. I ran memtest86 on it for a bit. Then I took a look at the BIOS health readings. Even after being relativly idle for 15 minutes the CPU temp was at 63C. Now, this system is a 2.9GHz Celeron D. The max temp is somewhere around 67C. So I was probably baking the heck out of the CPU and it was doing a thermal shutdown. Consumer CPUs like the Celeron just aren&#8217;t designed for this kind of abuse. But that never stops me from trying to squeeze every last cent out of a system.</p>
<p>The heatsink had what I&#8217;d call a moderate amount of dust on it, but it was mostly on the top not crammed down in the fins like I have sometimes seen. I pulled it odd and the CPU was glued to it with heatsink grease. I blew out the dust (canned air is so much fun!), cleaned things off, gave it some new grease and re-installed.</p>
<p>I fired up the backup and again after a short period of time it died. I finally setup the sensors package on the system and it told the story &#8212; it was still overheating. The fan was only running at about 2.7k rpms so I swapped in a spare Tornado fan, cranked it up to its maximum of  5300 rpm and restarted the backup. The CPU now maxes out around 57C and the backups all run to completion so things seem to be happy.</p>
<p>This also reminds me that I really need to blow the dust out of the heatsinks in the other systems around here &#8212; I don&#8217;t think I&#8217;ve done that in over a year. I really should have a regular maintenance schedule instead of waiting for failures to happen. I guess I need the extra excitement or something.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brianlane.com/2009/11/10/backups-archives-and-overheating-processors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KVM on Fedora11</title>
		<link>http://blog.brianlane.com/2009/11/07/kvm-on-fedora11/</link>
		<comments>http://blog.brianlane.com/2009/11/07/kvm-on-fedora11/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 17:04:35 +0000</pubDate>
		<dc:creator>Brian Lane</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS]]></category>

		<guid isPermaLink="false">http://brianlane.wordpress.com/?p=8</guid>
		<description><![CDATA[<p>I&#8217;ve been a VMWare Workstation user for years and have generally been pretty happy with it; but it is significantly slower than bare metal, especially when it comes to disk i/o. One of my responsibilities for work is creating and maintaining a custom fedora distribution. This requires building new rpm packages and then creating a livecd <span style="color:#777"> . . . &#8594; Read More: <a href="http://blog.brianlane.com/2009/11/07/kvm-on-fedora11/">KVM on Fedora11</a></span>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been a <a href="http://www.vmware.com">VMWare Workstation</a> user for years and have generally been pretty happy with it; but it is significantly slower than bare metal, especially when it comes to disk i/o. One of my responsibilities for work is creating and maintaining a custom <a href="http://www.fedoraproject.org">fedora</a> distribution. This requires building new rpm packages and then creating a livecd iso for the install of the system. Lots of disk i/o involved in reading and creating the disk image meant that I was running Fedora9 as my native desktop.</p>
<p>Last year I upgraded to a Core2 Duo system. Not realizing that some of them <strong>don&#8217;t</strong> have virtualization support I bought the cheapest one that <a href="http://www.newegg.com">NewEgg</a> had available at the time. After a bit of thrashing about I realized that the E2200 I had wouldn&#8217;t support Xen, qemu or virtualbox. So I continued to use VMWare Workstation and a bare-metal Fedora9 installation for my build environment.</p>
<p>This wasn&#8217;t too bad a first. That is until I added a second ACER 22&#8243; widescreen to my desktop and discovered that Fedora9 has trouble with the nVidia graphics chipset (GeForce 7050/nForce 610i) on this motherboard. The display resolution is squareish. On a widescreen monitor this results in everything looking short and fat. It isn&#8217;t terribly noticeable, but does become annoying after using it all day.</p>
<p>Thanks to <a href="http://en.wikipedia.org/wiki/Moore%27s_law">Moore&#8217;s Law</a> the prices on the low end Core2 Duo&#8217;s (E3300) with virtualization support have dropped to the same level as the processor I bought last year. Last week I swapped in the new CPU (&lt;10 minute job), and moved my development environment over to Fedora11 and it&#8217;s excellent virtualization support using libvirt. I&#8217;ve mostly been using the GUI tools for setup and management and have been <em>very</em> happy with things so far.</p>
<p>One of the first things I needed to do was move the default storage pool onto my large drive (ok, 500G isn&#8217;t really large by today&#8217;s standards but it is the biggest one I have). I didn&#8217;t quite get the concept of storage pools at first and was trying to specify a new path when I setup the new virt. Instead what you need to do is edit the storage of the host system, add a new pool using a directory of files on the larger drive, and then create a new image file in the pool for use with the virt you are going to setup.</p>
<p>The next hurdle was getting bridged networking setup. Some of the virts that I use are test images for production web servers (I like to virtualize and test as much of the production environment as possible). To do this I followed the directions over on the <a href="http://wiki.libvirt.org/page/Networking#Bridged_networking_.28aka_.22shared_physical_device.22.29">libvirt webpage</a>, basically editing a couple of files in /etc/sysconfig/network-scripts.</p>
<p>ifcfg-eth0 now looks like this:</p>
<pre class="brush: bash;">DEVICE=eth0
HWADDR=00:21:97:9e:e1:15
NM_CONTROLLED=no
ONBOOT=yes
BRIDGE=br0</pre>
<p>And a new file, ifcfg-br0 looks like this:</p>
<pre class="brush: bash;"># Bridge device
DEVICE=br0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes
DELAY=0
NM_CONTROLLED=no</pre>
<p>After doing this I restarted networking and now br0 shows up as the default interface when setting up new virtuals with the GUI tools. One snag I ran into is that BOOTPROTO=dhcp is case sensitive &#8212; DHCP will not work and will cause some amount of frustration until you realize this.</p>
<p>Within a couple of hours I was able to move my Fedora9 build and test environments over to virtuals, including the i/o intensive iso building process. I haven&#8217;t made any objective measurements, but it runs almost as quickly as it did on the bare metal install and significantly faster than when I tried running it under VMWare. Now my screen runs properly, thanks to the nouveau driver used in Fedora11, and I can fire up more virtuals without bogging down the system like it would with VMWare. I may miss the snapshot option of VMware eventually, but for now the virt-clone utility works just fine for my needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brianlane.com/2009/11/07/kvm-on-fedora11/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
