keskiviikko 23. heinäkuuta 2008

MMS 1.1.0 nearing completition

MMS picture browser in action.

Release candidate 7 (RC7 for short) of the MyMediaSystem 1.10 was released yesterday. This might actually also be the last RC before the final 1.10. Before final release the build needs to be tested and the bugs need to be squashed, but I have to say I so far have not found any. I have skipped last three of the RC's because my system has been working very well and I've been consciously trying to avoid fixing anything that is not broken. Also there has not been so important features (for me) to be worth the hassle. RC7 is completely different matter though and it actually has two "must have" new features that I could not just pass by.

The user interface in RC7 has had a major upgrade, it finally scales nicely to high definition TV resolutions. I use mine in 1080p (1920x1080 pixels) and previously the interface components, like text and icons were very small. But now the interface scales nicely to higher resolutions, my main menu is still a bit crowded but that is mainly because as experiment I enabled almost every feature in MMS, now I will just cut down to what I use.

Also the selection indicator in the browsers (video-, audio- and picture-collections) is now much clearer, it zooms the selected icon to be larger and it now makes it a lot easier to browse a big collection. The interface also seems to be more responsive or it might just have to do with the improved lirc-configuration, but anyway I am very pleased with the new interface.

Go here to see the complete changelog and list of new features. At the moment the download host seems to be down, but there is a working link to the source code few postings down.

Weather-plugin is old news, it was already included in previous versions,
but it now integrates to right hand corner notification area
(as demonstrated in the audio browser screenshot) with clock.

torstai 14. helmikuuta 2008

Quickie: Setting NTP

If you are doing DVB recordings via timers like I am, then you probably want to set up ntp-client to update the systemtime in startup.

During this past month that I have been slowly building my HTPC, systemtime is already ahead by five minutes. That means basically that every timer now starts recording 5 minutes too early and ends early also. I have, of course, setup extra time before and after every timer, in fact VDR does this by default. But if the time gets ahead by more than 10 minutes, my recordings start to end prematurely, which of course is not very nice.

So ntp-client to the rescue! Here is short how to, in which we are using NTP-server in Finland, please find one closer to your location.

echo "net-misc/ntp caps" >> /etc/portage/package.use
emerge -a ntp

Edit /etc/ntp.conf and change the server to one close to your location. For us Finns it is "server".

Edit /etc/conf.d/ntp-client and change the NTPCLIENT_OPTS to following (again this server is in Finland)


Test the ntp-client by issuing date commands before and after starting the ntp-client. System time should be updated. If it works, set it to run every boot by adding it to default runlevel.

date /etc/init.d/ntp-client start date rc-update add ntp-client default

If running time sync every boot is not enough for you, then you can set up the ntpd. But do not setup the ntpdate to be run by cron, here is why.

tiistai 12. helmikuuta 2008

Installing HTPC software (part 3)

In this entry we will have a look at how to install VDR (Video Disk Recorder) on Gentoo.

This time we are not going to utilise Gentoos excellent emerge-tool, but we are going to do it manually. Main reason for compiling VDR by ourselves, is that this way we get the version we want, with patches we want. For the first time it may be easier to install VDR via emerge, but later on, if you want to play more with VDRs plugins, I suggest that you compile it by hand.

Patching VDR can be little bit tricky, so I am going to use my old pre-patched version of 1.4.7 VDR source code. As with MMS there is also unstable release of VDR 1.5, this time however I am going to install the old and proven-to-be-stable version. You should probably download vanilla source code, that way you can patch it yourself if you need to and if not, you can keep the changes to minimum.

First thing is to take care of the dependencies, emerge libcap and jpeg. Those two are required for VDR to compile. Now download the source code (I am using root to run VDR, bad policy, I know) in to /root, then extract it. Now I have following directory /root/vdr-1.4.7 and I will create following symlinks, these are also needed for compilation. After that you can just issue "make && make install" in VDR directory.

ln -s /usr/src/linux /root/DVB
ln -s /root/vdr-1.4.7 /root/VDR

Compiling the plugins is a bit more involved. You must extract your plugins into /root/VDR/PLUGINS/src directory. That is not enough though, you also need to create a symlink for every plugin, removing the version numbering. For example this is what you would do for subtitles-plugin

cd /path/to/vdr/PLUGINS/src
tar xvfmz vdr-subtitles-0.5.0.tgz
ln -s subtitles-0.5.0 subtitles

Do the same for all your plugins and modify the process accordingly, then just run "make plugins" in /root/VDR . If everything compiles correctly you need to copy the resulting files in /root/VDR/PLUGINS/lib to /vdr/lib, create the latter if it is not there already. (Notice that if you are compiling xineliboutput-plugin then you need to run "make install" in xineliboutputs own directory.)

Now you are set to go, meaning you can start the hard part, configuring VDR and plugins.

In next entry, configuring VDR and adding the needed scripts.

tiistai 5. helmikuuta 2008

Installing HTPC software (part 2)

OK kids, today we are learning how to install the MMS (that is short for My Media System kids) the ´Hard way´.

Nice screenshot showcasing new feature, movie thumbnailing.

Kidding aside, installing the latest, unstable release 1.1.0, is not that hard either. Thanks to nice people in Gentoo (and MMS) community we already have mms-1.1.0-rc1.ebuild available. Using the ebuild the installation is pretty easy, although it has few more steps to it, than the basic stable installation I talked about in part 1 of "Installing HTPC software".

First thing we need to do is create a local portage. Make sure you have /usr/local/portage directory available and create it if not. After that add the following line in to your /etc/make.conf, if it is not already there.


Then create the following directory structure


In the directory mentioned above, run following command to download the ebuild. (Sorry about the small print, but the loses few letters from it if it is any bigger.)


Then you need to make few changes to package.keywords and package.use files. The first one adds CPU-type detection for MMS package installation and another one tells emerge to use latest available version of MMS.

echo "media-video/mms cpudetection" >> /etc/portage/package.use
echo "media-video/mms ~*" >> /etc/portage/package.keywords

Next we "digest" the ebuild to create correct Manifest, then we are going to emerge the MMS.

ebuild mms-1.1.0_rc1.ebuild digest
emerge -av =media-video/mms-1.1.0_rc1

Now emerge should run its course and you should have functioning MMS as a result. Configuration files reside in /etc/mms directory, so start from there, some configuration is needed in several files. You should be able to figure out the needed changes, which of course, depend on your setup.

Before we can actually run the MMS we need to install X server, all we need is the most basic of graphical mode. I for example have no need for a desktop environment like KDE or Gnome. Installing basic GUI is as easy as typing "emerge xorg-server" after that you need to configure the graphics settings in /etc/X11/xorg.conf, but I will leave that to you, since every hardware configuration has it´s own settings. However here is a sample xorg.conf for Mirai DTL-642E500 television with Nvidia graphics adapter.

Once the xorg.conf is ready, easiest way to start MMS with X is to edit /etc/xinitrc file this file gets executed when X is started. So add a line like one below to start MMS automatically on X startup.


More on my MMS configuration in next entry (or one after that), you should be able to go on by yourself, configuring your /etc/mms settings to way you like.

Disclaimer: Thanks for the ebuild and advices on how to get it to work goes to Vitalogy in MMS forums.

keskiviikko 30. tammikuuta 2008

Trying to evolve

We Finns have proverb about learning by "kantapään kautta", basically that means that we learn from our mistakes. This must be the one of most painful methods of education, but it sure is effective. If you are wondering what I am babbling about, then please read my first blog entry, because this entry is about BACKUPS.

An easy and pretty fast way to make a backup of Gentoo installation is by using script called Stage4. This archives your root partition either into single or multiple gzip's or bz2's. The script is easy to use and does not need much configuration. I am currently running it with default settings. During my first backup my root partition used 2.7GB and was compressed to 552MB. I am storing the backup-archive on my workstation, because even I cant wipe out two computers at once.

You can download the stage4-script from here. I advice you to read through it, the configuration is in the beginning, it is very well documented and is not that long. But basically you just drop the file to /usr/local/bin, chmod it to have execute rights and then execute the script. Script reports problems if there are some and the output is pretty self explanatory. Hopefully you don't have to learn the restoration process, but if you do, it is documented in the wiki.

Once my installation is ready, or at least "more complete", I will be writing a script that makes stage4 archive every week or so, and then transfers it to ftp-server. I also am planning on cloning the whole partition with a tool like dd or partimage, latter being a better (and more complicated) solution, because it does not backup the empty space on a partition. Current situation with my mirrored root drive gives some protection against a hardware malfunction, but offers only little against user mistakes.

So for the time being I am making stage4 archives from my root partition as backups and if you are using Gentoo, I advice you to do at least the same.

Installing HTPC software (part 1)

I'll start this one of with a quick and easy way to get samba file sharing working. If there are no interest in having such service, then you can skip over the Samba part. After the Samba installation I will install software that is needed for the HTPC functionality.

But first, here is a make.conf file that I am using. You may want to edit it to better suit your needs. It has basicly USE-flags enabled that "sound" like they might be useful in HTPC installation.

Before emerging samba, there is again a file in need of an extra line. This time easiest way to add it, is by running following command

echo "net-fs/samba acl -cups -doc -kerberos -ldap -oav pam -python -quotas readline -selinux winbind" >> /etc/portage/package.use

This will ensure samba will be emerged for just basic file sharing, with nothing too fancy like cups or ldap. Modify as needed. After the above line is added, just emerge samba. After all that is done, it is time to edit /etc/samba/smb.conf to suit your file sharing needs.

Here is a little example of how my smb.conf looks like

comment = Network Logon Service
path = /var/lib/samba/netlogon
write list = root

add machine script = /usr/sbin/useradd -c Machine -d /var/lib/nobody -s /bin/false %m$
domain logons = Yes
domain master = Yes
local master = Yes
os level = 65
preferred master = Yes
security = user
workgroup = Workgroup Name
map to guest = Bad User
include = /etc/samba/dhcp.conf
logon path = \\%L\profiles\.msprofile
logon home = \\%L\%U\.9xprofile
logon drive = P:
netbios name = Server name
load printers = no
printing = bsd
printcap name = /dev/null
disable spoolss = yes

comment = Network Profiles Service
path = %H
read only = No
store dos attributes = Yes
create mask = 0600
directory mask = 0700

comment =
Yoursharehere is a shared directory
inherit acls = No
path = /
read only = No
browseable = Yes
writable = Yes
force user = yourusername

After the smb.conf is set up correctly, only thing left is to add samba users and their passwords. I use the following command to create first the user, then adding samba password to that user. Note that the username password should be preferable the same ones you use in your clients. That way a windows user can mount the share as a network drive by just using his own username and password. After adding the users, you are ready to start the samba service and add it to some runlevel, so it will start automatically on boot.

yourusername && smbpasswd -a yourusername

Enabling the Gentoo Portage Multimedia Overlay
Multimedia overlay is used to get the latest (and greatest) svn/cvs -versions of the multimedia programs like mplayer, which is used as the default video player in MMS. The reason we need the latest version is that it has multi-thread support enabled. This helps a lot when playing content that is encoded with H.264 with high definition resolutions. Playing 1080p material with h.264 encoding used to be pretty impossible with modest 3ghz dual core like mine. Nowadays with multithreading, it handles it pretty nicely.

This is how the overlay is enabled

mkdir /usr/local/portage
cd /usr/local/portage
rsync -rptvW rsync://
echo "PORTDIR_OVERLAY=\"/usr/local/portage\"" >> /etc/make.conf

HTPC software
Xineliboutput is a plugin to VDR, it is used to output the DVB-material via graphics card, either in X (vdr-sxfe) or in frame buffer (vdr-fbfe). Normal use case with VDR is that user has full feature DVB-tuner which has some kind of TV-out, but with high resolution flat panels this is hardly optimal. Instead we are going to use the DVI output on the graphics card to transfer the picture in HD resolution to TV´s HDMI input. Xineliboutput enables us to do just that. The plugin itself is loaded when VDR starts and the client (vdr-sxfe) is started whenever we select "Watch TV" from MMS main menu. And finally to the point: Xineliboutput requires xine-lib to be installed.

Besides xine library and mplayer we also need some codecs. W32codecs contains Microsofts decoders for codecs used in wmv-container (for example). We also should install x264-svn package. And lastly you can install MMS right here, without any extra steps, IF you are content (and smart) to use the stable version. I however, am going to go the extra mile and try out the new release candidate 1.1.0 version.

All of the above are installed by simply (mmsv2 installs at the time of this writing the stable version of the MMS) emerging the following

emerge xine-lib mplayer win32codecs x264-svn mmsv2

Disclaimer: While the Xineliboutput enables showing the DVB material in high resolution X environment, it does not actually do anything to make the picture better. You are still faced with the limitations of the source material, which is often low resolution and encoded with low bitrate. The upside is though that the DVB viewing with VDR can now be integrated as part of the X (the graphical interface) and more importantly part of the MMS.

tiistai 29. tammikuuta 2008

The Masterplan™

Now that all my hardware seems to be working correctly, it is time to move to installing needed software. But before that I guess I should let you in on my plan for the final HTPC.

I am going to use the My Media System (MMS in short) as a Media Center software. I had the stable version installed on my previous installation. I liked it very much, it seems to be stable, feature rich and simple at the same time. Also the new version 1.1.0, which is currently in release candidate -state, seems to have many nice new features. I think I am at least going to try the new bleeding edge version first and if it is still too unstable, change back to the version.
While MMS takes care of the things like picture viewing, music and video playing and providing nice user interface for these, I am going to use VDR for the DVB side. I've been using VDR to watch DVB-television for some time now (over a year at least) and I am very happy with it.
Other option would have been MythTv which bundles all of this together and provides even more functionality. But MythTv has been more viable on the analog TV side, not so good in DVB. So basically VDR with X frontend does the watching and recording of television and MMS does the rest.

Here is a little demonstration of how both VDR and MMS work together. Keep in mind that the video is old and for example exiting the VDR frontend (the AVP movie) is more seamless nowadays.

Beyond of being "just" a Media Center for my living room, I am also going to utilize it as a file server. My home network includes two workstations and one laptop and because of the WLAN is available, I also have some visitors when friends come over with their WLAN enabled devices, like laptops or mobiles.

I will be using Samba for file sharing between the OpenSuse workstations, laptop and mostly Windows-based visitors. Samba-server is pretty easy to setup and making connections by clients is also very easy. Mirrored hard drives (RAID1) on my HTPC slash file server will take care of the content I don't want to lose due to hard drive crash. I will also probably make a little script that makes backups from HTPC/File server to the net.

OK, so maybe in my next entry I will be actually getting to the software installation phase, which I already promised few entries back.

maanantai 28. tammikuuta 2008

Getting the hardware to work

Fortunately one thing I was able to rescue from earlier, corrupted, installation is the kernel config. So I don't need to spend much time with kernel configuration. I however decided to go bleeding edge with the just released 2.6.24 kernel. Preserving the old configuration is pretty easy, just copy the old .config-file to the new kernel sources (/usr/src/linux) and run "make oldconfig" the command asks user to answer few questions and voilá, kernel configured.

Installing DVB drivers is also pretty easy and there are few different ways to do it. I used to install them just by using emerge, ie. "emerge mercurial && emerge v4l-dvb-hg" but currently there seems to be compilation problem. Because of the problem with emerge I had to install the drivers by hand. Here is a short overview of the process, the guide is for different tuner card than mine, but one can see the outline of the process easily enough. After dropping the firmware file to correct location (/lib/firmware) and rebooting, udev should load the modules for the card automatically. One can verify that the tuner is working by making sure there is device called /dev/dvb/adapter0 .

Lirc installation is also pretty straightforward, although it can also be problematic for the first timers. For emerge to work correctly a line needs to be added to /etc/make.conf, with my Silverstone (iMon) IR-receiver the line looks like this
LIRC_DEVICES="lirc_imon imon_pad2keys imon imon_pad imon_rsc"

After that "emerge lirc" and reboot the /dev/lirc device should be available. With serial port IR-receiver some tweaking with "setserial" command might be required. Correct lircd.conf is of course needed in /etc directory. For most remotes you don't need to look any further than here. I however made my own for the Harmony remote by using "irrecord" command. Testing that lirc is working command "irw" can be run, while running it should detect key presses from the remote.

If you want to use the remote that came with the case (the one with a "mouse pad" on it) you should have look at this page.

Once the lirc is working, emergin lcdprog makes the VFD available for using. Testing that it is working is easy, just "echo whatever > /dev/lcd0".

So what else is there?
  • Proprietary Nvidia graphics drivers can be installed by issuing "emerge x11-drivers/nvidia-drivers" command and then using "modprobe nvidia" to load the module, although I think udev also loads automatically after reboot. Remember to include the nvidia as a driver to your /etc/X11/xorg.conf if you are using X.
  • My integrated sound card is recognized automatically and my sound is working after "emerge alsa-utils" and setting the volume with "alsamixer", using "alsactl" one can store the volume settings as defaults.
  • Integrated network was correctly detected during install and if it is not and you can not get it to work by hand, installing Gentoo becomes pretty hard. Luckily ethernet works correctly at full gigabit speed.
  • Flat panel TV can sometimes be a real pain to get working correctly due to the TV itself giving wrong information about its capabilities. Example xorg.conf file for Mirai DTL-642E500 can be found here. I personally had some problems with finding correct settings and hopefully the linked file is useful to others.

Disclaimer: To get the devices to work, the kernel needs to be configured correctly. But that information is (mainly) available at Gentoo wiki, so there is no need for me to rewrite it all here. Check the Howto Index, Tips & Tricks and Hardware part of the wiki.

Basic Gentoo Installation

As I mentioned before, even the basic Gentoo installation can be a chore. But after installing Gentoo several times, I am starting to see the beauty behind it. Everything is done on command line but in a sense, I have full control of how my system is going to be. Nothing unnecessary gets installed or setup, which is great help when you´re trying to minimize the amount of software.
For example boot process slows considerably by adding more services,
so one should be aware what is actually needed and what can be left out. Also less software means less disk usage, less security issues and most importantly more performance.

Installation process is pretty easy if one follows the Gentoo Handbook and does not deviate much. I decided install to RAID1 array right away to steer clear of the pitfalls of doing it later.
Installation itself was pretty uneventful, but I would not recommend it to any one without proper Linux experience.

There are easier distros to install, or rather, almost all other distros are easier to install. One could go with Ubuntus minimal server installation and make a pretty decent HTPC. Not many however offer you so much control over your OS as Gentoo.

I decided to keep the partiotioning of the disks as simple as possible.
  • /dev/md0 10GB for / (root) partition
  • /dev/md1 290GB for /safe partition, this is used to store important data
  • /dev/md2 4GB for swap partition, yes I know that is pretty much, but I want to be able to Suspend my RAM to disk if need arises.
So far I've emerged (installed) the following additional software.
  • syslog-ng and logrotate
  • vixie-cron
  • grub
  • mdadm
  • xfsprogs (this is needed for my 500GB DVB Recording XFS partition)
  • alsautils

And I have enabled following additional services.
  • sshd
  • syslog
  • eth0
  • mdadm
  • syslog-ng
  • vixie-cron
  • alsasound

I am planning to start the not-critical services in their own runlevel or at least after the HTPC services that are needed to make the Media Center start as fast as possible. Currently the mentioned services still reside on default-runlevel.

Next time, installing Lirc remote control software, Mplayer video player, X the graphical server and Samba for network file sharing and maybe few others.

sunnuntai 27. tammikuuta 2008

Hardware Specifications

Let´s start this one of with hardware specifications (everyone loves those, right?) of the HTPC. This should give some idea of what I am trying to accomplish and maybe some pointers of what I have considered to be good hardware for such project. Let´s face it, it is also the easiest place for me to start.

Hardware specifications:

  • Processor: 2.0ghz Intel Pentium Dual-Core E2180
  • Motherboard: Gigabyte GA-P35-DS3R (rev. 1.o)
  • Memory: 2x 1GB Transcend 800mhz aXeRam
  • Hard disks: 2x 320GB and 500GB Seagate Barracuda SATA drives
  • Graphics: Nvidia Geforce 6800 GS
  • DVB tuners: 2x Technotrend Premium C-2300 Hybrid (aka Hauppauge Nexus-CA ?)
  • PSU: Seasonic S12II-430W
  • Enclosure: Silverstone LC20M with IR and VFD display
  • Cooling: Scythe Mini Ninja CPU cooler, 2x 92mm and 2x80mm silent fans
  • Accessories: Logitech Harmony 555 remote and Ione Scorpius P20 Media Center Keyboard

Here is a little rationale about why I have chosen the hardware above.

First of all I decided to build my HTPC setup around Intel E2180 processor, not just because it is dirt cheap (72€ here) but also because every E21x0 processors overclocks like nothing else! I am talking 100% overclock with stock cooler and with a little bump to core voltage. I am currently running the 2.0ghz version at 3.0 ghz and it has been rock solid for few months now. It also handles H.264 encoded FullHD video easily (albeit the software, mainly mplayer, needs to be CVS version that includes multithreading support).

The Gigabyte motherboard seems to be good choice, it is very stable even with overclocked system like mine. It also has 3 older PCI slots which are useful because I have 2 PCI slot DVB tuners and I might consider adding third one. The 1.0 revision of the board also has 4 additional USB headers which are very useful because the enclosure alone needs one for the VFD and one for the USB/Audio front panel, I have also thought of adding memory card reader in the front panel, which would require one more USB header. Being Gigabyte the motherboard also features their "Ultra Durable 2" design, which seems kinda cool.

Transcend memory was chosen because of it's overclocking potential and also because it was quite cheap at the time. I managed to get hold of a batch of memory that still included the Micron memory chips which are know for their uncanny overclocking potential. Although I really do not have so much use for the "potential" since I am running the memory near the stock settings. Overclocking the CPU was done by increasing the FSB and at the same time lowering the memory multiplier.

With three hard drives and three cards in slots the case is getting a bit crowded, but I thing I will manage to add one more drive. The two 320GB drives are going to be used in RAID1 (mirroring) setup and will store the Gentoo system (root and swap) partitions and also serve as "safe" place to stores data I don't want to lose, like my pictures and music. The 500GB drive currently houses DVB recordings and will be fully dedicated for this purpose. The fourth drive that I am going to add at some point is going to be dedicated to house all
the multimedia content, mainly high definition video.

Nvidia Geforce 6800GS is likely a bit overkill for the use in HTPC, but that is what I had available. Nvidia does not provide much of support for hardware based video decoding in Linux, which causes the need for such computing power as E2180@3ghz. For example Nvidia 8400GS would be ideal for HTPC because it supports hardware decoding of H.264 video and also has HDMI output.
Unfortunately Nvidia has decided to leave Linux users hanging.

Technotrend DVB tuners are so called full feature cards, which are leftovers from my original VDR-box (Video Disk Recorder). Each card can display and record one full DVB-mux at time, so currently I am able to view and record from two different program muxes at the same time. There are some times that I would like to have capability to record from two different muxes and at the same time watch third. Fortunately there is still room for expansion.

Seasonic PSU was chosen because of it's very good efficiency, low noise and good quality. First I was going to buy the 380 wattage version, but availability was a problem, so I went with the bigger one.

Tastes differ, but the looks is always a big priority when choosing casing for a HTPC. I've always liked the looks of the Silverstone cases, in particular I liked the LC20M which hides optical drives and front IO ports behind doors. The case does not stand out at all amongst other entertainment electronics I have under the TV-set. Also I liked that the case comes with a built in IR-receiver and VFD.

Cooling can be a problem in HTPC cases, which are built for looks and compactness, not for optimal cooling results. LC20M has mounts for 2 92mm fans in front of the HD-cage and for 3 80mm fans near the CPU cooler. Adequate cooling can be provided by using slow turning fans making minimal noise. Currently I still have the stock Intel cooler but I am going to replace it within days with a Scythe Mini Ninja cooler. Cooling fans are currently Nexus made, but once I get rid of the stock sink I'll have to review if they are silent enough.

I'll get back onto Logitech Remote and Iolo keyboard later.

Starting a new blog

Few nights ago I managed to corrupt my root-partition on my Linux-based HTPC machine. I was a little tired when migrating the system to RAID1 configuration, didn't make complete backups, and of course managed to hose things pretty badly. Ironically my objective was to make my system more durable by mirroring the system disk to second hard drive. Long story short, reiser filesystem in my / (root) partition is corrupted and no amount of reiserfsck-magic can make it whole again. So now I need to re-install the whole Gentoo based operating system.

At least that serves as a good learning experience, I am going to be more diligent about making backups from now on. This blog serves as a method to "back up" information about my installation process, so I have someplace to refer to when I am installing new HTPC system and can not exactly remember what needs to be done. Gentoo installation itself can be quite complicated process (at least when compared to easy-to-use modern distros like OpenSuse and Ubuntu) and making it fully HTPC cabable is not easy either.

And who knows, maybe this blog can help someone facing same problems.