Friday, November 13, 2009

Upgrading SqueezeCenter to SqueezeBoxServer

Logitech has released an upgrade of SqueezeCenter (now called SqueezeBoxServer btw) and here are the steps for upgrading from version 7.3.2 to 7.4.1.

  1. Uninstall SqueezeCenter 7.3.2
    # /ffp/sbin/funpkg -r squeezecenter-7.3.2-1.tgz
  2. Upgrade and install additional necessary Perl packages
    # wget -r -l1 --no-parent -A.tgz http://www.inreto.de/dns323/fun-plug/0.5/extra-packages/perl/
    # /ffp/sbin/funpkg -u *.tgz
    # /ffp/sbin/funpkg -i *.tgz

  3. Install SqueezeBoxServer 7.4.1
    # wget wget http://www.inreto.de/dns323/fun-plug/0.5/extra-packages/squeezecenter/squeezeboxserver-7.4.1-1.tgz
    # /ffp/sbin/funpkg -i squeezeboxserver-7.4.1-1.tgz


A couple of things to note:
  1. SqueezeBoxServer installs to /ffp/lib/squeezeboxserver and /ffp/etc/squeezeboxserver.
  2. You can delete any remainings of /ffp/lib/squeezecenter and /ffp/etc/squeezecenter.
  3. Before starting squeezecenter, it's safest to reset the database using /ffp/sbin/reset-slimserver-database.sh. Note that all your previous settings are preserved but your music library will be rescanned.
  4. Change the symlink for the logs in /ffp/var/log
    # rm /ffp/var/log/squeezecenter
    #ln -s /ffp/lib/squeezeboxserver/Logs /ffp/var/log/squeezeboxserver

Thursday, November 5, 2009

Kids - Joel's K2 Graduation Concert 2009


Actual dance performance :5 minutes
Actual day preparation :4 hours
Dance practice :8 weeks
Muvee of the whole event :timeless

Saturday, August 1, 2009

Need to sell/swap/throw/RMA/give away your hard disk? Sanitize it first!

Six months after my first NAS capacity upgrade, I finally managed to upgrade the capacity of the second hard drive in my NAS to 1.5TB as well. I had actually wanted to do this since the Western Digital launched the Caviar Green model for this size but stock was hard to come by.

Replacing the old 500GB hard drive with the new 1.5TB one in the NAS is easy enough, especially given my last experience. What to do with the old drive became a problem. In the first upgrade, I re-purposed the old disk as an external backup drive for my folks by housing it in a USB HDD casing. 500GB for a pair of old folks who ain't really into digital content is more than enough hence I figured giving them a second external backup drive will probably be a waste. I won't be needing it too since my storage needs are served by my NAS. As such, I decided to sell it away on my favorite online marketplace.

Now if the item I'm selling is an MP3 player, a CPU or any other components for that matter, I wouldn't think twice about just placing an ad in the forum the very day I decide to sell it. However, this being a device that stores content, and more specifically sensitive personal content (Other than personal pictures and videos, I digitize and store all my paper documents such as bills and statements), I figured I better sanitize it first to avoid subsequent misuse of my personal information. Call me paranoid but hey, better safe than sorry right?

In terms of how to sanitize the disk, there is no safer way than to physically destroy it either by incinerating it or smashing it into pieces. However, that obviously isn't going to work if you plan to sell the disk away.

The next best option is to run some software that will securely delete all your data from the drive. A couple of tools that I know of and have tried personally are:
  1. Darik's Boot and Nuke (DBAN) - a popular, open-source, linux-based self-contained boot disk that wipes any attached hard disks it detects. Incorporates a few wiping techniques such as Gutmann, DoD 5220-22.M standard, and zero/PRNG fill.

  2. Eraser - a Windows based utility that implements most of the techniques in DBAN.

  3. SDelete - a Windows based utility that uses core Windows APIs for its operations. Note that this utility can perform secure deletion of individual files/folders instead of the entire hard disk.

  4. HDDErase - a DOS based utility that relies on the hard disk firmware internal erase functions rather than block writes. Works only with newer hard disks (manufactured after 2001) since the erase function was not part of the ATA specification before that.
My current favorite is number (4) HDDErase. The key reason being that the secure erase is done at the lowest level possible ensuring that the operation is comprehensive (i.e. it also erases certain sectors not accessible by applications) and effective (i.e. it does not depend on assumptions on how the Operating System as well as the underlying physical hard disks perform read/write operations).

The minor grievance I have on this solution is that the software has to run in a true DOS environment (the command prompt window in Windows does not qualify) and the developer has not included a bootable ISO image as a release option.

Having said that, you can download UBCD which is a bootable CD/USB image containing HDDErase and a whole lot of other PC diagnostics tools. Note that its about 100MB in size hence its really an overkill if all you want is HDDErase (which weighs in at less than 1MB!).

For me, I used BootFlashDOS which is a simple executable (i.e. no install required!) that formats your USB stick and create a bootable DOS environment. Note that you will need a Windows XP or 2003 server host to run the executable though.

[EDIT: found an alternative way of creating a boot CD that do not require Windows XP or 2003 server. Check it out here.]

Thursday, June 11, 2009

MP4Cam2AVI - Freeware MP4 & MOV to AVI converter

For the longest time now, I've been capturing videos of my kids and family via my Panasonic digital camera DMC-FX01. The native format is M-JPEG compressed stream wrapped in a MOV container. If you are a Windows user, you will simply need to download the free QuickTime player to view the clips on your PC.

Over the years though, the number of clips I have grew and nowadays my family gets pretty bored when we have to sit through all those raw footage from the past. Hence I decided that its about time I pick up video editing to put them out of this misery.

As luck will have it, there is a pretty nice and powerful (for newbies and amateurs of course) video editing software bundled with the XP and Vista operating system called Windows Movie Maker. But alas, it does not support the MOV container format!

The good news is that there is a free and easy to use software called MP4Cam2AVI which can convert your videos from MOV into AVI at just the click of a button! The conversion is really quick if you retain the M-JPEG compression format (plus you don't suffer any loss in quality) and you can even select multiple files at one go! Of course, there is also the option to recompress the videos in XviD format during the converison to shrink the file size.

Although I would love to be able to just download the video files from my camera and start editing straight away, putting up with an extra step that takes just a couple of clicks and no more than a few minutes for the conversion (for free I might add!) is something I can live with.

Sunday, May 24, 2009

On demand start/stop SqueezeCenter possible?

My main gripe with SqueezeCenter is the ridiculous amount of RAM (around 90MB) it requires to run. On the DNS-323 which has only 64MB of RAM, this means constant virtual memory swapping even when the process is idle (i.e. not serving any clients).

This is rather annoying as it means the disks in the NAS can no longer spin down even when there are no user accessing the box. It has also made redundant all my previous efforts in getting the disks to spin down as often as possible (e.g. moving ffp, mysql db and www pages to a USB stick).

To get back my desired behaviour, I have three options:
  1. Upgrade to 128MB of physical RAM
  2. Run Squeezed (a lightweight alternative) instead of SqueezeCenter
  3. Start/Stop SqueezeCenter on demand
The first option is my preferred option as it should improve overall performance and not just for SqueezeCenter. However, it is extremely risky (changes of bricking your box is very high) as it involves some hardware modification and low level bios code hacking. Not recommended for the faint hearted and those under warranty. (And I just so happen to fall into both categories)

The second option seems like a good idea but it is really basic right now and lacks a lot of SqueezeCenter's features. Perhaps some time in the future I will reconsider this option.

The third option is a good compromise between having the full feature set of SqueezeCenter and getting my power-saving mode back when my SqueezeBox Boom is turned off. The only drawback is that there is a 2-3 minutes wait (for starting the monster up on the DNS-323) before the SqueezeBox Boom gets connected to SqueezeCenter when it is powered on.

I followed the instructions in Yannick's post and managed to get it working on my box with little trouble. I also made a number of changes to make it more robust, configurable and fit the ffp environment better. If you have followed my previous post on getting SqueezeCenter running on the DNS-323, you may find this approach more friendly.

In addition, I created a startup script for the standby daemon so that ffp will start the standby daemon rather than SqueezeCenter on boot/reboot. The assumption here is that I most likely do not need SqueezeCenter when I boot/reboot the box and I rather let a SqueezeBox client trigger the startup of SqueezeCenter than to have it unnecessarily load up my boot process and increase the boot time.

Here's a log of what I did to get this setup working in my environment:
  1. Set up standby daemon script
    1. Download and install script (link)
      # cd /ffp
      # wget -O standby_daemon.tar.gz http://forum.dsmg600.info/attachment.php?item=497
      # tar -xzvf standby_daemon.tar.gz
      # rm standby_daemon.tar.gz
    2. Configure sudoers to allow user nobody to trigger the script without password. [IMPT: do not blindly copy the code below! replace {your_hostname} with your real hostname!]
      # cd /ffp/etc
      # chmod u+w sudoers
      # echo "nobody {your_hostname}= NOPASSWD: /ffp/sbin/slimserver_standby_daemon.pl" >> sudoers
      # chmod u-w sudoers
  2. Set up SqueezeCenter plugin - Server Power Control
    1. Download and install plugin from here
      # cd /ffp/lib/squeezecenter/Plugins/
      # wget -O SrvrPowerCtrl.zip http://forums.slimdevices.com/attachment.php?attachmentid=7357&d=1241562529
      # unzip SrvrPowerCtrl.zip
      # rm SrvrPowerCtrl.zip
    2. Restart SqueezeCenter to load the newly installed plugin.
    3. Go to the settings page of the plugin (Settings>Plugins, look for Server Power Control and click on settings on the right) after SqueezeCenter has restarted
    4. Check the first two options (Shutdown and Shutdown to SqueezeNetwork) and enter "sudo /ffp/sbin/slimserver_standby_daemon.pl" in the textbox below it (both of them). Leave the rest of the options unchecked as we can't use them on the DNS-323.
    5. At the end of the settings dialog, select the option Monitor idle Players and select Shutdown server for the field Action to take after idle time. Optionally you can also setup the same in End of day action with a shorter idle time.
    6. Save the settings and you are done.

  3. [Optional] Start standby daemon instead of SqueezeCenter on boot/reboot
    # cd /ffp/start
    # chmod a-x slimserver.sh
    # chmod a+x slimserver_standby_daemon.sh
  4. Tips and Tricks
    1. The standby daemon outputs a log file called standby_daemon.log in SqueezeCenter's log directory (i.e. /ffp/lib/squeezecenter/Logs/). It records the timestamps of the shutdown and startup events which I find useful for tracking the uptimes as well as for debugging purposes.
    2. The default settings in the standby daemon script does not shutdown MySQL. (My instance of MySQL is used for other purposes hence I have to let it run independently). If you wish to have the script manage that, change the var $stop_mysql from 0 to 1. The script will, however, start MySQL if its not already running regardless of this setting. (Make sense right?!)

A couple of things still need to be sorted out in this setup:
  1. Wakeup prior to alarm - Since SqueezeCenter is no longer running all the time, alarms that plays from SqueezeCenter will not work. Initial idea is to modify script to set up a cron job to wake SqueezeCenter a few minutes prior to the alarm being triggered. Note that this should not affect you if your alarms are set on SqueezeNetwork and you have configured Server Power Control to automatically switch you to SqueezeNetwork when SqueezeCenter is being shutdown.
  2. Scheduled music library scans - Since SqueezeCenter is no longer running all the time, the scheduled daily scans may not be taking place anymore. Initial idea is to modify script to look for this setting and setup a cron job for it when the daemon is active.
I do not have any urgency to get these features working as I currently do not use them. I will probably get round to them if there is demand for it.

Thursday, May 21, 2009

Setting up SqueezeCenter on DNS-323


One of the best features of the Squeezebox Boom (or any other SqueezeBox devices for that matter) is the ability to remotely control it as well as to stream your own music collection to it. But to do this, you will need to install and run a server software called the SqueezeCenter somewhere on your network. The ideal place to host it will be where you store your music library and in my case, that would be my SOHO NAS, the Dlink DNS-323.

Typically, the first question that comes to mind when you need to install and run a software is the OS platform and hardware requirements. The good news is that SqueezeCenter is written in Perl and stores its data in a MySQL database hence will run on any OS platform which supports those two dependencies; And that practically means all common platforms out there e.g. Mac, Linux and Windows.

In terms of hardware requirements, its alittle heavy but nothing a recent PC cannot handle. On the DNS-323 however, it still runs but performance does take quite a hit. In my setup, the memory footprint is around 90MB for SqueezeCenter alone plus another 20MB for MySQL and CPU utilization spikes to 100% often when using the web interface. Note that the DNS-323 has just 64MB of physical RAM and a 500MHz ARM CPU. Having said that, the web interface is still fully usable (no time outs) although you do feel the lagginess with most operations.

Luckily, the weak server hardware does not affect its streaming abilities and so far (er.. that's just a couple of hours usage since I got my box only yesterday), I have not experienced any issues on my SqueezeBox Boom. From my observations, the CPU hardly broke a sweat (>5% usage) when streaming mp3 format natively and the response on SqueezeBox Boom controls are pretty jiffy.

Here's what I did to get SqueezeCenter up and running on the DNS-323:
  1. Get ffp 0.5 up and running (see wiki or my post);
  2. Setup Pre-requisite 1 - MySQL
    1. If you don't already have MySQL running, see this post;
    2. Create a new database and an associated db user for SqueezeCenter (NOTE: db and user should be called slimserver!) :
      # mysql -u root -p
      Enter password: your_root_password

      mysql> create database slimserver;
      mysql> grant all on slimserver.* to slimserver identified by 'your_password';
      mysql> flush privileges;
      mysql> quit
  3. Setup Pre-requisite 2 - Perl
    1. Download and install all the Perl packages found here:
      # wget -r -l1 --no-parent -A.tgz http://www.inreto.de/dns323/fun-plug/0.5/extra-packages/perl/
      # funpkg -i *.tgz
  4. Setup and configure SqueezeCenter
    1. Download and install SqueezeCenter package (squeezecenter-7.3.2-1.tgz);
      # wget http://www.inreto.de/dns323/fun-plug/0.5/extra-packages/squeezecenter/squeezecenter-7.3.2-1.tgz
      # funpkg -i squeezecenter-7.3.2-1.tgz
    2. Configure SqueezeCenter to start automatically when the box boots as well as to start it up now
      # cd /ffp/start
      # chmod a+x slimserver.sh
      # ./slimserver.sh start
    3. When SqueezeCenter starts up, it can take quite a few minutes before the web console becomes accessible. When it does become ready, you can access it via the URL http://[replace with your nas ip or hostname]:9000/
    4. Once you get into the web interface, the first thing you should do is to setup the path to your music collection. If your music collection is scattered all over, you will need create a "holding" directory and create the appropriate symlinks in there as SqueezeCenter only allows you to specify one location.
    5. Next trigger the scanning process to catalog your collection. Given the weak hardware of the DNS-323, the scanning process can take a long time to complete. (My 2000 odd files took 1+ hour to complete!)
  5. SqueezeCenter Tips and Tricks
    1. The location of the SqueezeCenter installation files (including plugins) are found in /ffp/lib/squeezecenter/.
    2. The location of the SqueezeCenter configuration files (including plugins) are found in /ffp/etc/squeezecenter/.
    3. The location of the SqueezeCenter log files are found in /ffp/lib/squeezecenter/Logs/. Since this isn't in line with where all my other logs go, I created a symlink to it at /ffp/var/log/squeezecenter/.
    4. You can set SqueezeCenter to automatically rescan your music collection once a day via the Schedule Rescan function in Settings>Advanced>Rescan Music Library.
    5. To reduce the memory footprint of SqueezeCenter, go to Settings>Plugins and uncheck all the plugins that you do not use. For me, I turned off the following plugins:
      1. Amazon CD Store
      2. Deezer
      3. Digital Inputs
      4. MP3tunes Music Locker
      5. MusicIP
      6. Pandora
      7. Rhapsody
      8. RSS News Ticker
      9. SIRIUS Internet Radio
      10. Slacker
      11. SlimTris
      Restart the slimserver process for the changes to take effect.
    6. If you find the display only shows the time and does not show the date in the "off/Standby" state, it is most likely because of your font setting. Change it (Settings>Player>Display>Standby Font) to "Standard" to see the date information.

    7. The slimserver startup script provided by fonz does not guard against firing multiple instances of the slimserver process. To fix this problem, include the following chunk of code at the top of the slimserver_start() function.

      # check if daemon is already running, if yes, do nothing
      if proc_status $command | grep -q "running as pid"; then
      echo "INFO: ${name} already running! Nothing to do."
      return
      fi
      # check if mysqld is already running, if not, prompt user and exit
      if proc_status "mysqld" | grep -q "not running"; then
      echo "ERROR: mysqld has to be running before ${name} can be started!"
      return
      fi
    8. The pre-configured SqueezeCenter settings uses named pipes for accessing MySQL, if you are having problems like database time-outs; e.g. you can connect to the web console but find that the scanning process did not find all your music files, check in the scanner log (/mnt/usb/ffp/lib/squeezecenter/Logs/scanner.log) for the following error messages:
      Slim::Schema::forceCommit (1496) Warning: Couldn't commit transactions to DB: [DBD::mysql::db commit failed: MySQL server has gone away at /mnt/usb/ffp/lib/squeezecenter/Slim/Schema.pm line 1493.
      ]
      Slim::Schema::Storage::throw_exception (70) Error: DBI Connection failed: DBI connect('database=slimserver','slimserver',...) failed: Can't connect to local MySQL server through socket '/ffp/var/run/mysql/mysql.sock' (2) at /mnt/usb/ffp/lib/squeezecenter/CPAN/DBIx/Class/Storage/DBI.pm line 652
      If it exists, then you may want to change SqueezeCenter to connect to the DB via TCP/IP instead. To do that, in your server config file, change the value of dbsource to "dbi:mysql:hostname=localhost;port=3306".

Overall, I'm very pleased with the setup. The only gripe is that my HDDs no longer spin down when the NAS is idle due to the virtual memory swapping caused by the SqueezeCenter process (which still consumes some CPU even when no clients are active!). I contemplated putting the swap space on the USB stick where ffp lives to circumvent this but decided not to as I'm not confident that my relatively new USB stick can take that kind of abuse (flash drives have limited write cycles). Perhaps its time to go for the 128MB memory upgrade hack!

Saturday, May 2, 2009

Squeezebox Boom is on the way!

As part of my ongoing project to build a connected home, I wanted to add a dedicated network music player for accessing my digital music library. This will complement my current pool of access points which comprises of solely multi-purpose network media players (i.e. XBMC on Xbox, VMC on HTPC and WMP on laptops).

This device will be used mostly as a bedside music player for my kids to access their music collection (yes, they have one!). In addition, I intend to also use it as a portable boombox around the house such as the patio and yard area where I can't access my other media players.

I started looking around for such a device last year and shortlisted a few; the Logictech Squeezebox Boom, Revo Pico WiFi Radio and the Sangean's WFR-20 Wi-Fi Internet Radio.

My top choice is the Squeezebox Boom as I really like the fact that it can work standalone as well as part of a multi-player system (i.e. together with other Squeezebox devices and/or compatible software based player running off standard PC based hardware). Moreover, both modes can be centrally and more importantly, remotely controlled via a web-based interface. This means that I can control my players in or out of the house and via any connected device with a web-browser (e.g. my mobile phone)! And to top it off, you can control them either via a locally hosted application (called the SqueezeCenter) or via the internet version hosted by Logitech (called the SqueezeNetwork).

Unfortunately, the Squeezebox Boom was not available locally and almost a year later, it still isn't. In the mean time, my kids have been bugging me relentlessly about having no access to their music in bed. So yesterday, I took the plunge and bought a Squeezebox Boom off ebay Australia for AUD$300 inclusive of local shipping.

Why Australia? Well, for one thing, I am going to get the overseas shipping free thanks to my cousin Yuan who has a friend returning from Australia in a couple of weeks time. And secondly, it is priced cheaper in Australia than the US. So its a no-brainer really.

ETA for my set to reach my hands is 20th May. In the mean time, I need to start figuring out how to get SqueezeCenter working off my DNS-323!