SheevaPlugs, Wall Warts, and Debian

Whether I like it or not I have a need for permanently running machine. I bought a ReadyNAS Duo a while back which does almost everything I need, but it’s so underpowered that it can’t handle some pretty simple tasks (like rsync over SSH, for example). That, and you have to get up to all sorts of jiggery pokery to be able to install any additional software. This means that I’ve always ended up with an ancient desktop in the cupboard under the stairs, however hard I try to do without.

The last one of these died recently, and I didn’t have another to replace it. This meant that I had the opportunity to look for something more suited to the job at hand; quiet, low power, and able to cope in a dusty, underventilated and sometimes hot environment (under the stairs).

By a strange stroke of luck an article about “wall warts” appeared in my Google Reader stream at just the right time, and the idea of a tiny computer that consumes only 5W for under £100 was just too much for me to ignore.

I bought the base SheevaPlug from New IT, and it turned up the other day. Obviously the first thing I did was to try and reinstall it. The rest of this post describes how I got Debian and SqueezeCenter running from an SD card on my SheevaPlug, mounting all of its content from my ReadyNAS. There was a lot of trial and error, but the following process worked for me repeatably (once I’d found it…)

Before you start:

  • Get a minimum of a 4GB SD card, the highest class (speed) you can find/afford.
  • Make sure you have an ethernet connection available for the Plug, as the installer will download Debian from the internet. If you want to do this a lot (I ended up with about 7 attempts before being happy with the results) you might want to consider setting up Squid or similar on another machine to proxy your many downloads of the Debian distro.
  • Have a machine capable of running a serial terminal to work on. I used my Ubuntu laptop, with cu (sudo apt-get install cu). Other methods are available (Linux, Windows, Mac).

Before you power anything on connect the Plug to the network and connect the USB serial cable to the Plug and your laptop. Get a terminal open and run:

cu -s 115200 -l /dev/ttyUSB0

You should get ‘Line busy’ or similar. Turn on the Plug and then keep trying the above line to connect. Pretty soon (10 seconds?) you should get a prompt that looks like:


I followed the extremely good Installing Debian on the Marvell SheevaPlug with some important alterations. Specifically:

  • The kernel that currently comes with Squeeze does not work on the current version of the SheevaPlug (at least, it kept failing from me and then I found this article about installing Debian on the GuruPlug that suggested an alternative that worked). Instead of downloading the uInitrd and uImage files from the instruction page, I downloaded them from the Debian daily snapshots. (NB: Unfortunately I have no idea if this is actually important, unfortunately, as changed more than one thing before the successful install. It worked though.)
  • If you bought a pre-installed Plug from New IT then you shouldn’t need to change any environment variables before the first boot, so no need to run the first set of setenv commands.
  • I installed Sid (Debian unstable) rather than Squeeze, and so had to force my debconf priority to low before starting the install.

So. Here are those instructions in full:

Format your SD card. If it’s a brand new card (or the first time you’ve tried) you won’t need to this but, due to a number of failed installations, I ended up having to do this quite a lot. I’m assuming you’ve got a Linux machine here, I’m afraid.  I ended up with my 4GB card only showing up as 200-odd MB under Windows a couple of times and couldn’t for the life of me work out how to format it back to its original size. So, assuming you have Linux plug the card in. Modern installations will automount the card in /media. Unmount it (sudo umount /media/XXXX-XXXX) and then run sudo fdisk -l to identify the name of the device (for me it was /dev/sdb). Then run parted, delete all the partitions, and reformat it. An example is shown below:

andy@ubuntu$ sudo parted /dev/sdb
GNU Parted
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: xxxx
Disk /dev/sdb: 16GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End    Size    Type      File system     Flags
 1      32.3kB  15GB   123GB   primary   ext3            boot
 2      15GB    16GB   1GB     extended
 5      15GB    16GB   1GB     logical   linux-swap(v1)

(parted) rm 1
(parted) rm 2
(parted) rm 5
(parted) mkpartfs primary fat32 1s 16GB

Remount the card (sudo mount -t auto /dev/sdb1 /mnt) and download the nightly snapshot boot images (uInitrd and uImage) to the root of the card. Unmount the card (sudo umount /mnt), and stick it in the SheevaPlug.

Now we’re ready to start.

If you still have the Plug turned on and connected to a terminal you can type reset to reboot the device. If not, turn it on and connect with cu as described above. You need to catch it when it says “Press any key to interrupt autoboot” so that you get the Marvell>> prompt.

Next you need to start up the SD card subsystem, and load the disk images that you’ve downloaded:

Marvell>> mmcinit
Marvell>> fatload mmc 0:1 0x01100000 uInitrd
Marvell>> fatload mmc 0:1 0x00800000 uImage
Marvell>> setenv bootargs console=ttyS0,115200n8 base-installer/initramfs-tools/driver-policy=most
Marvell>> bootm 0x00800000 0x01100000

This should fire up the Debian installer.

In my case this did not fire up the Debian installer the first few times. Instead I kept getting the message “Bad magic number”. Lots of googling didn’t really help. In the end I found that reformatting the SD card and redownloading the uInitrd and uImage files to it worked, but it took me a while to get to this point.

Once you’ve got the Debian installer running you need to set debconf to low to ensure you can get the option to install Sid rather than Squeeze. To do this press escape before you answer any questions from the installer, and choose ‘Select debconf priority’. From the resulting menu choose ‘low’. Debconf controls how many questions you get asked as part of the installation. If you set it to critical or high you don’t get asked many questions, but you lose some control. If you set it to low you get asked loads of questions. In this case, we need low so that we can choose the version of Debian to install.

Now choose the first option from the installer menu (‘Choose language’) and follow the instructions on screen. The installer chooses sensible defaults the entire way through, including disk partitioning, so just let it do what it recommends. When you get to choose the mirror to download from choose one that allows you to choose Sid, and select it. Bytemark (a lovely company based here in York) provide all options, so I chose their mirror. Some mirrors do not offer all versions of Debian, so you might have to keep choosing until you find one that does.

At this point you’ll need to wait. And wait. A long time. The installer will ask you a couple more questions, including right at the end which software you want to install (I didn’t choose anything other than the defaults, but make sure you have open-ssh selected). It’s pretty much plain sailing from here.

Once it’s finally finished enjoy your shiney new Debian for a moment, and then restart it (sudo shutdown -r now) so that you can make your installation the default boot.

As it restarts catch it at the “Press any key to interrupt auto boot” again so that you’re back at the Marvell>> prompt. Then type the following commands:

Marvell>> setenv bootargs_console console=ttyS0,115200
Marvell>> setenv bootcmd_mmc 'mmcinit; ext2load mmc 0:1 0x01100000 /uInitrd; ext2load mmc 0:1 0x00800000 /uImage'
Marvell>> setenv bootcmd 'setenv bootargs $(bootargs_console); run bootcmd_mmc; bootm 0x00800000 0x01100000'
Marvell>> saveenv

You should now be able to reboot by typing reset and leave it to boot. It should boot into your debian installation.

If it doesn’t you have two options. Retry this entire blog post from scratch, or start reading around the subject. These two links are the two that got me up and running…

…and it’s worth also looking at the PlugComputer wiki.

Assuming it is working for you it’s pretty simple to get SqueezeCenter installed.

As root (or using sudo if that’s the option you chose during the installation) you need to get MySQL installed:

apt-get install mysql-server-5.1

Then you’ll need to get the SqueezeCenter itself installed. Check the latest version of SqueezeCenter by have a look at the download index. Latest for me was 7.5.1. So, again as root (don’t worry about “Errors were encountered messages”):

debian:~# cd /tmp
debian:~# wget
debian:~# dpkg -i squeezeboxserver_7.5.1_all.deb
debian:~# apt-get --yes install -f

There are (IMHO too detailed) instructions at I ignored much of what was on that page, except for the Install SqueezeCenter section. It’s worth looking at some of the pages that page refers to though, particularly if you’re keen to improve the MySQL performance and increase the life of the SD.