NSLU2-Linux
view · edit · print · history

This article pertains to:


Twonkymedia server 5.0.65 for SlugOS/BE 4.8

Searching for a uPNP media server that is compatible with a wide variety of clients (e.g. Microsoft WMP11? & WMP12?, Philips NP1100?) soon leads to Twonkymedia Server. Although Twonkymedia stopped supporting DIY installations of Twonkymedia Server on NAS devices like NSLU2, they still provide the necessary binary to install and run it. This page will provide for a step-by step installation manual to run Twonkymedia Server in SlugOS/BE 4.8

At the end of the page a section with problems encountered when trying to install Twonkymedia Server on SlugOS/BE 5.3. A workaround to run Twonkymedia server on this version of SlugOS-BE is still needed.

Prerequisites

If not done already, create a user group in SlugOS that has read access to the directory tree containing the media files you would like to serve through Twonkymedia Server (the group name is called 'media' in this example)

addgroup media
adduser -G media twonky

Check whether glibc-dbg is installed, and install it if not present

ipkg list_installed | grep -i glibc-dbg
ipkg install glibc-dbg

Download the preferred version of Twonkymedia Server from http://www.twonkyforum.com(approve sites) in the 'Beta/Unsupported Builds' forum (In this example it's Twonkymedia server v5.0.65). Make sure you download the binary for the "Linux ARM big endian glibc" architecture.

su - twonky
wget http://www.twonkyforum.com/unsupported/5.0.65/twonkymedia-armeb-glibc-2.2.5-5.0.65.zip
mkdir twonkymediaserver-5.0.65
cd twonkymediaserver
unzip ../twonkymedia-armeb-glibc-2.2.5-5.0.65.zip

Set the executable bit on some files in the Twonkymedia server directory

chmod +x twonkymediaserver
chmod +x twonkymedia.sh
chmod +x twonkymedia
chmod +x cgi-bin
chmod +x plugins
chmod +x resources

Modify twonkymedia.sh script

Edit the twonkymedia.sh file to make some necessary adaptations including for BusyBox? commands in SlugOS 4.8

change the following variables at the start of the script

WORKDIR1="/home/twonky/twonkymediaserver-5.0.65"
PIDFILE="/home/twonky/twonkymediaserver-5.0.65/mediaserver.pid"

add the following lines in the start section directly after the "$TWONKYSRV" -D line

running="`ps ax --no-heading | grep -e twonkymedia | grep -v grep | grep -v twonkymedia.sh | grep -v twonkymediaserver | cut -d ' ' -f 2`"
echo $running > $PIDFILE

replace all occurrences of the -s TERM and -s HUP signal parameters for kill and killall with -SIGTERM and -SIGHUP respectively. e.g.

killall -SIGTERM twonkymedia

replace the line starting with 'running' in the status section with

running="`ps ax --no-heading | grep -e twonkymedia | grep -v grep | grep -v twonkymedia.sh | grep -v twonkymediaserver | cut -d ' ' -f 2`"

and finally, in the same section replace the echo "TwonkyMedia? server IS running." with

echo "TwonkyMedia server is running with PID $PID."

Test the installation

Start TwonkyMedia? Server

/home/twonky/twonkymediaserver-5.0.65/twonkymedia.sh start

Check whether TwonkyMedia? Server is running properly (the ps command should produce a list which includes 'twonkymedia -D' and 'twonkymediaserver -D', the netstat command should show a line showing the Slug's IP address:9000 and LISTEN)

ps -fu twonky
netstat -an | grep 9000

Configure TwonkyMedia? Server by opening a browser on the same subnet as your Slug and to the address: http://IP_of_slug:9000/config(approve sites)

Now that twonkymedia server is properly configured, it's time to add an init.d script to automatically start/stop/restart the Twonkymedia server daemon

First, the 'sudo' package is needed to run twonkymedia server as user twonky. Root access is now needed again

su - root
ipkg install sudo sudo-doc

Create a file called twonkymediaserver in /etc/init.d containing

#!/bin/sh
case "$1" in
'start')
sudo -u twonky /home/twonky/twonkymedia-5.0.65/twonkymedia.sh start
;;
'stop')
sudo -u twonky /home/twonky/twonkymedia-5.0.65/twonkymedia.sh stop
;;
'restart')
sudo -u twonky /home/twonky/twonkymedia-5.0.65/twonkymedia.sh restart
;;
'status')
sudo -u twonky /home/twonky/twonkymedia-5.0.65/twonkymedia.sh status
;;
esac

Set the executable bits on this init.d file

chmod +x /etc/init.d/twonkymediaserver

Test the script's functioning by issueing the following command which should provide the server's PID (check with 'ps' !)

/etc/init.d/twonkymediaserver status

If all is working properly (if not, edit twonkymedia.sh and modify the running= parameters to properly obtain Twonky's PID), add the init.d script to automatic startup/shutdown

update-rc.d twonkymediaserver defaults 44 46

TwonkyMedia? Server on SlugOS/BE 5.3 issues

TwonkyMedia? Server will at the time of writing not run on SlugOS/BE 5.3. This is because SlugOS/BE 5.3 comes with EABI compiled libraries, while TwonkyMedia? Server is compiled for OABI.

Similar issues exist with a program called CCcam? and in other distibutions with the EABI compilation target like an ARM version of Debian Lenny.

Theoretic workarounds include:

  • TwonkyMedia? Server should be recompiled for EABI support. EABI is the successor of OABI, and probably more and more distributions will use it in future. Mail TwonkyMedia(approve sites) and ask them to include a build for the architecture 'ARM big endian EABI glibc' instead of the currently available 'ARM big endian OABI glibc' in the unsupported builds section.
  • Create a sandbox/chroot, recompile libc and other required libraries for the OABI target and run twonkymedia server from this chrooted environment. Technically not for the faint-hearted, and requires support for OABI in the kernel (which SlugOS5.3 supposedly has?).
  • Create a sandbox/chroot which can run the uclibc version of TwonkyMedia? Server. If for some reason the previous option is not possible, then this might be the only remaining option.

Not yet implemented in this HowTo

  • Running multiple TwonkyMedia? Server instances on one server. Possible from two different user accounts (verified) or from one installation (but requires seperation of all config files, db and cache).
view · edit · print · history · Last edited by FrankL.
Originally by FrankL.
Page last modified on August 03, 2009, at 10:52 AM