Debian Galleon Media Server

Background
Galleon is a free open source server that can serve your media collection to your TV using a TiVo® DVR and a Kurobox on a home network. This article describes how to install the server and the required packages on a Kurobox HG.

Features include:

GoBack/ToGo - transfers video files between a TiVo® and the server for later viewing on the DVR or computer.

Music - plays and organizes mp3 music collections using the DVR.

Photos - allows viewing of photo collections.

For a complete description of Galleon’s capabilities, refer to http://www.galleon.tv.

Performance
The following instructions have been tested on a Kurobox HG with the Debian, Java, and Galleon versions listed below. When using a wired Ethernet connection to a Series 2 TiVo®, near real-time .tivo file transfers are possible on the “high” quality setting of the DVR. Lower quality video transfers, the MP3 features, and other Galleon applications not requiring high data bandwidth run well on the Kurobox HG.

Setting Up
These instructions assume a fresh Debian installation on a newly installed hard drive. Skip to Step 2 – Load Packages if Debian is currently loaded on your Kurobox. Previous distributions of Debian or other distributions have not been tested. Proceed at your own risk.

Get copies of the following files before you start. You will need to FTP these files to the Kurobox from another host during the installation process.

For the Kurobox HG: Debian/Linux Distro

debian-sarge-2.6.16.9-KUROHG-20060422.tgz from http://www.genbako.com/debian-2.6.16.9/

OR

For the Kurobox: Debian/Linux Distro

debian-sarge-2.6.16.9-KUROBOX-20060422.tgz from http://www.genbako.com/debian-2.6.16.9/

Java JRE for the 32 bit pSeries/J2SE 5.0

Registration with the IBM developers site is required before downloading

ibm-java2-jre-5.0-5.1-linux-ppc.tgz from http://www-128.ibm.com/developerworks/java/jdk/linux/download.html

Galleon – TiVo Media Server

galleon-2.4.1-linux.zip from http://sourceforge.net/projects/galleon

(Development has re-started on a limited basis. Versions 2.3 and higher have been used successfully. Versions 2.5 and above use a modified ./run.sh script only suitable for x86-based architectures. Use a ./run.sh script from previous versions when running 2.5 and above).

Step 1 – Build Debian on the Kurobox
Debian install is an excellent article for installing Debian on the Kurobox. The article is accurate but some common pitfalls to avoid are:


 * 1) If the newly installed hard drive ever had a Linux or Windows partition, it confuses the Kurobox and it attempts to boot from it. The partitions need to be wiped out. One option is to install the hard drive in a PC and boot from a floppy. Run fdisk.exe and list the partitions. Delete any and all partitions found. Otherwise, wipe the partitions from another Linux box. Also, even though the partitions are wiped from another box, run the mfdisk –e /dev/hda step in the article listed above anyway.
 * 2) Replace the debian_2004_12_26_dist.tgz file with the appropriate Debian/Linux distribution listed above.
 * 3) Static IP addresses are preferred. Use ipconfig on a Windows box to get your gateway IP.
 * 4) For etc/resolve.conf, log into your router’s web interface to get your ISP’s DNS IP address.
 * 5) For etc/hosts.deny, comment out the ALL:ALL line (i.e. #ALL:ALL) otherwise you will be locked out.
 * 6) Don’t forget to create a regular user (adduser). It will be used for running VNC and Galleon.

Follow all steps in the article including the first boot. If you can successfully get through the first boot, go to the next step.

Step 2 – Load packages
The following packages should be loaded in the order described below. Samba and Webmin are optional but can be useful if access to media files on the Kurobox is needed from a Windows-based host.

KeyPackages
Install key packages. 1. Login (telnet) into the Kurbox and su to root

2. Install webget, GNU C compiler, bzip, deborphan, localepurge, logrotate, automatic script builder, unzip, zip, automatic makefile, autotools, GNU C library, libtools, and debfoster.

apt-get install wget gcc bzip2 deborphan localepurge logrotate autoconf unzip zip automake autotools-dev libc6-dev libtool debfoster

Samba
Set up a Windows-readable file share using Samba.'''

1. Install the Samba server.

apt-get install samba smbfs

2. Enter your domain/workgroup when prompted. The Windows XP default workgroup is MSHOME.

3. If prompted, select yes to creating a password database.

Webmin
Install and use Webmin to remotely administer your Kurobox.''' 1. Install Webmin and its related packages. This will install the core features, the CPAN interface (for installing Perl modules), a java-based file manager, and firewall (iptables) manager.

apt-get install webmin webmin-core webmin-cpan webmin-filemanager webmin-inetd webmin-logrotate webmin-firewall

2. For the Samba installation:

apt-get install webmin-samba

3. Edit /etc/webmin/miniserv.conf to allow your IP address (under the “allow” line). Note that this is the host that will communicate with the Kurobox, not the Kurobox’s IP address.

4. Stop and restart Webmin with the commands:

/etc/webmin/stop /etc/webmin/start

5. Create share directories as root on /mnt with:

mkdir /mnt/share mkdir /mnt/share/Recordings

6. Open the directories up with the following commands. It does make the directory wide open but leave it that way for now. It will make setup easier. Tighten up permission later if you would like.

chmod 777 /mnt/share chmod 777 /mnt/share/Recordings

7. Use a browser from another host and point to https://:10000. Login as root.

The Webmin interface is really straightforward. Select the "Servers" tab followed by the "Samba Windows File Sharing" icon and share the /mnt/share directory listed above. Use a PC to see if the share is visible from another host.

VNC
Set up a Virtual Network Computing (VNC) Server''' 1. Download and install the free Real VNC viewer from http://www.realvnc.com if you currently don’t have a copy of it. This viewer runs on a remote desktop (i.e. a Linux or Windows host) and allows access to the Kurobox iceWM window manger. Download the correct binary for your remote host type.

2. If not currently logged in as root to the KuroBox, telnet and su to root.

3. Install the VNC server and related packages on the KuroBox. Use the command:

apt-get install vnc4server xfonts-base icewm menu grun iceme icewm-themes iceconf icemc icepref xfe

4. Although not required, grab a copy of Firefox. It will be used later to check out the VNC server.

apt-get install mozilla-firefox

5. Log out of the telnet session and log back in as a regular user. 6. Configure a VNC password. This setting is unique for each user account on the Kurobox. Do this step as a regular user (the one that will run Galleon). Although not required, consider using your regular user password for the VNC password. Configure the VNC password with the command and respond to the prompts:

vncpasswd

7. Start the VNC server as a regular user with this command. Note that the command will come back with your host name followed by colon and a number. This will likely be a :1. (Remember this screen number).

vncserver

8. Start the VNC viewer installed on a another host and specify the IP address of the Kurobox followed by :1. For example:

192.168.0.15:1

9. What starts up is a virtual iceWM window manger desktop running on the Kurobox. This same desktop is used for Galleon’s GUI later. Just for fun, start up Firefox with the Mozilla Firefox browser button in the window manager.

10. Exit out of the window manager from the remote host and kill the vncserver with the following command on the Kurobox:

vncserver –kill :1

Step 3 – Load Java
Java

1. A manual installation of the Java JRE is needed. Telnet into the Kurobox and su to root.

cd / mkdir opt chmod 777 opt cd /opt

2. Move the ibm-java2-jre-5.0-4.0-linux-ppc.tgz file to the Kurobox from a remote host by either using FTP or the Samba share if installed. Then move the file into the /opt directory and type the following command:

tar xvfz ibm-java2-jre-5.0-4.0-linux-ppc.tgz

The installation will be tested later when environment variables are set up.

3. Disable IPv6. This is a requirement for running the Galleon server. As root, edit /etc/modprobe.d/aliases and change

alias net-pf-10 ipv6

to

alias net-pf-10 off #alias net-pf-10 ipv6

4. Reboot the Kurobox with the command:

shutdown –r now

5. Power-up the Kurobox with the front panel button if required.

Step 4 – Load Galleon
1. If a Galleon server is currently running on another host on your network (i.e. another Linux box or PC), stop the server on the other host. Attempting to run two Galleon servers on the network appeared to cause setup problems for the Kurobox.

2. Copy the galleon-unix-2.3.0.zip file to the Kurobox from a remote host using FTP or Samba if installed.

3. Log out and log back in as a regular user. Don’t install Galleon as root.

4. From the regular users’s home directory, type the following command:

mkdir galleon cd galleon

4. Copy the galleon-unix-2.3.0.zip file to the newly created galleon directory and type:

unzip galleon-unix-2.3.0.zip

In the galleon directory you should see the apps, bin, conf, data, hme, lib, and so forth directories from the zip extraction.

5. Move into the galleon/bin directory:

cd ~/galleon/bin

6. Create a file called galleon_startup containing the following lines. Substitute the DISPLAY environment variable with your Kurobox IP:screen number. Use the screen number provided by the VNC server startup (usually :1). The PATH and JAVA_HOME variables are set where Java is installed.

PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/opt/ibm-java2-ppc-50/jre/bin export PATH JAVA_HOME=/opt/ibm-java2-ppc-50/jre export JAVA_HOME DISPLAY=192.168.0.15:1 export DISPLAY

7. Make the files executable:

chmod +x galleon_startup run.sh gui.sh

Step 5 – First-Time Start of Galleon
1. If the VNC server isn’t running, start it by the command below. Look for the :# (typically :1) display number after invoking the command. If the number is different, adjust the DISPLAY environment variable in galleon/bin/galleon_startup accordingly. Starting the VNC server is a requirement for configuring and running the Galleon server and GUI.

vncserver

2. In the galleon/bin directory, type the command to set the environment variables:

source ./galleon_startup

3. Next start the server with the following command. Note that the initial server startup takes about 3-4 minutes as databases are initialized.

./run.sh

4. Once the message saying “Galleon is ready.” is displayed, set the process in the background by:

-Z bg

5. Next fire up the Galleon GUI from the bin directory with:

./gui.sh

6. Invoke a vncviewer from another host to view your iceWM scrren. This takes a while but the Galleon logo and configuration windows should show up within a minute or two on your vncviewer program window.

7. Complete the configuration process using the GUI. Refer to the “Configure” instructions located in http://www.galleon.tv for additional details.

The /mnt/share/Recordings directory (created and opened up to 777 earlier in this article) should be a good location for Galleon’s ToGo Recordings directory.

As a minimum, File ... Properties ... Media Access Key and Recordings Path must be filled in as described on the Galleon site. The TEST button in the Properties dialog box will check if the server can find your DVR. Finally, add at least one application (ToGo for example) to the server. Click the APPLY button as needed and exit the GUI.

The server is not fully set up and will not function correctly until the steps below are followed.

8. Bring ./run.sh to the foreground with

fg

9. Control-C to stop the server. The server must be stopped and restarted before the TiVo© will see the Galleon server on the Kurobox.

-C ./run.sh

10. When the “Galleon is ready.” message is displayed, the server should be accessible by the DVR.

11. In general, prior to invoking the Galleon server or GUI, source the galleon_startup file as described above and start the VNC server if it isn't already running. Even though the primary display is the TiVo itself, X11 resources are needed on the server that are provided by VNC.

Step 6 – Subsequent Startups of Galleon
1. The Galleon server will continue to run until the telnet or ssh window used to invoke ./run.sh is closed. When the window is closed, a hangup signal is sent to Galleon and the server is stopped.

2. A slight modification to the ./run.sh command above can be used to avoid this:

nohup ./run.sh &

The nohup and ampersand allows the telnet or ssh window to close without killing the Galleon server. When using nohup, stdout messages go to a log file called nohup.out.

Notes & Tips
1. The VNC server will continue to run until the system is shut down. If the Kurobox is restarted, re-start Galleon as described in step 6. above.

2. Once initially configured and running on your Kurobox, Galleon can be accessed by invoking the GUI plus IP address of the Kurobox server on another host such as a PC or Linux host. This headless GUI access is much faster than using the vncviewer and running the GUI app on the Kurobox itself.

3. An even faster way to re-configure Galleon to open a telnet or ssh session into the Kurobox and directly edit the configure.xml file to add or remove rules for downloading shows. The format of this .xml file is easily readable by a text editor. After writing updates to this file, kill any of the java process threads to stop the server. Re-start using step 6. Galleon will re-read the updated configure.xml file at startup. Note that the first-time setup does require the VNC server and GUI as described above. Subesquent startups do not and performance will be much better when the VNC server is not running.

4. Galleon at startup builds databases and appears to index files for it's use. Doing a "top" shortly after starting the server will show 100% CPU utilization for 5-10 minutes. After this period, CPU utilization is bursty and infrequent. Server performance improves once indexing completes.

Article ToDo: auto-start on boot instructions