Mar 05 2008

OpenWRT, mt-daapd and Roku SoundBridge

Tags: , , , , , , Filed under: Written in Englishhugo @ 7:28

A little more work on the Slug’s front… It took me a while to figure out why iTunes could talk to my Slug, and my Roku SoundBridge could not. And the answer is: the default firewall.

I didn’t try to understand what exact rule was the culprit, but the following fixes the issue:

iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -F
iptables -X

Since the Slug is behind my NAT anyway, I don’t really need a firewall. I wish I could actually disable the iptables support from the kernel altogether, but it’s not compiled as a module.


Mar 04 2008

Using the Slug as a music server

Tags: , , , , , , Filed under: Written in Englishhugo @ 6:09

Our Mac Mini finally died. It turned out that the random crashes I was seeing were due to hardware issues, namely the hard disk.

Its sole purpose was to share music, and act as a storage server. I looked at a number of options to replace it, including buying a new Mac Mini, or a low-end PC. I ruled the latter out because of form factor: I wanted a small box to hide in a corner. Mini PCs exist, but they are pretty expensive, and a new Mac Mini is about $600. It seemed wasteful to invest into so much horsepower to have it sit doing nothing most of the time, and streaming audio files once in a while.

Linksys NSLU2

I therefore decided to go with a more exotic solution: a Linksys NSLU2, which is a network box running Linux in which you can plug USB hard drives. There’s a lot of hacking going on on this device, and it is cheap: $60 on Amazon.

I was faced with the dilemma of choosing which firmware to install, out of the 9 flavors available. As a matter of fact, I experienced more than the dilemma, since I experimented with quite a few of them.

I wanted the following features:

  • Ability to run the firmware without a flash drive: flash drives are pretty slow, and not really designed to have repeated reads and writes that a root partition will get.
  • Media server available: this is the primary purpose of this box.
  • Multi-user support: I want to use it as a storage server for different servers.
  • Ability to spin down the hard drives attached to it: most of the time, the box is idle, so I don’t need to have the disks spin.
  • HFS+ support: I have some disks that were formatted on a Mac.

I ended up settling with OpenWRT, which has all those features:

  • Self-contained: It is very small and fits on the 5MB root partition of the Slug.
  • Media server: mt-daapd is installable via Optware.
  • Multi-user: adduser is available via Optware to help setup user accounts (though you could obviously do it by hand).
  • Spinning down drives: using the shell script from NSLU2-Linux with sg_start from Optware’s sg3-utils works beautifully.
  • HFS+ support: OpenWRT has a modern (2.6.21.6), well packaged kernel, that allows to install exotic modules as needed.

Amazingly, the 32MB of RAM are enough for the Web server used for configuration, the SSH server for login, the FTP server for file transfer, the media server for iTunes streaming, without the need of a swap device.

I did try alternative firmwares. DebianSlug is a fully-fledged Debian distribution, but it’s much bigger, and requires installation on an attached drive; it actually took me 3 tries to manage to install it, and for some reason, it broke after a few hours (I couldn’t log into the box any more!). SlugOS/BE would probably have worked, but it didn’t feel as polished as OpenWRT.

All in all, I’m happy about the solution that I ended up with: the NSLU2 with OpenWRT is a low-cost, low-energy solution, which works really well.