Installing Debian Squeeze on the Sheevaplug

The Sheevaplug is an embedded computer system using a 1.2 GHz Marvell Kirkwood 6281 ARM-compatible CPU (aka Feroceon) with 512MB RAM, a USB 2.0 port, an SD card slot, USB serial terminal, and an ethernet jack. You can get one from Globalscale (for $99 at the time of writing). Unfortunately, by the time I recieved one of these lovely devices, the default installation of Ubuntu 9.04 had elapsed its support life, and further, Ubuntu seems to have dropped arm support all together. Unfortunate, as I could not update or install software from apt.

ESIA is the Enhanced Sheevaplug Installer Application and is available here. It is free software. ESIA is a GUI for installing linux distros to the sheevaplug.

This tutorial aims to solve that by installing Debian and a few other software packages to make this sweet little computer sing.

This tutorial assumes that you have the JTAG driver installed on your host platform. Without the right driver, your computer won’t be able to see the USB serial connection the Sheevaplug makes available. That is a simple enough matter to sort out that I’m not going to explain it here.

Necessary packages

  1. gitolite to host git repos
  2. samba to share files

Design considerations

  1. Low power: sheevaplug uses ~5W, that’s why I like it!
  2. Sheevaplug comes pre-loaded with out-of-date Ubuntu: Use ESIA project to flash Debian Squeeze
  3. Sheevaplug has limited disk space: Mount external USB disks at boot.
  4. Debian Squeeze implementation of gitolite makes user’s home directory at /var/lib/gitolite. Change the gitolite user’s directory to the external drive.
  5. Write system glue in bash to check if the external drive (check for existence of file on external drive) is mounted; remount if not mounted.

Wish List

  1. btrfs support so I can mirror disks on my multi-disk (but not RAID) external drive. (Didn’t seem well supported on Debain squeeze arm at the time of writing)

Install ESIA

  1. Download the application from the sourceforge page.
  2. Install ESIA. I’m on Debian, so I do sudo dpkg -i esia.deb

Install Putty

  1. Install putty: sudo aptitude install putty

Accessing the Sheevaplug via USB-Serial

  1. Plug in the Sheevaplug
  2. Connect your PC to the Sheevaplug via the supplied USB cable.
  3. Open putty.
  4. In the putty configuration window, select the serial connection.
  5. Set the Serial Line to /dev/ttyUSB0.
  6. Set the Speed to 115200.
  7. Save the settings as a session, as you will need to access the plug via serial connection later.
  8. Click open. You should see a command prompt. You are now connected.

Using ESIA to Flash a New Boot Loader

  1. Connect to the Sheevaplug via USB-Serial.
  2. Reboot the Sheevaplug.
  3. After reboot, press any key to interrupt the U-boot process. You should see the U-boot prompt: Marvell>>.
  4. Open ESIA with root permission.
  5. Click on the Sheevaplug. Click Reflash Bootloader. ESIA 2.0.5 has a default bootloader for the sheevaplug, version x.x.19 (ESIA told me the flash failed, but I waited 10 minutes, closed ESIA, re-connected via USB-Serial, and everything was fine). You may also enter a MAC address at this time. There is a MAC address listed on the device label of your sheevaplug.
  6. Close ESIA.
  7. Reconnect via USB-Serial.
  8. Boot into U-boot.
  9. At the U-boot prompt enter resetenv reset The system will reboot. (I was getting an error after flashing the new uboot, and it took me forever to track down the resetenv command)
  10. Interrupt the U-boot process. You’ve successfully flashed a new version of uboot.

Preparing the USB Disk-on-Key

  1. Obtain a USB flash drive. Out of my many, many (apparently cheap) flash drives, only one worked. Your milage may vary.
  2. Format the USB drive to fat32
  3. Download a distribution from the ESIA home page (I choose Debian, there are several other distros one the home page).
  4. Untar the distro to the USB.

Using ESIA to install Debian

  1. Open ESIA
  2. Choose the MAC address of your sheevaplug in the GUI
  3. Highlight Debian in the Applications list, then click Select.
  4. Remove the USB DOK from your computer and put it in the Sheevaplug.
  5. Click Install to NAND to install Debian to the internal flash memory of the Sheevaplug.
  6. Click Install and get a cup of coffee while it installs.

Quick Debian Essentials Setup

These are not requisite, but I recommend using a static IP address if you want to have any success running gitolite (described later).

  1. Set a static IP by editing /etc/networking/interfaces.
  2. Set the hostname by editing /etc/resolv and /etc/hostname
  3. Install SSH and rsync: sudo apt-get install openssh-sever rsync
  4. Probably not a bad idea to update the system now: sudo apt-get update && sudo apt-get upgrade

Adding External Drives at boot

I am running into the problem described here: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=583954 to get around it either re-tool the initramfs described here http://ubuntuforums.org/archive/index.php/t-1021719.html (I can’t find the initramfs script in the ESIA debian application) or add mount -a somewhere near the end of the init boot sequence.

  1. Gain root permissions.
  2. Get the UUID of the disks to mount. ls /dev/disk/by-uuid
  3. Edit /etc/fstab and add: UUID=< uuid of disk > <mount point> <file system type> nosuid,auto,nofail 1 3 ## Need to find a way around nofail option
  4. Add command mount -a at the proper place (near the end) of the init boot script to mount disk (this is the problem related to the nofail option).

Installing and Configuring samba for LAN File Sharing

  1. Gain root permission: su - Enter the root password
  2. Install Samba apt-get install samba smbfs
  3. Edit /etc/samba/smb.conf and share the desired folders.

Installing and Configuring gitolite for GIT Hosting

  1. Gain root permission: su - Enter the root password
  2. Install gitolite apt-get install gitolite
  3. Put an RSA pub key on your server, at /tmp/id_rsa.pub (for example).
  4. To initialize gitolite, enter: sudo -H -u gitolite gl-setup /tmp/id_dsa.pub
  5. To test the installation, clone the admin repo: git clone gitolite@ip-addres:gitolite-admin.git If the repo clones over, your installation is successful.

The debian package for gitolite creates a user, gitolite, with a home directory of /var/lib/gitolite. Since the sheevaplug only has 512 mb of system space, /var/lib/gitolite does not have enough space to hold all of the desired git repos. To solve this problem, change the gitolite user’s home directory to the external drive mounted earlier.

usermod -m --home /path/to/gitolite gitolite

where -m moves the files currently in the home directory.

The End!

Now you should be ready to enjoy your sheevaplug with some up-to-date software! I know I am. Since I decomissioned my old file sever in favor of the sheevaplug, my electricity bill has gone down about $10/month!