If you're interested in setting up an extremely quiet Home Theater PC, then you should consider setting up a Compact-Flash or USB thumbdrive based system. Compact-Flash memory cards implement a hardware and software interface which is identical to IDE, so all that's needed is a simple adapter card to use one as a drop-in replacement for a hard drive. CF-IDE adapters are cheap and readily available from places like EBay, DealExtreme, or Mini-Box. Note that some old CF-IDE cards are missing data lines and do not support proper DMA, so make sure you get one from a seller that at least claims their card does support DMA. And if you run into problems with your card, be prepared to toss it and buy a better one.
Be aware that CF cards come in many different speeds, and are overall slower than traditional spinning media. The storage capacity of CF cards is also far, far less than any hard drive out there, so it really is only suited to be used as the boot filesystem for an HTPC. Still, a CF-based system is fairly inexpensive to build, extremely quiet, and easily complemented by a remote network fileserver or even external storage such as USB hard drives. An added advantage of a CF-based system is the fact that it is trivially simple to copy the entire filesystem for backup before you experiment with changes.
The instructions below refer to a Compact-Flash filesystem, but the instructions are essentially the same for a system that boots from a USB flash-drive.
Installing and Configuring a Compact-Flash Based Freevo Box
In the following instructions, I'll describe how I set up a CF-based Freevo HTPC. In my case, I used an Epia M10000 motherboard and Ubuntu 8.10. You are free to use whatever you like, but make sure that your system can support IDE drives-- especially for booting!
- A HTPC (case, motherboard, power supply, mouse, keyboard, CD/DVD ROM, etc.)
- OS install disk (Ubuntu 8.10 server alternate install)
- CF-IDE adapter that supports DMA
- A Compact-Flash card (2GB or better, depending on the footprint of your OS)
Preparation of Hardware
- Perform all the usual setup of the system (install motherboard, connect power cables, hook up CD/DVD ROM, etc.)
- Insert the Compact-Flash card into the CF-IDE adapter, taking care to align the slots on the sides of the card and adapter (it can really only fit one way without forcing)
- Insert the CF-IDE adapter into the IDE slot on your motherboard, taking care to not insert it backwards (most likely the CF-IDE adapter will have a blocked pinhole to match the IDE connector on your motherboard, encouraging you to orient it correctly)
- Boot up your system and hit the hotkey to drop into your BIOS configuration
- Examine the BIOS setup screens to confirm that the system can detect the CF-IDE adapter (if there are problems, check the orientation of the card and the adapter, test the CF card alone on another machine, try a different CF-IDE adapter, etc.)
Installation of OS
- Boot from Ubuntu server installer
- Select language
- Press F4 to select install options; choose the "Command Line" installation option
- Follow the instructions to install Ubuntu as usual
- Pay particular attention to the selection of hard drive during installation, since you want it to install to your CF-IDE adapter
- Reboot as prompted; if all goes well, you will boot from your cool little CF-IDE adapter
At this point, you now have a functional system running off the CF-IDE adapter. From here, we go on to install everything we need for a fully functional Freevo system.
First up, update all the base packages:
- Log into your CLI Ubuntu 8.10 system
- Update and upgrade all packages via the usual "sudo apt-get update ; sudo apt-get upgrade"
Install and Configure Sound Support
Next up, we need to install sound support:
- Execute "sudo apt-get install alsa-utils" (several other required packages will also be installed)
- Installation of alsa does not automatically configure your sound card, so do an "asoundconf list" to see the available sound hardware
- Using the name of the sound hardware from the previous step, set the alsa default sound card; in my case, my sound hardware was called "V8235" so I executed "asoundconf set-default-card V8235"
- Ensure your user is part of the "audio" group; my username is "rrwood" so I executed "sudo adduser rrwood audio"
- To have the change in group membership take effect, log out and log back in again
- Execute "alsamixer" to set the audio levels and ensure that your sound channels are not muted (use the left/right arrow keys to navigate between channels, press "m" to unmute a channel, use the up/down arrow keys to set the channel volume, press escape to exit; note that there are a number of channels beyond the right edge of the screen)
- Test your sound by playing one of the sounds in /usr/share/sounds/alsa/ like this: "aplay /usr/share/sounds/alsa/Front_Center.wav"; if everything is working correctly, then you should hear a woman's voice say "Front Center"
- Save your sound configuration like this: "sudo alsactl store"
Install and Configure X
Now that sound is working, it's time to get a functional X setup working:
- My Epia M10000 has a Via Unichrome graphics chip on the motherboard, so I need to install the X.org Unichrome driver. You'll need to determine the appropriate driver for your hardware; the full list can be viewed via "apt-cache search xserver-xorg-video"
- Once you have determined the correct video driver for your system, install it. In my case, I executed "sudo apt-get install xserver-xorg-video-openchrome". Once again, many additional packages will be installed.
- X.org needs the hal package installed to find the mouse, so I needed to install it: "sudo apt-get install hal"
- In addition to the basic X.org setup, I like to install the Openbox window manager so I can start up X.org as a regular user: "sudo apt-get install openbox"
- I also like to be able to start X.org manually using the "startx" command, so I also installed the xinit package: "sudo apt-get install xinit"
- Finally, rxvt is a nice, light terminal app: "sudo apt-get install rxvt"
With all the X.org packages in-place, the last thing to do is to set up an appropriate .xinitrc file. I just use vim to create a file containing the single line "exec openbox", though you might also want to include a line like "rxvt &" before that in order to start an rxvt terminal up automatically. In the past it was necessary to include a "#!/bin/sh" at the start of the .xinitrc file, but that appears to no longer be necessary. Similarly, it no longer seems necessary to make the .xinitrc file executable via "chmod u+x .xinitrc".
- After installing all the required X.org packages and setting up your .xinitrc, you should be able to start up X from the console using the startx command. If things don't work, then take a look at the /var/log/Xorg.0.log file and look for any error ("EE") messages.
Now that sound and X are working, it's time to install Freevo and all its dependencies:
- Execute a "sudo apt-get install freevo" This will install a lot of packages, so be patient.
- The install will ask you a number of questions about Freevo; answer them appropriately for your system (e.g. screen resolution, TV channels, whether to start Freevo at boot, etc.)
- The python 2.5 install in Ubuntu has a small issue with the location of an important XML package, so Freevo will not start until you do this: "cd /usr/lib/python2.5/site-packages ; sudo ln -s oldxml/_xmlplus/" Be careful on the spacing of the ln parameters-- you are trying to create a symbolic link called "_xmlplus" in the /usr/lib/python2.5/site-packages directory, and have it point to the /usr/lib/python2.5/site-packages/oldxml/_xmlplus directory, so either use the ln command exactly as shown, or be sure you know what you're doing.
- With all of the above done, you can test Freevo by starting up X (startx), and issuing the "freevo" command in a terminal. If there are any problems, you'll see the output and will have to address them.
- If Freevo starts up correctly from your X session, then all should be well. If you chose to have Freevo start up automatically at boot, then you might want to try rebooting now to test that it works as expected.
Auto-Mounting USB Storage Devices
Now that your Freevo box is up and running, you are probably going to want to make some content available. An easy way to do this is to set the system up to automatically mount/unmount USB drives, thus allowing you to watch movies you've downloaded. I like the usbmount package for this, since it is small, has minimal dependencies, and is really easy to configure. You might also be interested in ivman or some other auto-mount solution.
Installing and configuring usbmount is easy:
- Install usbmount: "sudo apt-get install usbmount"
- Configure usbmount by editing the file /etc/usbmount/usbmount.conf. The file is very well commented, so it should be simple to configure to suit your needs. Don't forget that you need root privileges to edit the file: "sudo vi /etc/usbmount/usbmount.conf"
- Since most USB thumbdrives are formatted as VFAT volumes, you will probably want to configure usbmount to support VFAT partition types. Look for the "FILESYSTEMS" line and add "vfat" to the list of supported types (there will probably be entries for ext2 and ext3 already).
- The config file warns that VFAT filesystems can be corrupted if not properly unmounted. In my case, I chose to deal with this by mounting the filesystems as read-only. To do this, I modified the "MOUNTOPTIONS" line to read as follows: MOUNTOPTIONS="ro,sync,noexec,nodev,noatime" Note the inclusion of the read-only option, "ro". By doing this, I can easily remove a USB thumbdrive without having to go through the hassle of syncing and unmounting the drive. More importantly, my wife and children can insert and remove USB thumbdrives without having to sync and unmount them!
Note: the change to the "MOUNTOPTIONS" line affects all filesystems handled by usbmount. If you want to be more selective, you can modify the "FS_MOUNTOPTIONS" line and specify options that only apply to VFAT partitions. In my case, I want all removable storage devices mounted read-only by deafult, but you may feel differently.
Adding Hard Drives
Even though you have your system booting nicely from a CF-IDE card, you may end up wanting to add a hard drive at some point. To do that, you'll have to do something along the following line:
- Physically install the drive
- Boot up and check that Linux sees your drive (perhaps do a "dmesg | less" to see all the startup log messages, or just do a "sudo fdisk -l" to list all the drives available)
- Partition the new drive via "sudo fdisk /dev/sdb" (assuming that the new drive shows up as /dev/sdb)
- Create a filesystem on the new drive. Assuming you created a single partition and want to make the new filesystem ext3, then you'd do something like this: "sudo mke2fs -j /dev/sdb1". To make things simple, I'd recommend you also label the new filesystem with a unique and distinctive name, so do something like this: "sudo mke2fs -j -L WD500GB /dev/sdb1". The "-L WD500GB" switch tells mke2fs to label the new filesystem as "WD500GB" (obviously you can pick any name you like as the label). Having a label for the filesystem makes it much easier to set up the /etc/fstab file to automatically mount the disk.
- Create a mount-point for the new drive. I chose to mount mine at /media/wd500, so I did this: "sudo mkdir /media/wd500"
- Edit /etc/fstab to auto-mount the new drive at boot. This requires adding a line like "LABEL=WD500GB /media/wd500 ext3 defaults 1 2" to the end of the /etc/fstab file.
- Test the mounting of the new disk by doing a "sudo mount -a". If all goes well, the new drive will be mounted where you wanted it (/media/wd500 in my case). You can easily list all the mounted volumes via "df -h".
- You will need to set the ownership for the new drive or the directories on the drive. A simple approach would be to create a directory on the new drive (e.g. "sudo mkdir /media/wd500/movies") and then assign ownership of the new directory to the freevo user like this: "sudo chown freevo:freevo /media/wd500/movies". You could also do some more elegant tricks with groups and permissions, depending on your personal preferences.
If the disk you are attaching is already formatted, you may wish to use it as-is. You may still want to label the disk for easier auto-mounting; this can easily be done via the e2label command (e.g. sudo e2label /dev/sdb1 WD500GB).
In addition to disk labels, Linux also supports disk UUIDs. You can use the blkid command to list existing disk UUIDs ("sudo blkid") and then use the UUID of the disk to configure /etc/fstab (e.g. add a line like this to /etc/fstab: "UUID=12345678-90ab-cdef-1234-567890abcdef /media/wd500 ext3 defaults 1 2".
(More to be added tomorrow.... Configuring Freevo to minimize writing to the flash file-system, suspend of system, etc.)