SheevaPlug Installation guide
From SqueezeboxWiki
This page describes how to install SqueezeCenter on a SheevaPlug. I have decided to use a Debian distribution because I am familiar with this distribution but it should work with other distribution supporting ARM platform.
Contents |
7.4.1 native support
As of 7.4.1 r28877, the standard Debian package should install and run on SheevaPlug systems running Ubuntu or Debian Lenny or later. Transcoding binaries are also included. The download package is available at http://downloads.slimdevices.com/nightly/?ver=7.4
Install Debian on the SheevaPlug
I have used the instruction given on this page: [1]. I have only tested the installation on an USB stick.
I have only tuned the /etc/fstab in order to mount tempory files using tmpfs and to add the option noatime for the main partition:
proc /proc proc defaults 0 0 /dev/sda1 / ext3 errors=remount-ro,noatime 0 1 /dev/sda2 none swap sw 0 0 tmpfs /var/run tmpfs defaults 0 0 tmpfs /var/lock tmpfs defaults 0 0 tmpfs /var/log tmpfs defaults 0 0 tmpfs /tmp tmpfs defaults 0 0
Preparing the system
Some additional libraries and programs are needed in order to install SqueezeCenter. To install them, simply run this command:
apt-get install mysql-server gcc g++ libgd2-noxpm-dev libexpat1-dev make apt-get clean
You may need to run apt-get update before the apt-get install... command above.
If you do not need MySQL for other server operations, you do not need MySQL server to be running (SqueezeCenter will run its own instance), you can stop it:
/etc/init.d/mysql stop
This stops the current instance of MySQL server but does not prevent it from launching the next time the SheevaPlug boots. To do that requires renaming or removing some symbolic links in the /etc/rc?.d directories (these directories control what automatically gets launched at different runlevels). Do:
cd /etc ls rc?.d/S*mysql*
Rename these files to start with a 'K' instead of an 'S' or just remove them altogether. A simple way to remove them is to use the update-rc.d script:
update-rc.d -f mysql remove update-rc.d -f mysql-ndb remove update-rc.d -f mysql-ndb-mgm remove
Now, it is time to create the user that will run SqueezeCenter:
adduser --system --group slimserver
Installing SqueezeCenter
All the other steps will be done with the slimserver user. It is time to become this user and to move to its directory:
su -s /bin/bash slimserver cd
I have installed the latest stable release. I order to download it and to decompress it, just type:
wget http://downloads.slimdevices.com/SqueezeboxServer_v7.4.1/squeezeboxserver-7.4.1.tgz tar xfz squeezeboxserver-7.4.1.tgz cd squeezeboxserver-7.4.1-28947
The MySQL Error file shipped with SqueezeCenter is not adapted to the Debian MySQL version. You have to change one file:
rm MySQL/errmsg.sys ln -s /usr/share/mysql/english/errmsg.sys MySQL/
Running SqueezeCenter
Your installation is now completed. To launch SqueezeCenter, simply type:
./slimserver.pl
After a couple of minutes, you should be able to use your browser to configure SqueezeCenter.
If you want to run SqueezeCenter as a daemon, use the following command line:
./slimserver.pl --daemon
Add a script to launch SqueezeCenter during boot
Create a file in /etc/init.d/ called slimserver with the following text:
#! /bin/sh
# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Squeezebox Music Server"
NAME=slimserver.pl
DAEMON=/home/slimserver/squeezeboxserver-7.4.1-28947/slimserver.pl
DAEMON_ARGS="--user slimserver --group slimserver --pidfile /var/run/slimserver.pid --daemon"
PIDFILE=/var/run/slimserver.pid
SCRIPTNAME=/etc/init.d/slimserver
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
#VERBOSE=yes
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
#start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
[ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
status)
if ( /usr/bin/pgrep -u slimserver slimserver.pl > /dev/nul ); then
log_success_msg "slimserver is running"
else
log_failure_msg "slimserver is not running"
fi
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
:
This script is a modified version of the /etc/init.d/skeleton example script.
The DAEMON=/home/slimserver/squeezeboxserver-7.4.1-28947/slimserver.pl line near the top of the program just says where the "slimserver.pl" file is located. Your location may be different, depending on version.
In /etc there is a series of directories rc0.d rc1.d . . . rc6.d. These directories control what is launched on boot for each runlevel. In each of these directories you will need an entry for launching the slimserver script above. These entries will either start with an S (which stands for "start") or a K (which stands for stop). They start with "S##" (where "##" is a two-digit number). In each of the rc?.d directories, you must create a symbolic link to the /etc/init.d/slimserver file you just created but you should use a "##" value that isn't already used. Luckily there is a program, update-rc.d, to help you with this. So, the following lines are just a suggestion, it is up to you to verify you don't create any conflicts.
update-rc.d slimserver 24
This is equivalent to
cd /etc/rc0.d ln -s ../init.d/slimserver K24slimserver cd /etc/rc1.d ln -s ../init.d/slimserver K24slimserver cd /etc/rc2.d ln -s ../init.d/slimserver S24slimserver cd /etc/rc3.d ln -s ../init.d/slimserver S24slimserver cd /etc/rc4.d ln -s ../init.d/slimserver S24slimserver cd /etc/rc5.d ln -s ../init.d/slimserver S24slimserver cd /etc/rc6.d ln -s ../init.d/slimserver K24slimserver
Using An NTFS USB Disk
Read-Only
Read-only access is simpler.
Create a directory to mount the drive to:
mkdir /mnt/usbdrive
Place a line in /etc/fstab like:
/dev/sda1 /mnt/usbdrive ntfs uid=XXX,gid=YYY,umask=0022 0 0
where XXX is the user id for the slimserver user and YYY is the group id for the slimserver group. These numbers can be found in /etc/passwd and /etc/group. Alternatively, you can do:
su -s /usr/bin/id slimserver
The /etc/fstab line above assumes your external drive is NTFS formated. Other disk formats will be slightly different. To start your journey through the confusing options, you can visit a page like mount(8) (with /etc/fstab and mount, you can mount all kinds of music repositories including repositories out on your network on a windows file share somewhere or via NFS).
Now you can mount the device (it will automatically get mounted at boot as well).
mount /mnt/usbdrive
When you configure slimserver, you can now tell it to look for music on the mounted disk.
Sharing the Disk You Just Mounted
To make it easier to manage the disk you just mounted, you can share it via SMB (Windows file sharing). To do this, you use the Samba package which allows a Linux box to speak Windows. You can do a lot with Samba, but this example simply shares the disk you just mounted so anybody on the network can read and write to it.
Go to the samba configuration directory.
cd /etc/samba
Back up the example configuration.
cp smb.conf smb.conf.orig
Edit the smb.conf file to say:
[global] guest account = slimserver netbiosname = MYPLUB security = share socket options = TCP_NODELAY IPTOS_LOWDELAY workgroup = WORKGROUP [public] guest ok = yes guest only = yes path = /mnt/usbdrive read only = no
You will want to change the MYPLUG and WORKGROUP values to reflect the name you wish to call your SheevaPlug and workgroup name of the computer you are going to use to access the SheevaPlug with.
Set up the samba server to start at boot:
update-rc.d samba defaults
Start samba
/etc/init.d/samba start
Start explorer on your desktop machine and enter \\MYPLUG in the address bar. You should see a public share that you can browse into and copy files from.
cat
To be Done
- Explain how to mount music directory from a NAS (using autofs for example)
- Make transcoding work using unofficial Debian multimedia packages.
- Detail installation on SD card.
-
Add a script to lauch SqueezeCenter during the boot. -
Remover MySQL from the services launched during the boot. - install FUSE and ntfs-3g for read-write access to USB NTFS drive.

