Xbox as a media server

I recently got a slim devices squeezebox 3 - it kicks ass, but needs somewhere to store all the tunes it plays (ok it can play internet radio, but I want to listen to my tunes as well). This leaves the option of leaving a computer on for it or leaving a computer on for it. My "normal" machine has a 450W power supply and is a bit of a piggy with electricity, but was very useful to have on: I could ssh into it from anywhere to pull down files or do some diagnostics from "the outside", and of course it ran the slimserver, so my tunes were always available.

Enter the Xbox, it uses about 74W of power, is much smaller and quieter than a traditional PC, and does very well as a server type box. You can pick them up on Ebay for around £30-50, a mod chip for around £15-£50 and a big disk for about £60 - total cost for project: around £130.

Installing Linux on your Xbox like this will stop it being able to play xbox games or boot to your hacked dash. It will becomes much more like a computer. This article shows how to install samba and slimserver as well, allowing you to store music and files, as well as stream it to your squeezebox if you want to.


WARNING
: Any of the instructions here are for educational purposes only, just to see what a terrorist would do to an xbox, if you follow any of the instructions, the consequences will be dire. DIRE! You may want to remove the xbox hard drive and put it somewhere safe (its only 10G anyway), so that if you want a standard xbox again, you can just remove or disable the modchip and put the old disk back in.

Install Modchip

There are loads of howtos available for this. Here is the one I used, with an adapter so no soldering is needed. (these guys also sell modchips and adapters, and are pretty helpful).

Install Disk 

Put your new disk in now, this is probably the easiest part, just remove the old disk and plug the new one in its place :) 

Flash Modchip with cromwell bios

Download the BIOS from http://www.xbox-linux.org/wiki/Download#Xbox_Linux_BIOS_.28Cromwell.29 - you may need to do some combining though: you will get two files, a 256k one and a 1024k one - each for different chips.  Because I got an Xecuter 2.6 chip, it needed a 512k bios (512k on each bank). You can make a 512k file on linux with cat (for windows check http://www.worldxbox.co.uk/printthread.php?t=21871 :

cat cromwell.bin cromwell.bin > cromwell512.bin

Next, fire up the xbox with the "flash protect" switch off, and using bank 1 if you have an X2 chip. This will boot up the flashbios3.0.3 screen with a few options to update from HDD or disk or network. Network is definately the easiest, make sure the network is plugged in, choose this, and then use your browser to go to the ip shown on the flashbios3.0.3 page. Upload the file you made and click upload, then wait for the beast to shut down. Turn on "flash protect" again, then fire up the xbox, you should get a cromwell screen offering a small menu. Level completed, turn off the xbox and go back to your computer for the next step.

Boot Xebian

For the full detail, look at http://www.xbox-linux.org/wiki/Xebian_HOWTO#Installation. Xebian is a modified version of Debian that runs on xboxen, get it here  http://sourceforge.net/project/showfiles.php?group_id=54192&package_id=57509 - The basic version is what we want (currently 
dist-1.1.4-basic.tar.gz) - this is a basic install with no extras, just the skeleton of our new storage server. Untar the package (in windows, you can use 7zip for this, in linux just tar zxvf filename.tar.gz) and inside you should find an iso file, burn this to a DVD-R (most of the time CDs dont work, and CDRWs are painfully slow - ymmv though). Once burned, put it in the xbox's drive and boot it up. You should see the cromwell bios you just flashed start and then ask what to boot from, you can either choose CD with the controller, or just wait: it will eventually just try the CD. If the drive sees the disk properly, you'll see linux starting up, and eventually you'll get a login prompt. If you have a USB keyboard plugged in, skip the ssh step and just log in. If you dont have a keyboard, never mind, you can use ssh to do it as well. Once its all booted up, it should present you with something like xebian.localdomain.local login: - log in as root and start the installer if you have a keyboard (the root password is xebian).

Now back on your computer or laptop, add an alias ip so you can connect to 192.168.0.10, then log in to the box with ssh (in windows,  go to TCP/IP properties of your network connection and change your IP to 192.168.0.11, or add this address in the advanced section. Next use PuTTY again, host 192.168.0.10 username root, password xebian): 

sudo ifconfig eth0:0 192.168.0.11 netmask 255.255.255.0 up
ssh root@192.168.0.10
xebian.localdomain.local login: root # You wont see this if you logged in with ssh
password: xebian 
xebian:~# XBOXLinuxInstall

This will start the installer, and ask how you want to install Linux.

  • Since this is a new disk, we want to use the whole thing, so choose option 3: XBOXLinux using whole HDD (Only use this with cromwell).
  • Choose YES to partition the disk (choosing no will end the installer), then choose the default swap size (256 is fine for our use).
  • Let the installer copy files, it may take a while.
  • Choose an IP address that matches your current network and press ENTER
  • Choose a subnet mask that matches your current network and press ENTER
  • Put in your default gateway and press ENTER
  • Think of a creative hostname and press ENTER
  • localdomain.local is fine for domain name, but put in whatever you like and press ENTER
  • Happy penguin appears on screen. This is a secret hacker code for "all done"
  • Remove the CD and turn off the xbox
  • Hold thumbs

Next time you switch on the xbox, it will start the cromwell bios, but you should also see an HDD entry on the menu - leave it alone for a little while, and it will automagically boot to linux. Here is where we start adding software.

Install software and tweak it. Tweak it HARD.

First thing to do now is add a user and get rid of the default ones (or at least change passwords). You can then log in as the normal user, then use "su -" to become root when you need to.

userdel -r admin
userdel -r mce
userdel -r remote
userdel -r live
useradd -m yournamehere
passwd yournamehere
passwd root 

Next, lets change to your time zone, and adjust your software update settings (sources.list)

tzconfig # Follow instructions to set your time zone
cp /etc/apt/sources.list /etc/apt/sources.list.default
vi /etc/apt/sources.list # you can also use nano (nano /etc/apt/sources.list) but real men use vi
# Add this for Slimserver
deb http://debian.slimdevices.com stable main

Look for the line like "deb http://ftp.at.debian.org/debian/ stable main contrib non-free" and change the "at" bit to your country code (uk for example). Next we run the update (type Y or press enter to continue when prompted), and install samba (this lets you browse the xbox using windows. If you dont have windows, skip the samba part, you can just use scp or rsync). Slimserver is for using a squeezebox, if you dont have one, leave out the slimserver line.

apt-get update
apt-get upgrade 
apt-get install samba
apt-get install slimserver
  • Fill in your domain name
  • Choose yes to encrypt passwords
  • Choose no for wins via dhcp
  • Choose daemons to run samba (not inetd)
  • Choose yes to create samba password database

Now lets add the user you created earlier to the samba password database (if this user does not exist on the system, you'll get an error):

smbpasswd -a yournamehere

To add new samba-only users, you can do this:

useradd -s /bin/false restrictedusername
smbpasswd -a restrictedusername

Next, we create a share for storing everything (change the permissions if you would prefer it more restrictive)

mkdir /data
chown yournamehere.users /data
chmod 775 /data

We need to edit the samba configuration to add this new directory, just edit the file /etc/samba/smb.conf and add the following:

[data]
        comment = pr0n and w4r3z
        path = /data
        read only = No

Restart the samba daemons, and you should be able to browse to your xbox using windows with \\ip.of.your.xbox (or course name resolution can also wor, but I'll leave you to sort it out). If you have a different windows login, you will be asked for a username and password. Use the username and password you configured with smbpasswd. You should also be able to connect to the slimserver with your web browser on http://ip.of.your.xbox:9000 and configure it.

Links

http://smallnetbuilder.com/content/view/24213/166 - Nifty howto on how to install linux and add a second drive on xbox

http://www.slimdevices.com/ - home of the open source squeezebox music streaming device

http://www.xbox-linux.org/wiki/Main_Page - The xbox-linux home page