Alchemy LE Ubuntu Netboot

From MythTV Official Wiki
Revision as of 03:30, 26 July 2007 by Receptiveit (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

Alchemy LE
The Alchemy LE is a media center system built by Pcalchemy. It comes complete with Windows Media Center Edition installed. But it makes a great MythTV frontend, although it is quite expensive.

I configured the system at the most basic level (which is not very basic): lowest clocked CPU, 1GB RAM, no TV tuners (wanted frontend only), 320GB Disk (wish they had no disk option). One exception: got the Nvidia 7600GT because it has an HDMI port and advertises HDCP support; that would be perfect for my flat-screen TV.

Hardware

The system is based on a very nice case from OrigenAE: The X10 HTPC case. This case includes a VFD display with integrated IR receiver from IRTrans. The VFD/IR Rx has great support for Linux (a pleasant surprise). There is a front panel with USB, firewire, and card readers on it. The case looks very nice and blends in with my home theatre equipment.

Inside the case is an Intel motherboard (I believe it is the DG965WHMKR) that has a G965 Express Chipset. It has all kinds of goodies including optical audio out, many USB ports, and no chipset fan. Pcalchemy installed a Zalman heatsink/fan (something similar to the CNPS7700-AlCu LED) on the core2 duo CPU. The Nvidia 7600GT also got a Zalman heatsink fan installed on it. They are very quiet. The power supply is also very quiet. I am a little worried about the DVDROM drive; it sounds like it might not be as quiet as I like, but I have not yet had a chance to try it out because of problems with linux support for the PATA channel (see below).

On the whole, the system is more than enough for a MythTV frontend. It is quiet, beautiful, and full featured. It is probably a little overpowered for most uses. It is pretty big, as big as my Yamaha receiver so you need to have space.

One note: before turning on a system you got in the mail, always open it up. Turns out a stick of RAM had fallen out and was loose inside. I was lucky it did not jam in one of the fans. I stuck it back in and everything was fine.

The system came with a wireless Window MCE remote control and a wireless keyboard. I did not try to use the remote as I have a universal remote I wish to use. I did use the keyboard. It has a USB dongle that you plugin. Unfortunately for me the range is very poor. It is supposed to be 30ft, but I am lucky if I get 8 feet.

Software

I am a big believer in diskless frontends. I have a big (read noisy) server in the basement with 1.5TB of RAID5 disk and that is what I want to use for my front ends. So I want to netboot from the server so no hard disk needed in the frontends. I recently upgraded by server to Ubuntu Edgy Eft and discovered it has great support for net booting so that is what I wanted to use on my frontends. (I keep saying frontends; that is because I want to have two identical systems eventually, both booting from the same network filesystem.)

Netboot Install

Installing was tricky until I figured out how to do it. I tried installing to the hard disk, planning to copy the result to the server and then netboot it. This is when I discovered that the Linux 2.6.17 kernel does not support the newfangled PATA hardware in the 965 chipset. Why does Intel have to go an mess with something that has been working fine for years now and probably will be obsolete in a couple of years? So I booted the Ubuntu server install CDROM and it brought up the installer with no problems until it went to mount the CDROM (that it had just booted from) and said there was no CDROM--ARGHH! I then tried booting the CDROM, but then mounting a USB drive as the CDROM , but that did not work either, not sure why. Finally I tried what I should have tried in the beginning, a total net install with no CDROM. Following these instructions PXE Install should work. Note that this installs to the hard disk, so you need to have one in for now; I removed it later. I installed the minimal system. After I installed, I checked that it rebooted and worked. Then I mounted the NFS directory from my server that was to be the NFS root directory for the frontends and copied all the files to the NFS server. I followed these instructions to do this. Then pull the hard disk and re-enable pxe booting in the BIOS and hopefully it boots from your server.

Note: Word on the street is that Intel initially designed the 965 chipset with no PATA interface at all. It wasn't until the product was about to go to market that Intel realised that there wasn't alot of SATA optical drives on the market. It was at that point that they implemented a quick hack by dropping two of the SATA channels and wiring them through a SATA to PATA converter to give us our Master/Slave parallel port. Unfortunately, this was not supported by the Linux kernel at the time. Current versions of the kernel support this interface using the marvell_pata module written by Alan Cox.

The most elegant solution is to ditch the PATA optical drive altogether and use a SATA DVD burner. After all, Intel did a spectacular job with the AHCI SATA-2 interface, and the Linux support is fantastic.

MythTV Install

At this point it is time to install everything you need for a MythTV frontend. I first installed openssh-server so I could ssh into the frontend from another computer. I did all my install work using ssh. This page should help you with installing MythTV on Ubuntu. I thought getting my optical out for audio working would be a real pain. Turns out it just worked. Pretty amazing. I hooked up my flat panel via HDMI at this point and grabbed a modeline for 720P and bingo, beautiful TV out.

MythTV Frontend/Backend Configuration

One thing that gave me lots of problems was getting my frontends to talk to my backend server; specifically mysql gave me fits. I could not get mysql to accept connections from the frontend. I found lots of different web pages about this, but none completely solved the problem. I finally did get it working...

  • Add a password to the root login to mysql
 % mysqladmin -u root password apple
  • Edit /etc/mysql/my.cnf to make mysql accept remote connections
 bind-address = 192.168.1.1
  • Assign a password to the mythtv mysql remote login; mtvpasswd is the password given by the DBPasswd key in /etc/mythtv/mysql.txt.
 % mysql -u root -p mythconverg
 mysql> grant all on mythconverg.* to mythtv@"192.168.1.%" identified by "mythtv";
 mysql> flush privileges;
 mysql> SET PASSWORD FOR 'mythtv'@'192.168.1.%'=PASSWORD('mtvpasswd');
 mysql> quit;
  • On the frontend try to connect to the backend mysql server to see if it works. If it gives you permission denied errors it is not working. If it gives you the mysql prompt you are probably good to go.
 % mysql -u mythtv -h backendserverhostname -p mythconverg
 Enter password: mtvpasswd
 mysql> show tables;
 ...
 mysql> quit;

Mplayer configuration

I want to use the system for viewing DVD .iso images. For that I needed to configure mplayer. I editted /etc/mplayer/mplayer.conf. I wanted to use xv for video output:

 # Specify default video driver (see -vo help for a list).
 # would like to use xvmc (motion compen) but many say not a good idea on nvidia
 vo=xv

I watched a 2.35:1 aspecxt ratio movie, and boy did the letterboxing look excessive. I needed to tell mplayer I had a 16:9 screen:

 # Use this for a widescreen monitor, non-square pixels.
 monitoraspect=16:9

And then tell it to use optical out with pass-through:

 # Use optical out with digital pass-through
 ac = hwac3

I had to run alsamixer and enable (unmute with the M key) the optical out channel. I tested the optical out using mpg123-alsa like this:

 % mpg123-alsa -a spdif /music/le_nozze_di_figaro/overture.mp3

Finally, I noticed on the veggietales movie Jonah tons of interlacing artifact; needed to turn on the de-interlacing:

 # deinterlacing method
 vf = pp=lb

There are lots of other de-interlacers, but pp=lb seems to give good results.

IR Receiver and VFD

The system has an integrated VFD with IR receiver. You need to grab the software from the IRTrans website. Note there is also a PDF manual there IRTrans Users Manual. I downloaded the IRTrans Server LINUX, IRTrans ASCII Client, and IRTrans lcdproc driver. Turns out I think I only needed the IRTrans Server LINUX. I downloaded the source for IRTrans Server LINUX and compiled it:

 % make irserver irclient

It had no install target. I had to figure out that it should go here:

 % mkdir /usr/share/irtrans
 % mkdir /usr/share/irtrans/bin
 % cp irserver /usr/share/irtrans/bin
 % cp irclient /usr/share/irtrans/bin

What they didn't tell you was you need the "remotes" directory. The only place I could find that was from the windows install package Setup.exe here. I installed it on a windows PC and copied the remotes directory from there to my frontend. The remotes directory must go into "/usr/share/irtrans/remotes". It contains the mapping of IR codes to symbolic actions.

I tested it all out using this command:

 % irserver -debug_code -loglevel 4 /dev/ttyUSB0

Then pointed a random remote at the system and looked for output. Sure enough prints out lots of numbers when I press a key. You then need to train it to understand your remote. They have a few remotes pre-configured. Look in the remotes directory. To train you have to use the irclient program that was installed above. I then setup a ~mythtv/.lircrc file and made a sym link to ~mythtv/.mythtv/lircrc. I tried it out and it worked well. Also when you start the irserver it displays the date and time automatically on the VFD.

Sharing the NFS Root

I wanted to be able to use the same root directory on my server for my two frontends. Almost all of the files can be shared among multiple clients. But some have to be unique to the client. The /etc/hostname file for instance. Also some of the /var directories. I decided to do this by creating a "prv" directory for each client. This directory would hold the client specific files. I then created sym links in the master root directory to the prv directory for unique files or directories. So on my server, the master root directory is /clients/myth. Then each client has a prv directory; /clients/prv/clientone and /clients/prv/clienttwo for instance. When the client boots I want /clients/myth to be the root for the client. And I want the client specific directory to be mounted to /prv on the client.

To pull all this off, I had to do a number of things. First I created the prv directories for each client and put the client specific files there. At this point I have these files/directories:

  /clients/prv/clientone/:
  etc/  README-black.txt  var/

  /clients/prv/clientone/etc:
  hostname  ssh/  X11/

  /clients/prv/clientone/etc/ssh:
  ssh_host_dsa_key  ssh_host_dsa_key.pub  ssh_host_rsa_key  ssh_host_rsa_key.pub

  /clients/prv/clientone/etc/X11:
  xorg.conf

  /clients/prv/clientone/var:
  local/  log/

I created them by moving the existing files from there location into the prv directory. You need to create symlinks from the normal locations for all these files to the /prv directory. So on the client you do this:

 % ln -s /prv/etc/hostname /etc/hostname
 % ln -s /prv/var/log /var/log
 % ln -s /prv/etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key
 etc

Next I had to get the /prv directories mounted at boot time. To do this I used the initramfs-tools capability included with Ubuntu. This is highly customizable. You can create a shell script that gets run before control is passed to init. I created a file in /etc/initramfs-tools/scripts/nfs-bottom called mountprv; make sure you make it executable and do not use hyphens in the filename. This is the contents of that file:


# initramfs nfs-bottom script to mount client "private" directory

. /scripts/functions

if [ "x${prvmount}" != "x" ]; then
  log_begin_msg "Mount /prv dir $prvmount"
  mount -o nolock -o retrans=10 -o timeo=20 $prvmount ${rootmnt}/prv
  log_end_msg "Mount /prv done"
else
  log_warning_msg "No prvmount env variable found"
fi

if [ "x${bootmount}" != "x" ]; then
  log_begin_msg "Mount /boot dir $bootmount"
  mount -o nolock -o retrans=10 -o timeo=20 $bootmount ${rootmnt}/boot
  log_end_msg "Mount /boot done"
else
  log_warning_msg "No bootmount env variable found"
fi

This also mounts the /boot from the area in /tftpboot that it comes from during pxe booting. I then updated the initramfs:

 % update-initramfs -u

Then copy the updated initrd.img file to the server where pxe booting gets it from. You need to edit the pxe config for each client to pass in the names of the mount points used by the script. For my client named "black" it looks like this now:

 DEFAULT linux
 TIMEOUT 10
 PROMPT 1
 LABEL linux
       KERNEL /black/boot/vmlinuz-2.6.17-10-generic
       APPEND root=/dev/nfs initrd=/black/boot/initrd.img-2.6.17-10-generic nfsroot=172.16.1.1:/clients/myth ip=dhcp rw prvmount=172.16.1.1:/clients/prv/black bootmount=172.16.1.1:/tftpboot/black/boot

Now try it out and hopefully your prv files all show up and everything works as before. If not, check you made the sym links correctly for all the files.

Conclusion

At this point I moved the system down to my where my new Panasonic 1080P display lives. I grabbed a 1080P modeline and was happy to see that it works flawlessly. While playing a DVD ISO image I pulled 4% CPU. Plenty of horsepower.

I want to customize my MythTV menus so I can remove the things I do not use (like Watch TV, that is what my Tivo S3 is for) and simplify it for the non-techy members of the family. I want to have my front screen be something like two buttons "Watch Movie" and "Listen to Music". It looks like this should not be too hard to do after finding Menu_theme_development_guide.

And of course the DVDROM drive does not work. I think I will wait for the 2.6.18 kernel; it is rumored to fix the issue with the Intel chipset.