PSA: Hurrah for the internet again!  I’m the recent owner of a new vehicle with Bluetooth integration in the stereo system.  While I was eager to get everything up and running, connecting my Android smartphone to my car, it wasn’t without a hitch.  Hilariously, each time I started the car the Bluetooth would connect and start playing music from my phone with no interaction from me at all.  Strangely enough, this feature doesn’t automatically route the audio to the speakers in the car – and instead will default to whatever you were listening to prior (like radio, or satellite or CD, etc.).  In those situations, my phone is happily playing random music in my collection, but I may be completely unaware of this.  Not great for battery life on a smart phone to say the least.

Just speculation on my part, but it seems that these car stereo units are developed such that they will effectively press the “play” button to connect to your device initially.  Unfortunately, for us Android users, this gets immediately routed to the app that is currently handling the Bluetooth media buttons.  Your app will likely dutifully do as told and start playing Slayer at full volume on your device.

After a brief search, I stumbled across a few smart individuals on the Android forums who discovered a free app that is perfectly suited to solve the problem.  It’s called Media Button Router (Google Play Link) and unsurprisingly does exactly as it’s title suggests.  The app will, instead of routing the button press directly to the default music application, it will let you choose which application you’d like to route it to.  And if you don’t select one in a certain period of time (this is easily modifiable in the settings) it will default to ignore the button press altogether.  Problem solved.

Was this post helpful?
  • Thanks 
  • Sort-of 
  • Not Helpful 

Finally… I got around to researching a little issue that had been bothering me ever since I installed Ubuntu 12.04 back in April.  Watching videos, flash or otherwise would suffer from frequent skipping (or stuttering) of both the audio and video.  Previously I searched for a solution by searching for “video” stuttering, found some interesting articles that pointed to the nVidia graphics drivers.  But after a few hours of fiddling, nothing seemed to work.

Then, today, I finally got fed up enough to do another search.  This time I searched for stuttering “audio” and I found the holy grail, the fix!  As usual, the Ubuntu forums came to the rescue.

As it turns out, my Intel motherboard audio device may have been incorrectly recognized by Ubuntu and the audio driver may have been having issues.  So here’s how to fix it…

Open a terminal window and type:

sudo nano /etc/modprobe.d/alsa-base.conf

Scroll to the end of the file and then add the following:

options snd-hda-intel model=generic

Press “Ctrl-O” to write to the file then “Ctrl-X” to exit.

That’s about it.  I required a reboot to get it to work, but others mileage may vary.

Was this post helpful?
  • Thanks 
  • Sort-of 
  • Not Helpful 

I can’t recall if I’ve talked about FreeNAS before on this blog, but if I haven’t that may be a topic for another time.  Besides, lots of other folks have written about it in the past.  It’s great network storage for backing up all of our documents, photos, videos and music in one place with built in RAID backup.  It’s amazing.  And now with Subsonic, we have the option of installing software that can stream music (and now video) to any web browser or even smart phone on the internet.  Very cool.

Once again, I’m writing a really, really nerdy post as a public service to those out there who want to do the same and haven’t gotten enough guidance elsewhere on the internet.  Also this will serve as a persistent memory for my inevitable re-install later.  I’m sure most of my regular readers will want to stop reading at this point.

Before starting, it’s really important that you have enough space on your FreeNAS OS partition to hold Subsonic.  In the Subsonic forum it’s suggested that you carve out at least 150MB for all of the files.  I’d suggest allocating at least twice that if possible.  I’ve found that after a fair amount of use, the log file will start to grow pretty large, you may want to add codecs for transcoding, etc.  Personally this was the most painful part of the process since I had an “embedded” installation of FreeNAS on a USB flash drive which was fairly small.  During this process I used the capability within FreeNAS to backup the configuration before I re-installed.  Make sure when you re-install (if you need to) that do not choose the “embedded” option.  I installed from the CD-ROM image and chose the “full” install option onto a Hard Drive w/Data Partition (even though I will not actually use a hard drive or data partition).

The information and steps below are lovingly borrowed from the following two links, however I have mashed them up together, and added steps/made some changes that I found helpful during my experience installing the software.

  • Subsonic Forum: Sindre provided some helpful instructions to get your started on the install with FreeNAS.
  • Ozziks Blog: Huge thanks to this blog for helping with the finer points of the installation process.

Step 1: Prepare your server for the installation.

Before getting started, enable SSH access to your FreeNAS server.  You’ll find this under the web UI:  “Services >SSH”.  Set this to enable, and allow root.  You can log into your FreeNAS server by using any SSH terminal client.  Under Ubuntu (with SSH client installed) type “ssh x.x.x.x@root” (where the x.x.x.x is the IP address of your FreeNAS server).   If you have Windows use Putty.  Just remember that you must login as “root”, and not “admin”.

Setup FreeNAS’s Gateway IP.  This was something that I got hung up on for hours while trying to run the pkg_add command later in the process.  Well, maybe not hours, but it was an ah-ha moment when I finally stumbled upon the answer.  Under the FreeNAS web interface go to Network > LAN Management > Gateway = 192.168.1.1 (set this to your router’s IP address, mine happens to be 192.168.1.1).

Step 2: Download Java JRE (or JDK) package from:

http://www.freebsdfoundation.org/downloads/java.shtml

You should choose the JRE package according to your CPU architecture and FreeBSD version (if you have FreeNAS 0.7.x then you will want to download the FreeBSD 7 package, and of course based on your release, either AMD(64-bit) and i386(32-bit)).  I chose diablo-jre-freebsd7.i386.1.6.0.07.02.tbz, having FreeNas 0.7.2 and i386.  I then put this file onto my FreeNAS share drive so that you can access it directly from the shell (i.e. /mnt/share-name/path-to/file-name) later when you want to add the package.

Step 3: Install dependent packages (included the transcoders here as well, but may not be desired in your config):

$ pkg_add -v -r xtrans
$ pkg_add -v -r xproto
$ pkg_add -v -r xextproto
$ pkg_add -v -r javavmwrapper
$ pkg_add -v -r lame
$ pkg_add -v -r flac
$ pkg_add -v -r ffmpeg

UPDATE 1/10/2012:  If you run into issues with the latest versions of FreeNAS failing the pkg_add command like I did recently, the follow these instructions prior to the pkg_add commands.

Before installing the packages, if you are using FreeNAS 7.2 (based on FreeBSD 7.3), you’ll need to enter the following command:

setenv PACKAGESITE ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/i386/packages-7.3-release/Latest/

(substitute amd64 for i386 if 64-bit).

(May also work for other versions – if the version of FreeBSD is no longer considered the current release, the main mirror will no longer contain the package files, therefore the above is necessary to tell pkg_add where to find the .tbz files. You may set it permanently in ~/.cshrc if you wish it to remain sticky.)

If you have issues installing the lame codec you may also try the following.  I can’t recall if I ran into this issue or not.

$ pkg_add -r -v http://ftp.urc.ac.ru/pub/OS/FreeBSD/packages-7/Latest/lame.tbz

Step 4: Install the JRE (the .tbz file is the one you downloaded in step 2)

$ pkg_add -v /mnt/share-drive/diablo-jre-freebsd7.i386.1.6.0.07.02.tbz

Of course your version of the file and location may be different, so don’t copy/paste this portion.

Step 5: Download Subsonic standalone version and install it in /var/subsonic/standalone on your FreeNAS, as described here.  Just like with the Java package, I put the Subsonic Tarball on the share drive somewhere (i.e. In SSH:

$ mkdir /var/subsonic
$ mkdir /var/subsonic/standalone
$ cd /var/subsonic/standalone
$ tar xvzf /mnt/share-name/path-to/subsonic-x.x-standalone.tar.gz

Some folks suggest changing the permissions of all of the files at this point.  Technically it will probably work just fine untouched.  But if you want:

$ chmod 777 *.*

Step 6: Modify the subsonic.sh file.

/var/subsonic/standalone/subsonic.sh

If you are editing under Windows, do yourself a favor and save the file in ASCII format so as not to cause issues.  The fist time around I made changes in my Windows text editor and it introduced all kinds of invisible line breaks and null characters which caused the script to fail under BSD.   Just… don’t.

I also found an issue with the subsonic.h file, as shipped, under my FreeNAS implementation and am not quite sure why it doesn’t work.  It may work out of the box for you, but for some reason it was broken for me.  If you run into the same issue, you can make the following changes.

From:

cd $(dirname $0)
if [ -L $0 ] && ([ -e /bin/readlink ] || [ -e /usr/bin/readlink ]); then
cd $(dirname $(readlink $0))
fi

To:

cd /var/subsonic/standalone
#if [ -L $0 ] && ([ -e /bin/readlink ] || [ -e /usr/bin/readlink ]); then
#cd $(dirname $(readlink $0))
#fi

Step 7: Copy codecs into the Subsonic transcode directory:

mkdir /var/subsonic/transcode
cp /usr/local/bin/lame /var/subsonic/transcode/
cp /usr/local/bin/flac /var/subsonic/transcode/
cp /usr/local/bin/ffmpeg /var/subsonic/transcode/

There is one more step to get codecs to function properly that we’ll cover later.  If you installed some other codecs in step 3, then you’ll want to copy those to the transcode directory as well.

Step 7: In the FreeNAS web interface, go to System > Advanced > Command script and add the following “PostInit” script:

/var/subsonic/standalone/subsonic.sh

Step 8: Reboot FreeNAS, and go to http://<your-freenas-server>:4040 to start using Subsonic.

Step 9: Configure your transcoder settings.  In the Subsonic web interface go to “Settings > Transcoding”.

In this example, I’ve set up FLAC to transcode to WAV, then to MP3.   On the line reads “flac > mp3” modify the following:

Step 1 = flac -c -s -d %s
Step 2 = lame -b 320 – –

NOTE: This hard-codes the bitrate to 320kbps, which is presumptuous.  But hey, that’s what FLAC is all about right?  High quality.

My FreeNAS server is an under-powered system (mostly because it never needed to be powerful), so transcoding FLAC to MP3 basically consumes 100% of the processor bandwidth.  Listening to FLAC’s is something I will probably do sparingly.  Your mileage may vary.

Summary: It looks hard, but I’ve made all the mistakes for you, so this guide should save you some serious time.  If you run into any issues, Google is always your friend.

And in closing, if you haven’t yet donated to the project, I urge you to do so.  Sindre (the developer of Subsonic) obviously put a lot of hard work into this and it is just flat-out great software.  He deserves a little scratch for bringing this to the masses for free.  So do your part and support the community.  It’s an investment in your personal enjoyment of music and an investment in the future development of this software.

BONUS:  How to UPDATE/UPGRADE your Subsonic to the latest version on FreeNAS

From time to time, Subsonic has bug fixes and/or feature additions that may be compelling enough to make you want to upgrade your installation.  I could not find a single shred of information on the internet about how to update the “standalone” version of Subsonic on FreeNAS without completely re-installing.  I did some experimenting and came up with the below solution.  This is not endorsed and certainly should be done at your own risk.  Back-up your Subsonic installation before you try this.

Step 1: Shutdown Subsonic.  In the FreeNAS web interface go to System > Advanced > Command script and then delete following “PostInit” script:

/var/subsonic/standalone/subsonic.sh

Reboot the system.  Subsonic will not automatically run on restart and it will be safe to make changes.

Step 2: Back up your Subsonic installation by copying all files under /var/subsonic to another safe location.  If you for some reason run into an issue during the install, you should be able to simply copy all of these files back and be back in business.

Step 3: Download the latest standalone package here.  Put the new tarball on my FreeNAS share drive so that you can access it via the terminal (i.e. under the /mnt/share-name/path-to/ directory)

Step 4: Unpack subsonic-x.x-standalone.tar.gz to “var/subsonic/standalone”.  Using SSH:

$ cd /var/subsonic/standalone
$ tar xvzf /mnt/share-drive/path-to/subsonic-x.x-standalone.tar.gz

This will unpack the new files right over the top of the old files.  Edit permissions on the new files if desired.

Step 5: Edit the subsonic.sh file as necessary.  (see step 6 above)

Step 6: In the FreeNAS web interface, go to System > Advanced > Command script and add the following “PostInit” script:

sh /var/subsonic/standalone/subsonic.sh

Step 7: Reboot FreeNAS, and go to http://<your-freenas-server>:4040, login and confirm your settings.

Step 8: Enjoy.

I would love to hear your successes or failures to make this tutorial just a bit more useful.  Feedback is always welcome.

Was this post helpful?
  • Thanks 
  • Sort-of 
  • Not Helpful 

It happened over the weekend. I can’t precisely say when, but I know when I attempted to reboot my machine on Saturday morning, I was greeted with hard drive failure. The first sign that trouble was lurking was that my BIOS stalled for a moment, the screen went black and then printed “A problem has been detected with your Hard Drive. Press any key to continue.”. At this point, I was taken off guard and was still in denial. I pressed a key and the normal GRUB popped up and began the boot process. The familiar Ubuntu splash screen popped up and everything felt normal.

My confidence was almost restored, when the screen went to rapidly scrolling text with things like “Unable to find root inode”, etc. And so, it went. My OS was hosed. I downloaded the latest Western Digital Diagnostics CD, booted with this and discovered (through the SMART protocol) that my drive had finally given up. It had simply quit. As it turns out, as a drive begins to fail, it will attempt to remap the bad sectors to known good sectors on the disk that are allocated just for this purpose. But when you run out of good sectors to remap to, then catastrophic failures are eminent. My drive had reached this point… with really no warning whatsoever. Lesson learned – check the health of your drives regularly. Linux has some free tools to check the SMART attributes (smartmontools) that can even e-mail you when they detect a problem. And backup regularly.

On another subject, I do not “recycle” my hard drives. That is, I don’t ever re-distribute my old or broken hard drives back into the wild. Depending on the drive, I will not sell my old HD on e-bay or even give it away. There may be sensitive personal data on these drives that I don’t really want to get into the wrong hands. I have a “best-known-method” to dispose of my old and/or broken hard drives. Because I feel like sharing, I decided to film the process and post it here for your viewing pleasure. Enjoy.


UPDATE 12/8/2007: This might be a less destructive and less satisfying method.

Was this post helpful?
  • Thanks 
  • Sort-of 
  • Not Helpful 

ubuntu logoAbout to get geeky on you – so I apologize in advance. I’ve been thinking about it for a long darn time, but hadn’t yet put my money where my mouth was. That’s right, I’m talking about going 100% legal. Legal software that is. I’ve been about 90% legal for several years actually. All the application software that I’ve been using on my home PC is legit. There’s great open-source free software that is just as good and in some cases much better than the stuff that you have to pay for. And I’ve actually shelled out cold hard cash for the software that I can’t live without. There’s always been one piece of software, that’s critical, that’s been in the gray area of legality. The OS. I’ve been using licenses from work, up until now (and previous versions have really been legit), but I’ve always felt just a bit uneasy about using that. It seemed wrong for some reason.

After seeing some very impressive you-tube videos recently, and after several discussions with Suzy’s bro, I decided it was time that I gave Linux a try. I set out to read everything I could about Linux and what software would be a good equivalent to what I’m using in my current OS. I finally decided it could be done, and the distro of choice would, of course, be Ubuntu. So I downloaded a copy of 6.10, also known as Edgy Eft or just Edgy for short. I wasn’t brave enough to try out Feisty Fawn (version 7 is now in Beta), but it looks even better. Using some open source CD burning software, I burned an image of Edgy onto a CD. After a quick reboot, the system boots to the Live-CD which is basically the Ubuntu OS running off of the CD. It’s only temporary though, and any software installed will be wiped away with a reboot.

I wasn’t completely sold yet. I had some concerns. The first concern is that I have a good amount of data, pictures, music, video trapped on my current OS install. I need read/write access to that stuff and it needed to be air-tight and crash proof. I’d heard that NTFS was read-only in current linux distros so I was worried about this. I quickly discovered NTFS-3G which so far, has been rock-solid. It couldn’t have been any easier to install with Ubuntu. I just added the package, ran the configuration utility and blam-o! My drives are up and running with full read/write capability.

I also have several critical peripherals that need to work, and work well with the OS. The first being my iPod, the most important device that attaches to my computer. Secondly, my digital camera. You’ll be happy to know that both are fully supported and are actually a breeze to use. Dare I say, easier than my previous OS to configure. Actually, I can say it confidently, it’s MUCH easier now. I’m in LOVE with Amarok. I am serious. In my humble opinion, Amarok is years ahead of anything else available. I laugh at iTunes, WinAMP and all those other klunky pieces of software I used to use. This program alone makes the switch to Linux worth it. It synchs with musicbrainz, tags, album-arts, organizes, manages the iPod, makes playlists, shows lyrics and band information, you name it… it looks pretty to boot.

So far, so good, I’ll keep you posted. I’ve been living in a tux for almost two weeks now and loving it. Don’t get me wrong, it’s not for the faint of heart (you’re still required to use the terminal prompt – can’t live in the gui all the time), but it’s getting there and it’s good enough for what I need it for.

Until next time…

Was this post helpful?
  • Thanks 
  • Sort-of 
  • Not Helpful