Sunday, January 24, 2010

The $1,000 FreeVo

I get a lot of grief from my friends about this one. Unlike most of the people, I have a Mythbuntu box at home instead of a much less expensive DVR solution and what I struggle to explain is that this project started out as a different set of requirements. I wanted to have (purchase or build) a system that would have the following:

- Allow for 100's of GB of storage to be able to back-up all my photographic work and all the laptops at home (5 total!).
- Have a Linux O/S in order to be able to test some software solutions that would not run on any of the 5 Windows laptops.
- Full fledged development Web-Server with the LAMP stack installed, to be able to test sites on a local server.
- Central storage for all my music files.
- A networked, always-on system, accessible at any moment, from any place in the house.
- Being always-on, I wanted a SILENT, low-power consumption box, instead of a noisy, of-the-shelf server (I had a Cobalt before and it was like a hair dryer on all the time).

Then I figured:
- If this systems is going to be always on, and have all my music files on it, I want it to be hooked up to my Stereo.
- Now that it is hooked up to my stereo, Wouldn't it be nice to have my big-screen TV as its monitor?
- And, now that it is hooked up to my TV and Stereo, wouldn't it be nice to watch movies on it? Or even record TV shows?

So this is how I bumped into Mythbuntu. My decision of using a Linux O/S was pretty much a done-deal. This was a promise of having a full-fledged LAMP server with all the multi-media functionality I also wanted.

Hardware Spec:
- The application is not very CPU-demanding, so almost anything would do. I used a Motherboard and CPU I had around. A core-solo @ 2.66 MHz with 1 Gig of RAM and integrated Audio and VGA video.
- One 160 Gb PATA HDD that I had around for the system disk.
- Two 500 Gb SATA HDDs I purchased new for a RAID-1 array
- A Hauppauge PVR-150. I chose this one when I started this project BEFORE the digital TV transition. It comes with an MPEG dedicated compression chip, so this way the CPU would not be tied up doing this during recording. It also comes with a Phillips-MCE-Compatible remote and receiver. I will probably add a 1600 digital card soon, to be able to record off-the-air, straight digital signal.
- An Adesso 3000UB wireless USB keyboard. I wanted this to be able to browse the web, and use the actual Linux server without being tethered to the box. This model, despite some bad reviews, has withstood my abusive use pattern. It has a built-in trackball and a scroll wheel, so you can drive it kinda like a game console.
- A pair of Ethernet over powerline adaptors. I wanted to have this unit by my entertainment center (where there is no CAT-5 wiring), but still have decent connectivity, so I chose this over wireless.
- ANTEC box. I selected this one as I needed minimum wife friction. This box goes in the living room and the aluminum finish of this box is very discreet and looks like a Tuner. The box also has dual fans that can be throttled. I set them to the minimum speed and there is NO audible noise at all. The box has enough space for 3 HDDs and a DVD unit. This is a must if you are building a server. On the front of the box there is a VFD display. I had issues with this as the chipset has a IR receiver that is not functional but the O/S detects it in some cases. Because of this I disabled it by unplugging the USB interface that powers it.


Setting up the system:
When you install a UBUNTU system, things are just much more easier if you have everything in the box before you fire up the O/S. The plug-and-play functionality works well at initial install as long as your stuff is quite standard. Once the operating system is installed, dropping in an additional piece of HW can be more challenging (as it proved to be on my initial attempts).

1.- Under this configuration I would set everything in the box, except for the RAID-1 drives, then verify that it powers on without major errors.

2.- Download the Mythbuntu ISO. Mythbuntu is distribution that is a blend of Ubuntu and MythTV and comes with all the funky drivers, like the MCE Remote and the PVR150. I recommend you use a version based on one of the Server releases (8.04 was the latest LTS version at the time of this writing). Ubuntu has frequent updates for the desktop environment, but some of these updates can break your setup.

3.- Burn the ISO. You can use any software burner. In case you need one, CDBurnerXP is a good free alternative.

4.- Pop the CD in the optical drive of the newly built system. Follow the menues for installing UBUNTU on the system HDD and when prompted, select "Advanced Install". Here, add the VNC and MythTV services. On screen 12/15, enable the remote selecting "Windows Media Center (New)".

5.- Once UBUNTU has finished installing and rebooted, Launch the MythTV Setup. In my case I had to select General: US-Cable, Capture Cards: MPEG-2, setup the Database as "mythconverge" (is the default), and selected "Schedules Direct" (This is a Non-For-Profit Scheduling service that costs ~$20/year.) as my Video Sources. On "System Roles" select (add) "Ubuntu Desktop" so that all the stuff that comes with Ubuntu, such as Open Office, etc. gets installed.

6.- If you want to use Pandora on your box, you will have to install Flash. There is no Pandora applet for Mythbuntu at this moment. The Web browser on Mythbuntu is a Konqueror port. So you have to install Flash on the Konqueror browser. To do this, go to the menu (by pressing Ctrl-Esc) and select System>Add/Remove. Look for Konqueror. You might have to enable all software sources to do this. After you have installed Konqueror, open Firefox and close it. Now run Konqueror and install Flash (by navigating to Adobe's site).

7.- If you will be installing RAID devices, run in a console "sudo apt-get install mdam" and "sudo apt-get install raid". I followed the full How To published HERE.
- Partition your drives using fdisk. You can list your devices without risk using "sudo fdisk -l" If your first disk of the RAID array is your SECOND drive, you would use: "sudo fdisk /dev/sdb"
- Once you have created the raw partitions, these will be "ext3", the default Linux type, which is not available for RAID, so you will have to change their type to "Linux RAID Auto - fd" by using the "t" command in fdisk. Make sure you write your changes (command "w").
- Create the raid device using "sudo mknod /dev/md1 b 9 2"
- Create the RAID-1 array "sudo mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1"
- Verify that the array is created and synced: "sudo cat /proc/mdstat"
- Once it is synced, put a file system on the array: "sudo mke2fs -j /dev/md1
- Now mount the array on the /raid folder: "sudo mount /dev/md1 /raid
- Once everything is checked, create a line in /etc/fstab using: "sudo nano /etc/fstab"
- Add line "/dev/md1 /raid ext3 defaults 1 2" so that the array mounts with every boot.

8.- Once you have installed your RAID devices, now you can reconfigure your system to RIP your DVDs to the redundant array and also the music utility to save on this one. This way if your system drive fries, you will still have the files.

9.- Now you can configure other stuff like the MythWeather applet to display the maps and forecasts you want as well as the MythFlix applet to show your queues.

There is no easy way to configure your MythFlix queue now. You have to input some parameters into the MySQL database. To do this, it is best that you install PHPMYADMIN. You can find instructions on this HERE. Once you have this installed add the parameters following the instructions HERE.

10.- Create SAMBA accounts for everybody who needs to backup. This is something that I struggled with. In Linux, you need to have a local account and a Samba account in order to have a share. Download the SAMBA administrative application going to the system meny and selecting System>Add/Remove.

Other Add-ons:
1.- LAMP server:
One of the things that I wanted is to have a full LAMP stack to be able to run websites off this box for development purposes. One of the easiest how-tos is HERE.

2.- VMWare Server:
At this moment there was no other way to use NetFlix instant watch but on Windows machines. So I installed VMWare and XP on this box. I used the tutorial published HERE. I found out later that Sun's Virtual Box uses much less resources so I switched to that.


Issues:
On my way here I have found a number of good How-Tos.

1.- If you have problems with your IR Remote:
- Install LIRC on Hardy - Step by step diagnostics
- MCE on Hardy problems - an entry on the Ubuntu Forums, with many different issues

2.- If your PVR card is not recording:
- Hauppauge Wintv pvr 150 - A good case where many diagnostics procedures are described

3.- If you have Audio problems:
- Comprehensive Sound Problem Solutions Guide - Self explaining...

4.- Alright, you obsess about getting the VFD working:
- VFD on Antec fusion (look for the iMON section!)
- LCD Proc on MythTV.org
- HOW-TO Configure the VFD to work with MythTV on a Antec Fusion case - This even gets into using the Control Wheel on the box to drive the menues

Other improvements:
1.- RAID upgrade. I recently changed my 500 Gbs to 1.5 Tb drives. There is no way to "grow" a RAID array, so I had to create a new one and transfer the data using an external box.

2.- Backup system HDD. As you can imagine, after this server is up, it becomes critical to everything you do, backups, Websites, etc. So I decided to create a second drive that I could throw in, in case of a problem. I cloned my system HDD with G4L. The "receiving" drive was bigger, and G4L seemed to be confused by this, it was just taking to long to clone. By creating a partition on the second drive of exactly the same size as the source drive, the image was completed in 20 minutes. This larger drive now holds a partition exclusively for recordings, this way overrecording cannot ever cause problems with the O/S.

3.- Digital card. This is one that I want to do as I cannot get any content directly from the air right now.

4.- Version upgrade: Newer version now features MIRO and other plug-ins. I will try to figure out a safe way to perform this upgrade.


The $1,000 FreeVo, asides from humor, is an understatement as this is not a DVR. This is my home server with full LAMP capabilities, disk redundancy for backing-up my laptops and a central repository for my music files (several iTunes instances can sync onto these files through the network straight to an iPod, without taking up space on a laptop). On top of this, the box also acts like a DVR which justifies its place in the living-room. The fact that it is a regular computer, allows for running HULU and Pandora. Obviously, when you want to make a change, you usually have to open up that terminal window...