Category Archives: Linux

Using Hauppauge MCE remote with Arch Linux


Recently I shut down my Windows Media Center PC and it felt like the end of an era. I was no longer using its TV recording capabilities but mostly using it in my son’s room as a media receiver. Needless to say it seemed a bit of a waste so I finally just pulled it down and we have been using a Sony SMPN-100 that can easily be moved around the house wherever it is needed.

Fast forward a few weeks my son decided he wanted his own computer. I had the old Media Center machine sitting in a closet providing a nice home for a bunch of dust and a few spiders so it made sense to pull it out of mothballs. I knew it would easily plug into his TV as that is how it spent a majority of its life so I went about getting it reconfigured. I have recently switched my personal system over to Arch Linux so I thought it would be a good time to reload his machine with Arch and install XBMC on the machine so he could also have a media center when he is not playing Minecraft.

I quickly had Arch and XBMC up and running. Next I had the IR receiver and my old Hauppauge MCE remote hooked up and then trouble began. It would seem that the newer Linux kernels have baked in support for IR remotes out of the box which is definitely a plus, but there is not much documentation out there about getting it working correctly. Even without installing the lirc daemon the remote somewhat worked with XBMC  but not as I would have expected. I spent the better part of two days attempting to get it working as my remote of old. I googled, I read forums and every blog post I could find about lirc and getting it setup with XBMC. There may have been a little grumbling and swearing thrown in for good measure. No matter what I tried, running irw it seemed to pick the remote up as a keyboard.

Since my remote apparently had an identity crisis I decided to try a different approach; if the remote wanted to be a keyboard that was fine with me. The trick is finding the key map for the remote and reprogram in such a way it did what I wanted it to do. First I needed to find out what driver it was using for the remote by running ir-keytable.

Found /sys/class/rc/rc0/ (/dev/input/event5) with:
Driver mceusb, table rc-rc6-mce
Supported protocols: NEC RC-5 RC-6 JVC SONY LIRC other
Enabled protocols: RC-6

The important part here is to find out what key table the remote is using, in this case I am using the rc6-mce key table. Next I copied the key table in /etc/rc_keymaps/rc6_mce into my home folder and basically the next part is trial and error. I ran ir-keytable -t (which operates much like irw) and pushed the button I wanted to map starting with the OK button to find the key code. I would then push the button that worked in XBMC to find out what that key code was and then Ctrl-C out of ir-keytable and fire up an editor to modify the rc6_mce key map file in my area. I changed the KEY_OK to KEY_ENTER in this case and saved the rc6_mce file. Next I ran sudo ir-keytable -c to clear the current table and then reprogram the buttons with sudo ir-keytable -w ~/rc6_mce which loads my new key map. I tested to make sure it worked as expected and I was happy to have my OK button back. OK indeed.

Basically  just rinse and repeat for any key you want to map on the remote. Once I was happy with my results, I copied the rc6_mce keymap from my home folder back to  /etc/rc_keymaps so it would be reloaded at boot. I made a backup of the original rc6_mce key map file just to be on the safe side.

Hopefully that will save someone a little bit of time and heart ache.

Railo installer issues on Arch Linux


The Railo installer does a great job across multiple operating systems but it is not completely infallible (although it does come awfully close). The installer will complete, but there are two extra steps you will need to take to get things up and running smoothly on Arch Linux.

First, fire up your favorite editor and open up /opt/railo/tomcat/conf/server.xml and scroll down until you find the HTTP connector block. You will see something along the lines of “@@tomcatport@@” listed where the port should be. Replace this value with whichever port you want Tomcat listening on.

Next we need to move the railo_ctl file from /opt/railo/ to /etc/rc.d/, this is the folder that Arch Linux uses for its daemon services instead of /etc/init.d/ like Debian and RHEL systems use. Once the file is in there, chmod 0755 /etc/rc.d/railo_ctl to set the permissions on the file.

Finally, if you want Railo to startup automatically on boot there is one final modification to make. With your favorite editor open up /etc/rc.conf and add railo_ctl to the DAEMONS line and it will now start when you boot your machine.  You should now be ready to start Railo up, just sudo /etc/rc.d/railo_ctl start and you should be in business.

Using PostFix to send emails using Amazon SES


Of all the Amazon Web Services I use,  the Simple Email Service would have to be the service I use the most. ColdFusion allows me to easily create a component that sends emails pragmatically but, however, it would be much nicer to use the CFMAIL tag and be done with it. As it turns out, Amazon SES allows you to send a raw email so you can run PostFix  to relay the message through Amazon SES using a perl script.

I found a good tutorial on getting this configured here. I did have an issue getting perl to find the SES.pm file, but this post details how to work around that issue. The great thing about handling it this way is other applications on the server can send messages through the gateway, not just ColdFusion applications.

Installing yasm on Amazon Linux


I am currently working on a project that requires me to build ffmpeg locally on an Amazon Linux instance.  I did a repo search and could find nasm, but ffmpeg didn’t like it at compile time.  Here is how to get yasm installed.  I am documenting this because I will probably need it again.  It is assumed you have already installed git-core.

git clone git://github.com/yasm/yasm.git
cd yasm
./autogen.sh
./configure --prefix=/usr 
make
sudo make install

Git is a handy little tool.

Installing s3fs on RHEL/Centos


Lately I have been doing a lot of work with AWS t1.micro instances running Amazon Linux which seem to be based on RHEL/Centos.  Both Railo and ACF do a good job of interacting with Amazon S3 storage which definitely makes our jobs as developers easier, but what if you wanted to mount your S3 storage locally to have access to your files at the system level so you could actually work with them?  Luckily there is an open-sourced s3fs project that will allow you to do just that.

At the time of this writing, the current file release is s3fs-1.59.tar.gz.  The unfortunate thing is, s3fs requires Fuse 2.8.4 and the newest version available in the package repos is Fuse 2.8.3.  The first step is to get the newest version of Fuse and get it on the server.

wget "http://downloads.sourceforge.net/project/fuse/fuse-2.X/2.8.4/fuse-2.8.4.tar.gz?r=&ts=1299709935&use_mirror=cdnetworks-us-1"

Once the download is completed, extract it:

tar -xzvf fuse-2.8.4.tar.gz
cd fuse-2.8.4

If you are still on a stock install of Amazon Linux, at this point we will need some tools to get everything configured and compiled.

sudo yum groupinstall "Development Tools"

This will install the tools we need for a moment.  However, we will need to install some more packages to get s3fs to compile.  We might as well get them now:

sudo yum install curl-devel libxml2-devel openssl-devel mailcap

Now we should still be in the the fuse-2.8.4 directory, so now it is time to configure and compile Fuse.

./configure --prefix=/usr
make
sudo make install
sudo ldconfig
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
pkg-config --modversion fuse

If everything went as planned, pkg-config should return 2.8.4.

Next we need to download and install s3fs.  First we need to get and extract the archive:

cd
wget http://s3fs.googlecode.com/files/s3fs-1.59.tar.gz
tar -xzvf s3fs-1.59.tar.gz
cd s3fs-1.59
./configure --prefix=/usr
make
sudo make install

The installation should now be in working order.  The next step will be to decide how you would like to create your password file for s3fs.  You can either create a site wide password file /etc/passwd-s3fs or you can create one just for your user account ~/.passwd-s3fs.  The files are required to be secure, so if you go with the system wide password file be sure to chmod 640 /etc/passwd-s3fs or if you want to use your user account, chmod 600 ~/.passwd-s3fs.  The format for the files is the standard [AccessKey]:[SecretKey].

Finally, lets map the drive to a local directory.  In my home directory I created a folder name s3storage that will be my mount point.  We create the mount with

s3fs [bucketname] ~/s3storage -o default_acl=public-read

I have only set this up on one machine so I still do not have the install down completely, but I was able to get this up and running successfully.  All the steps above are more or less from memory so I apologize for any hazy steps.  I will correct as needed.

Speeding up Aptana Studio 3


My IDE of choice when developing is Aptana Studio.  I was setting up a new install last night on a Windows development machine and it seemed like it was a little “sluggish” (yes, that is a technical term).

After some quick Googling I found Mike Henke’s post on Turbo Charging Eclipse.  Since Aptana is built on top of Eclipse this is just what I was looking for.  Mike’s guide is pretty dang comprehensive and I will not reiterate it but if you are looking for some performance gains I would consider it recommended reading.

Admittedly, I did not go through all the steps he outlined.  I made some “best guesses” based on my system configuration and went with it.  Here is my current AptanaStudio3.ini file for Windows, although the same optimizations should work equally well on Linux.

--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-name
Aptana Studio 3
-vmargs
-Xms512m
-Xmx512m
-Declipse.p2.unsignedPolicy=allow
-Djava.awt.headless=true
-XX:PermSize=128m
-XX:MaxPermSize=128m
-Xverify:none
-XX:+UseParallelGC
-XX:+AggressiveOpts
-XX:+UseFastAccessorMethods

The end result, Aptana definitely feels like it has a little more pep in its step.  I do not have any benchmarks or hard quantitative data to back that up, only my personal experience.

FireSSH plugin for Firefox


While scanning through my news feeds this morning I found a cool plugin for Firefox called FireSSH that, as the name alludes too, allows you to SSH to a host from your web browser.  Once the plugin is installed you can paste an SSH address in the url bar and go.

Now I just need to find something like this for Chrome.

MythTV vs Windows MediaCenter


I have been using Windows Media Center as my HTPC of choice for years now.  Recently Media Center has started crashing several times a day so I thought it might be time to mix things up a bit.  I have looked at a few other solutions, some running Windows and others running on Linux.  I could easily reload my HTPC machine with Windows, but ideally I would like to move on to something open-sourced and preferably on Linux; all my other machines run on various Linux distros. The main reason why I have not switched before is because I have about 2 TB of recorded video in Microsoft format that I did not want to lose, but now that I am having problems with the machine the collateral damage is not really an issue.

Currently I am looking at installing Mythbuntu to handle the HTPC role.  Basically I am just looking to see if anyone has made this switch and has any helpful hints on making the transition.  The biggest thing for me is the Media Center remote which looks like it will work well with MythTV.  I plan on transitioning over the weekend and I would love to hear about your experiences.

Having problems with artifacts running Docky in 3D mode under Linux?


I will have to admit that Docky is one of my guilty pleasures running under Linux.  I noticed I was having artifacts on either side of my dock any time I enabled 3D mode.  After a lot of Googling the issue, I saw that I was not alone.  Most of the articles suggested a bug in the driver and suggested updating to the new driver (in my case, this was the proprietary ATI driver).  Updating it did not seem to make a difference.  As a fluke, I quit Docky and restarted it and the artifacts were gone and all was right with the world (until I made another configuration change).  Quitting and restarting solved the issue again.

So if you are having issues with your Docky install, quit Docky and start it again.  It might not work in all cases, but it worked a treat in my case.

Setup Edimax USB wireless adaptor in Ubuntu


Linux and Ubuntu generally impresses me with the number of devices you can plug in and it just works.  Installing the Edimax EW-7811UN was not one of those times.  To be fair, I also had the same issue with an older model Linksys WUSB54GSC, but the form factor of the new Edimax was just too good to pass up (it bills itself as the worlds smallest wireless adaptor).    No matter how hard I tried to keep the Linksys adaptor out of harms way, my kids have generally tried to find way to try to break it off in the USB slot.  They take this mission very seriously although the Linksys adaptor has survived against all odds.

The nice part about the Edimax network adaptor is it does come with a set of drivers that compiles under linux but you have to download it from their web site.  Actually it is based on the Realtek RTL8192C chipset so do not be surprised when you extract the driver package.  Now on to the fun stuff.

Go into the directory where you extracted the drivers and build the modules:

make clean
make

That should  go ahead and build your modules.  Next we just need to use insmod to install the module to make sure everything is working:

sudo insmod 8192cu.ko

If all went well, you should soon be able to see your wireless network and connect normally.  If you are a glutton for punishment you can do this every time you start up your system to get net access going.  Personally, I prefer it just to work every time I turn on the system and it just requires a few more steps:

sudo cp 8192cu.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless
sudo insmod 8192cu.ko
sudo depmod -a

This will copy the newly compiled module into the kernel drivers directory and the depmod -a should add it to the module dependencies.   I am thinking this will probably have to be done on every kernel upgrade until the hardware is automatically detected so I am keeping my driver’s source around in case I need to recompile and reinstall the module.

Now to see what the kids try to break next….