JustinSteward.com

Linux, Python, devops, etc

Setting up Raspberry Pi and PiCore

10 April 2013

So, I bought a raspberry pi. Why? What am I going to do with it? Well... it will be used:

  • As a small dev/test server to write python, golang, or node.js webapps
  • For downloading torrents (transmission in daemon mode - downloading torrents is totally independent of what laptop I'm using, and whether it's turned on
  • As a simple file server - The sister and the wife can get movies or music from from the Pi without the hassle of passing USB drives around.

It will have a hard drive hooked up to it, and the original plan was to be using Tiny Core for the operating system. This post is a somewhat haphazard documentary on my efforts with Tiny Core. Spoiler alert: I am now using Arch Linux, because as awesome as PiCore will eventually be, and as great as the team are, I don't have the energy to help it get there.

Installing PiCore

Installing PiCore was easy peasy. The instructions Just Worked(tm), although the seem to imply it's a good idea to set up a swap partition on your SD card...

Configuring static home and opt was no different from regular core.

SSH Access

My core won't have a monitor or keyboard when I'm done, so I need to be able to get to it via SSH. I installed dropbear, added the start command to /opt/bootlocal.sh, and we were away.

Added an authorized keys file to ~/.ssh. Success. SSH works.

Problems

SCP was broken. Totally and utterly. In the end, adding symlinks to /usr/bin for /usr/local/bin/dbclient and /usr/local/bin/scp fixed.the problem. Hopefully the extension will get fixed and make this unnecessary soon.

Unfortunately, dropbear ignore the fancy ~/.ssh/config file that I've built up over time.

Git

tce-load -i git

Thanks to dropbear not supporting any sort of client side config, or even an ssh agent, git takes a little bit of configuring to work.

$ cat /home/tc/.local/bin/ssh-keys.sh
#!/bin/sh
# wraps ssh with all of our keys

ssh -i ~/.ssh/git.id_rsa -i ~/.ssh/jls.id_rsa $@
$ export GIT_SSH=/home/tc/.local/bin/ssh-git.sh # make sure to add this to ~/.ashrc or some such

Not nearly as good as openssh's config file, but at least it works.

Transmission, Samba, missing packages...

None of these have been packaged for piCore yet. We have the wonderful import.tcz utility now, can convert a deb to a tcz extension, but it seems to generate a lot of unnecessary extensions - Dependencies that are flat out not needed in Core, such as selinux, or packages that are already built as tcz.

The import process is also not perfect. SVN has a missing library that I can't (be bothered to) resolve, for instance.

So, first things first, I need to compile a few other packages. Subversion and it's dependencies are first. Hopefully I can contribute a lot of my work, and get some of the tools in place for more packages to be built within Core itself! Unfortunately, wget needs to be fixed before I can make it much further.

USB Hard Drive

NTFS-3g seems to have installed just fine using import.

Unfortunately, the hard drive just draws too much power, and the Pi has a fit. I needed to put a powered USB hub in the mix. At which point I worked out that fuse support is missing in picore's kernel. No problem, reformatted the drive with ext4 instead. The drive seems to be working flawlessly.

August Update

After all that, the Pi spent a couple of months sitting around doing nothing because I couldn't find the energy to compile all the missing pieces. I replaced PiCore with Arch Linux, and everything just worked. As much as I love the philosophy behind Tiny Core Linux, right now I'm enjoying a simpler, slightly less hands on approach to my operating system.