The Linksys NSLU2 (slug) presents arguably the most mature Network Attached Storage (NAS) platform for Firefly. It is a very flexible device with stable firmware, a large and organized supporting community, and lots of available software packages. However, the perception of many people is that setting up a slug and installing Firefly is difficult. The objective of this wiki page is to disabuse people of this notion, and to pull together all of the information required to install Firefly on a slug.

If you are new to this whole area then please read this guide very carefully and follow it step by step. If you get stuck, confused or need additional explanation please PM me or raise a thread on the forum before you go any further. Many people interested in installing a media server on a NAS device wish to minimise power consumption. This guide also examines how to optimize a slug build for low power consumption.

In a nutshell, there are four steps to building a Firefly Slug;

  1. Planning And Preparation
  2. Flashing And Unslinging
  3. Installing Firefly
  4. Configuring Firefly

Planning And Preparation

This is the toughest bit as it involves a little homework. However, it really isn't all that tough.

Let's start with hardware. Given that you're going to need somewhere to store your music then you're going to need a USB hard disk to attach to your slug. Now, as our objective is to build a low power server, you need to make sure that the hard disk you use has the ability to spin itself down when not in use. For technical reasons (see the SpinDownUSBHarddisks FAQ on the NSLU2-Linux wiki), the slug can't do this for us. I've had very good spin down results with the following set ups:

Others have reported success with the following;

For a beginner, the Maxtor is a great choice as it ships with a nice Windows which sets the spin down on the drive. However, this must be done before the Maxtor is formatted by the slug. Setting up the Hitachi is a little more complicated. The hard disk must be installed in a PC and the PC booted with a DOS boot disk containing Hitachi's Feature Tool utility. The Feature Tool can be obtained from Hitachi's web site.

Optional: Users requiring an even lower power set up may wish to use a USB memory stick in addition to a hard disk. The idea here is that the slug uses the memory stick as its main system disk. The hard disk can therefore be spun down whenever the slug isn't using it to stream music. As this is very easy to set up, I'll also cover this scenario and mark the appropriate sections with Stick:. Most memory sticks are reported as being compatible with the slug but I use a Kingston Data Traveller II 1GB. Although Unslung 6.8 will run on a memory stick of 256MB capacity, this leaves virtually no space for user data, so a minimum capacity of 512MB is therefore recommended. With the ever-growing size of memory sticks, you may soon be able to run a slug without even a harddrive. 2x 16 GB sticks may already be good enough for a small music collection.

Small warning: Having the harddrive spin down is a great way to reduce power consumption but there is a gotcha. 3.5" drives aren't built to survive permanent spin-down-spin-up cycles. So really check that the drive is staying spun-down for a while when you dont use your music server. If you see it waking up too often then it may be better to not have it spin down, as permanently spinning down/up your drive may damage it within a couple of months.

Now that we have the hardware we need in place, i.e. a slug, a USB hard disk and optionally a USB memory stick, it's time to do a little reading. To install software on the slug we need to replace the stock Linksys firmware with one that will give us access to the slug and let us install software. The firmware that we'll be installing is called Unslung. You can view it as an enhanced version of the stock firmware as it builds upon it. This makes it beginner friendly. You should do the following before proceeding:

  1. Get your slug up and running on your network and familiarize yourself with its user interface. Make sure that your slug has valid DNS and gateway settings and that it can connect to the internet (e.g. ping www.google.com). Internet connectivity is required for easy software installation. You are advised to assign your slug a static IP address particularly if you are running OpenWrt or DD-WRT firmware on your router.

  2. Take a look at the NSLU2-Linux.org wiki. It's a good bet that anything you need to know or might want to know in the future is covered there.

  3. Read the How To Install Unslung Firmware there. Those instructions are a more complete version of the Flashing And Unslinging section below.

  4. Read the Unslung New User's Guide there.

  5. To follow this guide and to install Unslung you will need to use telnet. Be sure that you know how to run telnet on your PC or Mac. Then, follow the instructions in the HowTo/TelnetIntoRedBoot article.

  6. Stick: You should read the "Which USB Port for Unslung6" article, and the Unslung 6.8 section of Unslung Known Problems article, which describes how the Linksys firmware mangles disk2 share names on reboot of the slug. A resolution is also described there. This is important as your hard disk and therefore most of your data shares will suffer from this irritating feature.

  7. Moving on to the Firefly software, note that Firefly used to be known as mt-daapd. You'll often see references to the latter on web pages and forums but don't be confused, they're the same thing.

  8. You will need to choose which version of Firefly software to use. This is covered in the Installing Firefly section below.

Flashing And Unslinging

Now that you're familiar with the stock Linksys firmware and the nslu2 linux community we can get down to the easy bit – the actual set up.

  1. If you haven't already done so, this is a good time to hook the hard disk you'll be using up to a PC and set the disk spin down. Don't worry about formatting the drive as the slug will format it with the Linux ext3 filesystem during a later part of the installation. Note1 : The Linksys NTFS driver is buggy. Do not use NTFS formatted drives with the slug! You will face data loss with the ntfs driver sooner or later!
  2. Plug your hard disk into the slug and make sure that the slug recognizes it. Stick: If you're planning to use a memory stick then see if slug recognizes it too. However, I found that my slug with stock firmware wouldn't recognize my memory stick (and a couple of others I tried) so don't worry too much if you have memory stick recognition issues at this point.

  3. You need a copy of Unslung. Go to http://www.slug-firmware.net and download the latest Unslung binary. As of November 2007, the current version is 6.8-beta. Don't worry about the "beta" label; it's what hundreds of others are using, and works quite well.

  4. Unzip the archive file you downloaded and read the README file that ships as part of the archive. This README provides you with a step by step guide to installing the firmware. The setup instructions in the README are excellent and easy to follow so I won't replicate that material here. You should now follow the README in conjunction with notes 5 through 9 below.
  5. README - 'Pre-Installation Consideration' 1. Do this. It's a pain but important in case things go wrong.

  6. README - 'Pre-Installation Consideration' 2 through 6. Important - this guide assumes that we will be using the slug's Linux ext3 filesystem not NTFS (see above). You will therefore be connecting your hard disk to port 1. Stick: You will be connecting your stick to port1 and your disk to port 2. This is contrary to the Linksys documentation (which is out of date). Check that you know which port is which and that you know where you're plugging things in before you proceed.

  7. README - 'Firmware Installation Details'. Follow steps 1 to 5 very carefully. At this point it is worth noting a couple of points about the slug's ext3 format feature. When the slug formats a drive as ext3 it does much more than a simple format (see the WhatIsANativeUnslungDisk article for more information). This can be confusing, as it may appear that your hard disk or memory stick has just lost some space, when in actual fact, the slug has just pinched it for swap and configuration space. Don't worry about this. Also note that if you want to have the slug reformat a drive that has previously been formatted by the slug then plug it into a PC or MAC and delete all partitions on it first. A simple reformat won't be sufficient to get rid of the extra partitions created by the slug format. Stick: To simplify matters, the only disk you need to plug / unplug throughout this process is the memory stick. Put the hard disk to one side – we'll deal with that in step 9. Remember that you should be plugging the the memory stick into port 1.

  8. Now follow steps 1-9 in README - 'Unslinging Details' very carefully.

  9. Stick: To reduce wear on the memory stick, telnet into the slug and follow the instructions in the Unslung Ext3flash article. Once you've done that plug your hard disk into port 2 and format it via the slug user interface. Note that by following these procedures the slug will use swap space on your hard disk and not on your memory stick. This compromises our low power ideal somewhat but is probably the best option for a beginner's setup as the slug has access to swap.

  10. You now need to be able to telnet into your slug. One way to do this is to turn-on the slug's built-in telnet support. This is simple, but the Telnet protocol has the security risk that it sends your root password in the clear over the network. An alternative is to install ssh support, and telnet into your slug via ssh. This gives higher security, but require the extra but easy step of installing ssh. Unless you are serene about the security of your network, use ssh. For more information, see the FAQ "Enable Telnet Through The Web Interface" and the "How To Use OpenSSH For Remote Access" articles from the NSLU2 wiki.

Installing Firefly

Firefly is available as two releases – the stable build and the nightly build. You can find more information about these at the stable build and the nightly build articles, and at the Firefly download page. This section covers installation for both alternatives. A great deal of software (including Firefly) is provided for the slug in precompiled format. This software is made available via feeds and is installed via the 'ipkg' command.

Choosing a Firefly version

You need to choose whether to use the stable build or nightly build. As of November 2007, the stable build is 0.2.4.1-1. It is better tested. The nightly build is svn-1696 (Mon, 29 October 2007). It allows you to play .flac and .ogg files via transcoding (see Transcoding HOWTO), supports plugins, and supports Pinnacle Soundbridge better.

Pinnacle Soundbridge owners should note that they will have to follow the nightly build route as the current stable release (at the time of writing - 0.2.4) does not support this device. Roku branded Soundbridges do not suffer from this constraint. Pinnacle Soundbridge users should also ensure that they have loaded firmware 2.5.171 (minimum) on their Soundbridge.

Finally, if you are reinstalling Firefly e.g. when moving from a stable to nightly build or moving from one nightly to another then you may want to back up your Config File (/opt/var/mt-daapd/mt-daapd.conf) before installing. You can then restore your settings to the new config file that Firefly generates. Blindly copying the previously backed up config file over the newly generated config file is not advised in case of config file syntax or semantic changes between builds.

Installing a stable release

To install a stable release, telnet into your slug and enter the following command

# ipkg update

If the above command fails then check that your slug's DNS and gateway settings are valid via the web interface. Now enter the command

# ipkg install mt-daapd

That's it! You can now check that Firefly is running and move on to configure it to suit your needs.

Installing a nightly build

To do this, you need to tell the slug about the software feed from fireflymediaserver.org. To do this telnet into your slug and enter the following command

# echo "src firefly http://ipkg.fireflymediaserver.org/armeb" > /etc/ipkg/firefly.conf

If the above command fails then check that your slug's DNS and gateway settings are valid via the web interface. Now enter the command

# ipkg update

Now enter the command

# ipkg install mt-daapd

That's it!

Making Sure Firefly Is Running

Having installed the Firefly version you chose, you now need to be sure it is running. Telnet into your slug and enter the following command:

# ps -ef | grep mt-daapd

If Firefly is running then you should see something like this

497         guest      4004   S   /opt/sbin/mt-daapd
498         guest     11896   S   /opt/sbin/mt-daapd
507         guest     11896   S   /opt/sbin/mt-daapd
508         guest     11896   S   /opt/sbin/mt-daapd
2564 ttyp0   root       2668   S   grep mt-daapd

If not then you'll see something like this

2564 ttyp0   root       2668   S   grep mt-daapd

If Firefly isn't running type

/opt/etc/init.d/S60mt-daapd

Give it a minute or two and then repeat the ps command above. You should then see the output with the four mt-daapd processes. If not then check /var/log/messages to look for some clues as to what's going on and take a look at the troubleshooting page. In particular be aware that you may need to set mp3_dir in /opt/etc/mt-daapd.conf to get Firefly to start (see Configuring Firefly below).

Once you have firefly up and running you can move on to configure it to suit your needs. However, a quick aside about Unslung directories first.

A Quick Aside About Unslung Data Locations

The following section describes configuration of Firefly to point at your music. To do this you need to know which directory(s) on the slug your music is held in. Let's assume that you've created a share called 'mp3' on your hard disk via the linksys web interface to hold your mp3 collection. If you unslung to a single disk drive following the instructions above (i.e. in port 1) then the directory containing your data will be /share/hdd/data/mp3. Stick: If you've been following the memory stick route then the hard drive directory containing your music will be /share/flash/data/mp3. Do not be confused by the appearance of the word 'flash' in the path. The linksys firmware underlying Unslung simply refers to the data partition of any device attached to USB port 2 as /share/flash/mp3. If you're interested this is explained in more detail in the "Which USB Port for Unslung6" article. Look at the section on dual native devices.

Configuring Firefly

Now all that needs to be done is to configure Firefly to point to your media files. There are two ways of doing this. The easiest way is via Firefly's web interface. Simply type http://IP_of_your_slug:3689 into the address bar of your browser. You don't need to enter a username and the default password is 'mt-daapd'. Once you've logged in select 'Configuration' from the menu.

Note that if all of the configuration information is greyed out then the mt-daapd config file has the wrong permissions set. You should also see a warning to this effect. To sort this out telnet into the slug as root and type

# chmod 644 /opt/etc/mt-daapd/mt-daapd.conf

Alternatively you can telnet into your slug and directly edit the /opt/etc/mt-daapd/mt-daapd.conf configuration file by typing

# vi /opt/etc/mt-daapd/mt-daapd.conf

Before doing this familiarise yourself with the UNIX vi editor. Here's the first vi command reference link I pulled off Google - www.eng.hawaii.edu/Tutor/vi.html. If vi isn't to your taste then it is possible to install other editors on the slug such as nano or JOE using the ipkg command. See the NSLU2-Linux wiki for more information.

The two main things you'll need to adjust are Firefly's music folder and Firefly's scan interval. Returning to the example from the note above, we'd set Firefly's music folder to /share/hdd/data/mp3. Stick: /share/flash/data/mp3.

Stick: To minimise reads and writes to the memory stick you may want to move Firefly's songs database from its default location on the memory stick (/opt/var/mt-daapd) to your hard disk. To do this you'll need to create a new location on the hard disk to store Firefly's songs database. Telnet into the slug and issue the following commands.

# cd /share/flash/data
# mkdir mt-daapd
agate d# chmod 777 mt-daapd

Now go into the web configuration page, select advanced options and in the Database section set Database Directory to /share/flash/data/mt-daapd. Restart Firefly (or reboot the slug) and Firefly will create and make use of the songs database on the hard disk.

Putting music on the slug

Use file copying techniques to put music files in the folder you designated earlier as your music location. Then go to the Firefly status page, and press the "rescan now" button. Firefly will read the files and add them to its list.

Playing music via iTunes

iTunes can receive music from Firefly, just as it can receive music shared by other copies of iTunes. The Firefly server's name appears under Shared in the left-hand column of the iTunes window. Click on the Firefly name, and the music on your Firefly server appears in the right-hand part of the window.

To play a tune, do what you normally do in iTunes: click on the tune and press Play.

That's it! Off you go!

Further reading

NSLU2 Installation (last edited 2007-11-21 15:53:52 by s20)