Guide: Setting Up Your Sheevaplug to be the Ultimate Low Power All-Purpose Server

Posted by Kevin Hanson | Posted in Linux, Technology | Posted on 18-12-2009-05-2008

17

title-plug2

Before I dig into the guide, it’s best to briefly explain what the Sheevaplug is. As computers have gotten faster and faster and cheaper and cheaper over the years, the focus has shifted from being “the fastest” to being “good enough.” Take a look at the Intel Atom chip. It has flooded the market, and it seems like airports are now more filled with netbooks than they are with traditional laptops. The atom is fast enough for most people, and it uses very little power, enabling the devices to be much smaller and use way less battery. This low power technology translates extremely well into the home server or electronic appliance world. More and more of the devices in our household are becoming connected, and we need low power chips to help connect that world. What if you could have a server so small that it was only slightly bigger than a traditional wall wart plug? Marvell had this idea, and they came up with the concept of Plug Computing. Plug Computing means taking a a barebones PC with a low powered Marvell ARM CPU and sticking it inside of a “plug” and then letting companies / users explore the possibilities. There have been a few pre-packaged offerings like TonidoPlug (or you can set up Tonido on your Sheevaplug!), PogoPlug, and a few others. The Sheevaplug is a development unit that people can buy, and it’s great fun to play around with! I’ve been able to turn it into a NAS, a music server, and a few other things, all at the same time! Read on to find out how to get this thing set up for the first time.

A quick disclaimer: There are MANY ways one can set up the Sheevaplug. There are a multitude of available operating systems, different ways to install them, different places to install the OS (flash v. SD v. USB), etc etc etc. This guide covers the way that I chose to do things, and it will hopefully make someone’s life easier when setting this device up. Please sound off in the comments if you have suggestions for this guide, and I’ll happily update it to make it easier to understand!

So before you even get started there are a couple design choices you need to make. They are the following:

  1. What operating system am I going to run?
  2. Where am I going to install it?

Let’s tackle question 1. The Sheevaplug comes by default with an installation of Ubuntu Linux 9.04 on it. There are a couple problems with Ubuntu for the Sheevaplug (I LOVE Ubuntu for netbooks and laptops btw). First off, Ubuntu has decided to discontinue support of the ARMv5 processor. So if you want to have the newest packages available to you as they are released, you better pick another OS. The second issue is that its default install size is a bit large on the Sheevaplug, and there isn’t a whole lot of room to install anything. While a few operating systems out there support the device, my OS of choice is old faithful, Debian Linux. Debian is extremely reliable and stable as an OS and is used on many servers in major corporations. Futhermore, its install size can be ratcheted down a bit more than Ubuntu’s. It has a huge selection of packages available, and it will suit us well in the quest to get our home server set up.

Question 2 – Where to install Debian? If you head over to the Plug Forums, you’ll find a fair amount of debate over this issue. You have the following three options:

  • Internal Flash
  • SD / SDHC Card
  • USB Drive

They all have advantages / disadvantages, but I chose internal flash. The main limitation of internal flash is that the Sheevaplug only comes with 512MB of it. Given the prices of flash these days, tiz a darn shame it didn’t just come with 1GB! I have a feeling WAY more people would choose the internal flash if that were the case. On the flipside, it’s extremely fast, and I don’t have to have an SDHC card hanging out the side of the device!

So, we know our path… We need to install Debian Linux on the internal flash of a device which has no monitor. FUN!

Speaking of no monitor, the Sheevaplug has a mini-USB port, and you can plug that into a host computer. Using a serial terminal, you can call up the sheevaplug and get a “virtual monitor” of sorts on your host PC. You get the same effect by SSHing into a computer, but you can’t SSH into a computer until it is booted up. The serial terminal allows you to see all of the output on the screen, including U-Boot output (without getting into too much detail, U-Boot is the equivalent of a BIOS on the Sheevaplug). There are ways to get the serial terminal working in Linux, OS X, and Windows, but I find it very easy to just use the standard install of Ubuntu. If you’re running Windows or OS X, I would recommend virtualizing Ubuntu with VMWare or Virtualbox (free) and then making sure USB devices are set to route to the VM, rather than the host system. Otherwise, this wiki describes other ways to tap into the Sheevaplug. Plug your Sheevaplug into an electrical outlet. It will automatically boot up. So assuming that you’re on Ubuntu, plug the mini-USB cable into the Sheevaplug and the other end into your PC. The sheevaplug should now show up in /dev/ on your system.

globalscale

Fire up your terminal program. Change your directory to /dev/ with the following:

cd /dev/

Then list the contents of the folder with this command:

ls | more

That should list everything in there, letting you hit a key to scroll through them. You want to find the device that starts with ttyUSB*. Mine was ttyUSB0, but in the wiki I link to above, they show it as ttyUSB1. Assuming yours is ttyUSB0, then type the following:

screen /dev/ttyUSB0 115200

Your terminal window should go blank for a second, and i’ve found that you might have to hit Enter a couple times, but you should be seeing the output of your sheevaplug! If you are starting with a brand new Sheevaplug that hasn’t been modified yet, you’re probably going to see the Ubuntu login screen. Log in just for fun. User: root Pass: nosoup4u . Call me easily impressed, but at this point I was already having fun. Crazy to see that this little “plug” has a full blown linux installation on it. Enjoy the Ubuntu installation while you have it, because now that we have a valid connection, we’re going to blow it away.

plugside

There is a utility called the Sheevaplug Installer, and it is designed to restore the Sheevaplug back to its original configuration. We’re going to use that utility, but we’re going to modify it slightly before use. Instead of using the default file system package it expands and places on the device, we’ll use a Debian package. MANY thanks go out to mgillespie of the Plug Forums in making this alternate Debian package freely available to everyone. So download the Sheevaplug Installer and open up the tarball. You could read through the readme, but instead, just do the following:

  1. Download and unpack the Sheevaplug Installer package (I am assuming you are on the same ubuntu box that was mentioned earlier)
  2. Find a 256MB or bigger flash drive, and format it to FAT16 or FAT32.
  3. Copy the contents of the “installer” sub-folder of the newly created “sheevaplug-installer-v1.0″ folder to the flash drive. Once again, just copy the contents of that subfolder, NOT the entire subfolder.
  4. On the
  5. Go here to find the link to download mgillespie’s pre-packaged Debian Squeeze rootfs.tar.gz file. The forum post has a link to a mediafire page. Click the Debian-Squeeze folder and then click the rootfs.tar.gz file to download it.
  6. Take the newly downloaded rootfs.tar.gz file and REPLACE the old one on your USB flash drive (i.e. we’re replacing Ubuntu with the newest version of Debian)
  7. Safely remove the flash drive from your host PC and stick it in the Sheevaplug.
  8. On the host PC, open two terminal windows.
  9. In the first terminal window, if it’s not already open, use the “screen” command mentioned earlier to view the output from the Sheevaplug. Make sure that’s working.
  10. In the second terminal, change to the “sheevaplug-installer-v1.0″ folder created after unpacking the sheevaplug tar.gz file.
  11. Make sure you have php5-cli installed by typing
    sudo apt-get install php5-cli
  12. You should be good to go. Now type
    sudo php runme.php nand
  13. Watch….

At this point, you’ll see some messages on the terminal screen about writing to the plug and yadda yadda. Eventually this will finish and then you look at your Sheevaplug serial terminal output. It really only takes a couple minutes for the file system to completely write to the plug, and soon you’ll have a fresh working install of Debian! You should be able to log in with the same root/nosoup4u user/pass combo as before. Change the password.

You no longer need to use the serial terminal. You can just SSH into your device now with its IP address. I like to use DHCP Reservations on my router to make sure that my Sheevaplug always gets the same IP address. You can set this up with its MAC Address.

So the first thing you’ll probably want to do is set up a USB hard drive and plug it in. Whether you’re setting up a NAS, a Squeezebox Music Server, or some other network device, you likely want some type of storage. So partition your drive how you like. You can keep a bit of the drive for swap space if you like. The Sheevaplug typically runs fine without swap, but I added a bit of swap space just to be on the safe side. So I have a 500GB drive that is partitioned in the following three parts:

  • sda1 – 2GB swap space
  • sda2 – 100GB music partition
  • sda3 – rest of the drive – nas partition

Subsequent articles will cover the nitty gritty of setting this up as a music server and NAS, but that’s how I wanted the partitions divided up. In order to get them properly mounted upon boot, I needed to modify my /etc/fstab file. I won’t go into the details of that here, but there is a good guide here. After setting my /etc/fstab file, i ran

mount -a

to make sure everything was properly set up. Worked like a charm! All my drives were mounted. Time to reboot to give it another test. The system rebooted, and I was surprised to see my drives were not mounted. Tried another

mount -a

and all of my drives were mounted again. wtf? Why weren’t they automatically mounting like they should? Well, once again, I owe huge thanks to another plug forum member, restamp. He diagnosed the problem and found a solution. Turns out that due to the speed of the internal flash of the Sheevaplug, it boots up “too quickly,” and the USB drives aren’t able to initialize in time to be mounted! He wrote an elegant script to wait until the USB drives are mounted before continuing the boot process. I couldn’t quite get his script to work, and as I am just learning shell scripting, I decided to try and make my own :-) . Mine is less elegant as it just waits for a static period of time, but it works! Feel free to use any of the scripts on the forum page I linked to or you can try my less elegant solution below:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          wait4usbdisks
# Required-Start:    checkfs
# Required-Stop:
# Should-Start:
# Should-stop:
# Default-Start:     S
# Default-Stop:
# X-Interactive:     true
# Short-Description: Delays boot to ensure USB disks are connected.
### END INIT INFO
echo "Taking a 10 second nap for USB devices to initialize!"
sleep 10
echo "Done napping!"

So here’s a few steps to getting this script to execute when the plug boots up.

  1. Install rcconf with
    apt-get install rcconf
  2. Copy the above script and save it in the /etc/init.d/ folder.
  3. Make it executable with
    chmod +x your-script-name
  4. Run
    rcconf
  5. Scroll down and add a check-mark next to your script.
  6. Reboot! All your drives should be properly mounted.

And there’s one LAST thing to do before having a nice, fast Debian installation on your Sheevaplug with all your drives mounted. It’s a good idea to upgrade to the most linux recent kernel. Luckily, that’s the easiest step yet! You can get the most recent version of the kernel here. At the time of writing, that’s 2.6.32.1. Here are the steps to upgrade the kernel.

  1. On the linked page above, go to the folder for the newest kernel.
  2. There will be a bunch of files there, and you 0nly need the one that ends in “*uImage”
  3. Copy the link to download that file.
  4. On the sheevaplug,
    cd /mnt/
  5. Download the most recent kernel version with the following command:
    wget http://the-path/to-the/new-kernel/location/sheeva-x-x-uImage
  6. Entering
    uname -r

    will display your current kernel version.

  7. Then
    cat /proc/mtd

    will display where “uImage” is it. Should ┬ábe mtd0.

  8. I’m not sure if this step is necessary, but I like to rename the newly downloaded file to uImage, just to be consistent. You can do that with
    mv sheeva-x-x-uImage uImage
  9. Then do
    flash_eraseall /dev/mtd0
  10. Then do
    nandwrite /dev/mtd0 uImage
  11. Remove the file you just downloaded with
    rm uImage
  12. Reboot!
  13. Upon reboot, run
    uname -r

    to make sure that you’re now running the newest kernel version!

Also, I cannot take credit for the easy steps above. Thanks again to plug forum member, snake, for outlining how easy it is to upgrade the kernel!

Well, if you have gotten this far, you now know how to get your Sheevaplug set up and running Debian linux with the most recent kernel and a USB disk with automatically mounted partitions. From here, the doors really are wide open. You can turn it into a NAS. You can make it a Squeezebox Server for your music (article on this coming soon! UPDATE: here’s a guide I JUST wrote about keeping your music on your server in sync with your Mac or PC). The possibilities really are endless. This is such an elegant, low powered device. I think the idea of Plug Computing really is brilliant. I hope more manufacturers embrace the idea and come out with innovative products. Until they do, the door is wide open for geeks like us to make them ourselves! Enjoy!

myplug

Also, if you are a fellow plug computer user, and have any suggestions for modifications to this guide, please add a comment and I’ll do my best to update this to make it even more clear. Above is a picture of my Sheevaplug, currently acting as a NAS and Squeezebox Music Server. Thanks for visiting!

BTW, Tuxradar has a good, short review of the Sheevaplug. You should check out their podcast. I find it to be the only good Linux podcast out there. Of course, I bet they hate me because I listen to it on an iPhone / MacBook Pro :-) . And for more pics of the sheevaplug, check here!

Comments posted (17)

Okay, that is just awesome. Now there’s another project I’d like to do!

@HunterSFO
It is VERY awesome!!! I’ll be posting cool future articles about things I’m doing with it!

[...] I’ve switched from the Thin Client to the Sheevaplug, one of the coolest pieces of technology I’ve played with in a while! Check out my …. Also, keep checking back for new posts. I’m going to make more about how to keep your [...]

[...] Pavilion, likely to showcase all of the great things that people are doing with Plug PCs like the Sheevaplug, Tonidoplug, and Pogoplug. I really think that a Plug PC has the capability to take over the home [...]

[...] you have read some of my recent posts about setting up a Thin Client or Sheevaplug to act as home server, capable of distributing music across the house with Squeezebox Server, [...]

[...] with the theme of recent Sheevaplug related articles, here’s a post about a new, interesting piece of software called Tonido. Tonido advertises [...]

In your description of how to modify the Sheeva Plug Installer, item 4 on the list simply reads “On the”! Perhaps you could let us know what this step should be.

But *very* impressive, this is definitely going to be my next project.

Pete

I believe the right command in step 10. is “nandwrite -p /dev/mtd0 uImage”, otherwise you might encounter an error while writing to flash :)

Other than that, keep up the great work with very useful manuals.

Hi Kevin,

great project! I’m really interested to know how you got the Squeezebox Server running on the plug. I’m trying to get it to run on an NSLU2 and not having a lot of luck. The 32MB of RAM the NSLU2 has is simply not enough, wonder if you have any insight on this.

Cheers,
Martin

Nice guide, my only comment would be to not use VMWare or Virtuabox on Windows, as the timing of the USB emulation means the SheevaInstaller rarely works and it causes many more problems that it solves. A far better bet for Windows users is to download the Ubuntu distro and do a WUBI install, it integrates a proper non-vm Ubuntu with the Windows bootloader, and there is no partitioning required (the Ubuntu partition lives as a single file on your Windows system).

http://wubi-installer.org/

You don’t need to do anything special for a Wubi install, download Ubuntu desktop ISO burn it to a CD, and put it into your Windows PC, it will offer up a Wubi install.

I find SheevaPlug very nice device, but I don’t know if you already read the news about new device called Marvell Plug Computer 3.0 . As soon as they publish the price and all hardware info, I think I decide to buy the new one (more powerful)

Hello,
thanks for your nice How-To. I just have two remarks to make life even more easier:
When using a Ubuntu 9.04 as host you may get an error when runing the sheevaplug installer: “openocd/openocd: error while loading shared libraries: libftdi.so.1: cannot open shared object file: No such file or directory”
Then you need to install libftdi1 (apt-get install libftdi1) and everythings works fine.
And when updating the kernel there is an even easier way: On the page with all the kernels are installer scripts e.g. README-2.6.32.9
Just do the following on the plugs terminal(replace 2.6.32.9 with the version you want to install):
wget http://sheeva.with-linux.com/sheeva/README-2.6.32.9
chmod +x README-2.6.32.9
./README-2.6.32.9 –nandkernel
Then reboot und check the version.
Regards

Just curious if the sheeva plug or any of these plug computers can run a vmware internally or wine so that i can use it as a magicjack portal all the time? or if i can install one of my copies of xp on it

Interested in the reponse to Vincent’s question about magicjack

Vincent, have you research tonido plug?

What are the advantages of using Debian over Ubuntu for the Sheevaplug?

debian seems to be smaller footprint in flash memory, it is also more up to date with suport for the ARM processor.

Ubuntu has stopped supporting the ARMv5 Commands in later versions of ubuntu so 9.04 will be the last version for the sheevaplug.

I am running Debian Squeeze (6) on the sheevaplug, and there are discussions about getting Debian 7 on the plug!

Mine running debian also boots in about 18 seconds and reboots in 24 seconds, rather than 2+ minutes on ubuntu!

Write a comment