Posted by Kevin Hanson | Posted in Linux, Technology | Posted on 18-12-2009-05-2008
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:
- What operating system am I going to run?
- 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.
Fire up your terminal program. Change your directory to /dev/ with the following:
Then list the contents of the folder with this command:
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:
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.
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:
- Download and unpack the Sheevaplug Installer package (I am assuming you are on the same ubuntu box that was mentioned earlier)
- Find a 256MB or bigger flash drive, and format it to FAT16 or FAT32.
- 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.
- On the
- 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.
- 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)
- Safely remove the flash drive from your host PC and stick it in the Sheevaplug.
- On the host PC, open two terminal windows.
- 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.
- In the second terminal, change to the “sheevaplug-installer-v1.0″ folder created after unpacking the sheevaplug tar.gz file.
- Make sure you have php5-cli installed by typing
sudo apt-get install php5-cli
- You should be good to go. Now type
sudo php runme.php nand
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
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
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:
### BEGIN INIT INFO
# Provides: wait4usbdisks
# Required-Start: checkfs
# Default-Start: S
# 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!"
echo "Done napping!"
So here’s a few steps to getting this script to execute when the plug boots up.
- Install rcconf with
apt-get install rcconf
- Copy the above script and save it in the /etc/init.d/ folder.
- Make it executable with
chmod +x your-script-name
- Scroll down and add a check-mark next to your script.
- 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 18.104.22.168. Here are the steps to upgrade the kernel.
- On the linked page above, go to the folder for the newest kernel.
- There will be a bunch of files there, and you 0nly need the one that ends in “*uImage”
- Copy the link to download that file.
- On the sheevaplug,
- Download the most recent kernel version with the following command:
will display your current kernel version.
will display where “uImage” is it. Should be mtd0.
- 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
- Then do
- Then do
nandwrite /dev/mtd0 uImage
- Remove the file you just downloaded with
- Upon reboot, run
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!
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!