looking into a better way.
The better way
At the time I watched the Jamboree panel, I had been playing around with LTSP (Linux Terminal Server Project).
It is a project that brings together a number of base packages from the Debian/Ubuntu software repositories plus a pile of custom scripts, to create a system that allows full Linux clients to boot off a network, aka not using the machines own hard drive. It supports 2 main types of clients
- Thin clients – These are clients that are basically dumb terminals into the server, no processing is done on these clients, all processing is done on the server. For Raspberry Pis this would for example let you run non Raspberry Pi software, or operating systems (like Ubuntu) but does not have access to Raspberry Pis GPIO or camera port, it also requires a powerful server for a classroom. A client for the Raspberry Pi already exists, called BerryTerminal
- Fat (/thick) clients – These are clients that just really use the server as a hard drive. All the processing is done on the Raspberry Pis, you have full access to the GPIO pins and camera port, but are stuck with the usual Raspbian OS. It also does not need a powerful server.
At the time when I was looking into this, there was no instructions for using LTSP with Raspbian fat clients or Raspberry Pis in general as fat clients.
After plaguing some developers in the LTSP IRC channel, we eventually figured out how to get LTSP to build clients for the Raspberry Pi. Then started the long laborious process of properly building Raspberry Pi Raspbian OSs.
How hard could building Raspbian be?
In short, quite…
The Raspberry Pi foundation make a lot of changes to a default Debian build… They do this through a tool called spindle by Alex Bradbury. The main issue for me with Spindle is it contains a lot of unneeded stuff for my system, seeing as LTSP does a large chunk of the build. I also didn’t want all the changes they made, mainly because some broke LTSP so had to be careful what a picked.
By the 25th February, 2014 (just in time for the Raspberry Jamboree) I had got a rough basic clone of Raspbian working, this wasn’t enough though, as the system had to be easy and complete as many tasks a teacher would need as possibly, with a press of a button.
So then new features like full Epoptes integration, Picontrol integration, NBD compression, student work collection system, auto installing software and a few others were added.
This brings us to the stage we are at now, a stable (ish) usable system designed to be easy to use for teachers.
Yeah, but how does it work?
It actually isn’t too complicated.
Few prerequisites though.
- Raspberry Pi is connected to the server via a switch or network hub
- A router handling IP addresses (DHCP) is on the network or you set one up on the serverThe
- Raspberry Pi has the boot files on its SD card, these are autogenerated when the server installs Raspi-LTSP and are tied to the servers IP address.
- Raspi-LTSP is installed on the server and the server is turned on.
As long as all those are met, then the below sequence of events should occur
- When powered on, the Raspberry Pi loads the kernel, initrd, cmdline.txt file and config.txt file
- Kernel reads the config options and loads the initrd.
- An initrd (also known as an initramfs) is a simple, very small Linux filesystem used to chainload other filesystems, in our case a filesystem over the network
- The LTSP scripts in the initrd grab an IP address and try and contact the server
- If successful, it mounts the Raspbian filesystem off the server, as COW (Copy on Write)
- Copy on Write is a special setup that is similar to read only, but the OS is able to change the files. When it reboots though, these changes are lost.
- Once mounted, it runs some more LTSP scripts to finish setting up the client. These include setting up NBD swap. This is compressed swap in case the Raspberry Pi runs out of RAM.
- Finally LDM (LTSP Display Manager) loads up, allowing the user to log in
- Once the user logs in, their home folder is then mounted. Their home folder is stored at /