[HOWTO] Squeezecenter 7.2 (for Squeezebox) on Zyxel NSA-220

Marvell Orion based
Post Reply
Superkikim
Posts: 22
Joined: Fri Sep 12, 2008 10:09 am

[HOWTO] Squeezecenter 7.2 (for Squeezebox) on Zyxel NSA-220

Post by Superkikim » Fri Sep 19, 2008 3:03 pm

1. Install FFP on your Zyxel NSA-220 in 8 steps (based on http://forums.nas-central.org/viewtopic.php?f=131&t=191 by Mijzelf)

1.1 Install FFP
  1. Plug an USB stick of at least 64MB in your NSA-220 (the bigger, the better if you plan not to move ffp to your drive)
  2. Use the Webinterface to login to your box as admin.
  3. Goto Administration->Storage
  4. Use the 'Create an External Volume' button to change the filesystem of the stick to EXT3. This step will destroy all data on the stick. Give it an easy name (i.e. ffp_stick or ffp_key)
  5. The volume should be accessible via Samba. Be patient. It takes some time for it to be reachable. Download ffp_for_NSA-220.2.zip and extract the contents of ffp_for_NSA-220.2.zip to this share.
  6. Download fun_plug.tgz, and copy it to the share too. The share should contain 6 files now.
  7. In the webinterface goto Shutdown->Restart.
  8. Wait until the box has rebooted. Done!

1.2 Start the SSH and disable the telnet daemon for your own safety

By default, the telnet service is started.

To enable an ssh server:

telnet to the device, and do the following:

Code: Select all

chmod a+x /ffp/start/sshd.sh
/ffp/start/sshd.sh start
After a while the ssh server should be started. Be patient. Try if it works. Two users have been created:

username: user password: user
username: root password: root

If it works, login as root and type

Code: Select all

reboot
The box should reboot. If the ssh server is in the air again, you can disable the telnet server:

Code: Select all

chmod a-x /ffp/start/telnetd.sh
I also suggest you immediately change your root and user passwords. Logged in as root:

Code: Select all

passwd
then

Code: Select all

passwd user
2. Move FFP to the hard drive (optional)

If you want, you can move FFP to the one of the hard drive of the zyxel. But you will still need the stick to boot on it. THE STICK CANNOT BE REMOVED AT ANYTIME. Moving FFP to the local drive will prevent the stick to be full anytime.

2.1 To move FFP to the 1st disk, go to /i-data/ and check the disk labels. It should be md0 and md1 for JBODs. These are symbolic links. It might be different for RAID0 and RAID1. You will also see drives mounting points. Be sure you stay consistent in the use of these.

In the folder creation below, use the mounting point, not the symbolic link. For example, if you have md0, change dir to /i-data/md0 and check where you really are. Use this path for below commands. Otherwise it will not work.

In my system, "/i-data/md0" symbolic link goes to "/i-data/1776811d".

Code: Select all

mkdir /i-data/1776811d/ffp
cp /ffp/* /i-data/1776811d/ffp/ -R
mv /ffp /ffp_old			'Do not delete it. Rename it. It is still necessary until reboot
ln -s /i-data/1776811/ffp /ffp		'create a symbolic link to replace the ffp folder on the root
reboot                                      'Reboot the box
Wait until the box has finished rebooting

2.2 Open a new ssh (or telnet session), and then, you can delete the old ffp folder:

Code: Select all

rm -fR /ffp_old
Remember that the usb stick is still mandatory to boot.

2.3 Install additional FFP packages:

Code: Select all

cd /ffp
rsync -av inreto.de::dns323/fun-plug/0.5/packages .
cd /ffp/packages
rsync -av inreto.de::dns323/fun-plug/0.5/extra-packages/perl/ .                   ' fonz has moved the perl packages from packages to extra-packages
wget http://www.inreto.de/dns323/fun-plug/0.5/extra-packages/perl/perl-5.10-2.tgz
funpkg -i *.tgz
Note that we download the perl package with wget, because the transfer with rsync corrupt it. No idea why.

You're done with FFP

3. Preparation to the Squeezecenter installation

3.1 Create an installation folder where you will put all the packages you will need now on:

Code: Select all

mkdir /ffp/install
cd /ffp/install

3.2 Install GNU nano text editor (It will be most helpful if you don't know how to use VI)

Code: Select all

wget http://www.superkikim.com/files/nano-2.0.9.tar.gz
tar xvzf nano-2.0.9.tar.gz
cd nano-2.0.9
./configure --prefix /ffp
make
make install
Now, you can edit any text file using nano. In nano, to save.

Quick reference guide for nano: CTRL-X to exit (and save), CTRL-W to make a text search

4. Install SqueezeCenter on the Zyxel NSA-220 (based on http://forums.slimdevices.com/showthread.php?t=52664 by Yannick)

Open an SSH session into the Zyxel if you're not in. But you should ;-)

4.1 Prepare mysql for Squeezecenter

4.1.1 Create a squeezecenter user

Code: Select all

adduser squeezecenter -HD
4.1.2 mysql configuration

Create a configuration file for mysql. There is a example of config file delivered with FFP. We will use it as a base:

Code: Select all

cd /ffp/etc
cp examples/mysql/my-small.cnf my.cnf
Edit the configuration file to change some parameters for our needs:

Code: Select all

nano my.cnf
Search for the [mysqld] section. At the end of the section, add datadir = /ffp/var/mysql

The section will then look like:

Code: Select all

[mysqld]
port		= 3306
socket		= /ffp/var/run/mysql/mysql.sock
skip-locking
key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K
datadir = /ffp/var/mysql
4.1.3 Database creation

4.1.3.1 You are still in the /ffp/etc directory. Install the mySQL database.

Code: Select all

mysql_install_db
4.1.3.2 Make the mysql startup script excutable and start the mysql daemon

Code: Select all

cd /ffp/start
chmod a+x mysqld.sh
./mysqld.sh start
When the mysql daemon has started, it didn't come pack to prompt on my NAS. Just press enter, to be sure if it's ok. It should come back to the prompt.

4.1.3.3 Secure mysql

Code: Select all

mysql_secure_installation
Press enter on the 1st question. Then answer default (Y) to all questions and give your root password on password second question

4.1.3.4 Create the squeezecenter database

Code: Select all

mysql -u root -p
Enter your root password

If you get the mysql> prompt, you're good so far.

Type the following commands in mySQL

Code: Select all

mysql> create database squeezecenter;
mysql> grant all on squeezecenter.* to squeezecenter identified by 'your_root_password';
mysql> flush privileges;
mysql> quit
At this point, we have a running mySQL installation and an empty squeezecenter database that SqueezeCenter can use. MySQL will start automatically when you

4.2 Install The SqueezeCenter server

4.2.1 Go back to your installation directory

Code: Select all

cd /ffp/install
4.2.2 Download and untar the Squeezecenter 7.2 noCPAN perl source:

Code: Select all

wget http://downloads.slimdevices.com/SqueezeCenter_v7.2.0/squeezecenter-7.2-noCPAN.tgz
tar xvzf squeezecenter-7.2-noCPAN.tgz
This folder will be your main squeezecenter folder. Therefore, it would be wise to put it in a logical place. For exemple /ffp/squeezecenter_v7.2.0-noCPAN

Code: Select all

mv squeezecenter-7.2-noCPAN /ffp/
4.2.3 To simplify your installation and your future maintenance of Squeezecenter, create a symbolic link in the root to squeezecenter

Code: Select all

cd /
ln -s /ffp/squeezecenter-7.2-noCPAN squeezecenter
As of now, you will do everything from the "squeezecenter" symbolic link directly.

4.2.4 Install dependent perl modules

Go to the squeezecenter folder (throught the symbolic link):

Code: Select all

cd /squeezecenter
4.2.4.1 Download and install some dependent perl modules in the SqueezeCenter installation.

Code: Select all

perl Bin/build-perl-modules.pl XML::Parser::Expat HTML::Parser JSON::XS Digest::SHA1 YAML::Syck
Answer to the questions as follow:

Code: Select all

- Please enter a perl binary to use: /ffp/bin/perl
- Please enter the path to your SqueezeCenter directory (ex: /usr/local/slimserver) --> /squeezecenter
- Please enter a directory to download files to --> /ffp/tmp
The system will automatically download, compile and install a few perl modules. This will take some time and output a few warnings and non blocking errors that you can ignore.

4.2.4.2 Get additional packages that you will have to compile manually. I have prepared two scripts to do it easier and faster. These scripts are very simple and do not make any check. So please be attentive to the messages it gives.

Code: Select all

cd /ffp/tmp
wget http://www.superkikim.com/files/get_sc_packages
wget http://www.superkikim.com/files/comp_sc_packages
Run the get_sc_packages script to get the packages. This script will download the required packages from the CPAN website.

Code: Select all

chmod a+x get_sc_packages
./get_sc_packages
Run the comp_sc_packages to compile the packages. This script will compile and install the 8 downloaded packages.

Code: Select all

chmod a+x comp_sc_packages
./comp_sc_packages
Beware: These scripts do not check if packages have been installed correctly. Be attentive during the compilation process, and take note of any suspect

message.

4.2.4.3 Edit the rc file to set the LD_LIBRARYPATH environment variable at boot

Code: Select all

nano /ffp/etc/rc
Replace the line

Code: Select all

unset LD_LIBRARY_PATH
with

Code: Select all

EXPORT LD_LIBRARY_PATH=/ffp/lib/mysql
At that point you have all perl modules necessary to run SqueezeCenter.


5. Start of SqueezeCenter and final settings adjustments

If you missed point 4.1.1 (creation of the squeezecenter user) it is time to do it now. Otherwise, you will be in trouble.

Go the SqueezeCenter directory:

Code: Select all

cd /squeezecenter

5.1 Modify the header of the .pl scripts to use the ffp installed perl binary

Code: Select all

nano slimserver.pl
Change the 1st line to

Code: Select all

#!/ffp/bin/perl -w
Do the same with the scanner.pl script.

5.2 Start Squeezecenter for the 1st time

Go to the SqueezeCenter directory

Code: Select all

cd /squeezecenter
Start Squeezecenter for the 1st time

Code: Select all

./slimserver.pl --user=squeezecenter
It will output many error message. Just ignore them.

5.3 Fix generated files ownership

During this first startup, several log and cache files have been generated.

Unfortunately those files are created by default with root ownership and the user 'squeezecenter' doesn't have access on it. We have to fix that:

Code: Select all

chown -R squeezecenter:500 Cache/ Logs/ prefs/
5.4 Second start of Squeezecenter

Code: Select all

./slimserver.pl --user=squeezecenter
You will get again error messages. Ignore them. This time, configuration files for the server have been generated. We need to change its ownership as well

and modify it, so that it uses the mysql instance installed on the system previously

5.5 Second fix of files ownership

Code: Select all

chown -R squeezecenter:500 Cache/ Logs/ prefs/
5.6 Server database connection

Edit the prefs/server.prefs file

Code: Select all

nano prefs/server.prefs
Find (CTRL-W) dbpassword (ignore _ts_dbpassword, and search a second time to find dbpassword)

Change dbpassword, dbsource and dbusername to:

Code: Select all

dbpassword: 'your_root_password'
dbsource: dbi:mysql:hostname=localhost;port=3306;database=squeezecenter
dbusername: root
You are all set. Squeezecenter has been installed.


6. Squeezecenter start and use

To run squeezecenter from the shell, go to the slimserver folder and run the following command:

Code: Select all

./slimserver.pl --daemon --prefsfile /slimserver/prefs/server.prefs --user=squeezecenter --pidfile /var/run/slimserver.pid
Wait some minutes for the server to be up and running. BE PATIENT.

After a while, it should be available through "http://yournas:9000"

7. Start Squeezecenter on NAS boot


7.1 Symbolic link to the script

First of all, create a symbolic link to slimserver.pl. It will make it easier for the startup script.

Code: Select all

ln -s /squeezecenter/slimserver.pl /squeezecenter/squeezecenter
7.2 The start up script

Any script in the /ffp/start folder with execute permission will be run at boot.

7.2.1 Create a script in that folder:

Code: Select all

cd /ffp/start
nano squeezecenter.sh
7.2.2 Put the following commands inside:

Code: Select all

#!/ffp/bin/sh

# PROVIDE: squeezecenter
# REQUIRE: mysqld

. /ffp/etc/ffp.subr

name="squeezecenter"
command="/squeezecenter/squeezecenter"
squeezecenter_flags="--daemon --prefsfile /squeezecenter/prefs/server.prefs --u$

start_cmd="squeezecenter_start"
stop_cmd="squeezecenter_stop"
status_cmd="squeezecenter_status"
restart_cmd="squeezecenter_restart"

squeezecenter_start()
{
proc_start $command
}

squeezecenter_stop()
{
proc_stop squeezecenter
}

squeezecenter_status()
{
proc_status squeezecenter
}

squeezecenter_restart()
{
proc_stop squeezecenter
sleep 30
proc_start $command
}
run_rc_command "$1"

7.2.3 Exit and save it with CTRL-X.

7.2.4 Change permission to the script:

Code: Select all

chmod a+x squeezecenter.sh


The script will work with:

Code: Select all

./squeezecenter.sh start 'starts the squeezcenter server
./squeezecenter.sh stop 'Stops the server
./squeezecenter.sh status 'check the status of the server
./squeezecenter.sh restart ' Will stop the daemon, wait 30 seconds for it to be stopped, and restart it.
You're all set. Reboot, wait a while (BE PATIENT again). You can ssh to the NAS and check with top if the server is running.

Configure your server from the web interface.If your music is on your nas (that was the point wasn't it ?), you will find it in /i-data/anydrive. In my case, /i-data/md0/music

Enjoy

PS: Any comment, or confirmation it worked is welcome...
Last edited by Superkikim on Thu Oct 16, 2008 9:56 am, edited 4 times in total.

Superkikim
Posts: 22
Joined: Fri Sep 12, 2008 10:09 am

Re: [HOWTO] Squeezecenter 7.2 (for Squeezebox) on Zyxel NSA-220

Post by Superkikim » Thu Sep 25, 2008 9:37 am

After one week of use, I must say I find it very... very.... very... slow to use with my Squeezebox Duet.

When I wake up in the morning, and try to use my Squeezebox Controller, it take ages to connect to the Squeezecenter server and nothing happens. I have to shutdown the controller and start it again for the system to work...

I don't really know if this is related to the controller or to the NAS. But when SqueezeCenter was installed on my desktop controller, I didn't have this kind of behavior.

If you have any experience on running Squeezecenter on a 128MB RAM box, let me know

adangerred
Posts: 4
Joined: Wed Oct 15, 2008 1:36 pm

Re: [HOWTO] Squeezecenter 7.2 (for Squeezebox) on Zyxel NSA-220

Post by adangerred » Wed Oct 15, 2008 1:42 pm

Hi there,

I'm fairly new at all this, but I've followed the instructions above to the letter.

I get as far as: perl Bin/build-perl-modules.pl XML::Parser::Expat HTML::Parser JSON::XS Digest::SHA1 YAML::Syck

here I get: -sh: perl: not found

So, apparently I do not have Perl installed. Or have I missed something?
How do I solve this? :)

ADR

Superkikim
Posts: 22
Joined: Fri Sep 12, 2008 10:09 am

Re: [HOWTO] Squeezecenter 7.2 (for Squeezebox) on Zyxel NSA-220

Post by Superkikim » Wed Oct 15, 2008 2:24 pm

fonz has changed some packages location.

I have amended point 2.3

To fix your issue:

Code: Select all

cd /ffp/packages
rsync -av inreto.de::dns323/fun-plug/0.5/extra-packages/perl/ .
funpkg -i *.tgz

adangerred
Posts: 4
Joined: Wed Oct 15, 2008 1:36 pm

Re: [HOWTO] Squeezecenter 7.2 (for Squeezebox) on Zyxel NSA-220

Post by adangerred » Wed Oct 15, 2008 2:58 pm

Thanks you very much, but I still get error msg.


rsync -av inreto.de::dns323/fun-plug/0.5/extra-packages/perl/ .
funpkg -i *.tgz

Now it says: FATAL: perl-5.10-2.tgz: File not found

Thankfull for further assistance :)

ADR

Superkikim
Posts: 22
Joined: Fri Sep 12, 2008 10:09 am

Re: [HOWTO] Squeezecenter 7.2 (for Squeezebox) on Zyxel NSA-220

Post by Superkikim » Wed Oct 15, 2008 3:26 pm

adangerred wrote: Now it says: FATAL: perl-5.10-2.tgz: File not found
It seems that the perl-5.10-2.tgz package is corrupted. When I try to untar, it says

tar: perl-5.10-2.tgz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error exit delayed from previous errors

You should try escalate this to Fonz, for him to fix it. Then, delete your perl files, donwload again with the rsync command above and retry

adangerred
Posts: 4
Joined: Wed Oct 15, 2008 1:36 pm

Re: [HOWTO] Squeezecenter 7.2 (for Squeezebox) on Zyxel NSA-220

Post by adangerred » Thu Oct 16, 2008 7:48 am

Hi again,

OK, I understand. But who is Fonz and how do I get in touch with him?

ADR

Mijzelf
Posts: 6251
Joined: Mon Jun 16, 2008 10:45 am

Re: [HOWTO] Squeezecenter 7.2 (for Squeezebox) on Zyxel NSA-220

Post by Mijzelf » Thu Oct 16, 2008 8:36 am

perl-5.10-2.tgz extracts fine for me. Maybe somehow rsync corrupts it? I used

Code: Select all

wget http://www.inreto.de/dns323/fun-plug/0.5/extra-packages/perl/perl-5.10-2.tgz
to retreive it.

Fonz is the creator/maintainer of the ffp (Fonz FunPlug) packages. You can get in touch with him via the DNS323 forum where he is moderator.

Superkikim
Posts: 22
Joined: Fri Sep 12, 2008 10:09 am

Re: [HOWTO] Squeezecenter 7.2 (for Squeezebox) on Zyxel NSA-220

Post by Superkikim » Thu Oct 16, 2008 9:54 am

Thank you Mijzef

I confirm that rsync is not transfering properly this package.... Why ? I have no idea :-(

So, adan: Use this command to download the perl package:

Code: Select all

cd /ffp/packages
wget http://www.inreto.de/dns323/fun-plug/0.5/extra-packages/perl/perl-5.10-2.tgz
Then, rerun funpkg -i *.tgz

Should work after that.

By the way, Fonz made a Squeezecenter 7.2 packages for FFP. Might be all alot simplier, but I didn't try it yet. Don't know if it works with the Zyxel. I plan to try it soon. But need some time...

Mijzelf
Posts: 6251
Joined: Mon Jun 16, 2008 10:45 am

Re: [HOWTO] Squeezecenter 7.2 (for Squeezebox) on Zyxel NSA-220

Post by Mijzelf » Thu Oct 16, 2008 10:47 am

It seems rsync -avP has to be used:
http://forum.dsmg600.info/t3112-rsync-inreto.de.html

Post Reply