For installing and getting started, check out the new project site including all the documentation – http://pi-ltsp.net
Raspberry Pis are great for schools, they act as a sandbox for teaching kids Linux, electronics (using GPIO pins) and programming using awesome applications like Minecraft Pi or Sonic Pi.
The Raspberry Pi recommended operating system, Raspbian, has been designed to be run standalone and come packaged with just about all you need to get started. Just download the image and stick it on an SD card, simple right?
Simple until you decide to go all in and get a classroom set of Raspberry Pis. Now you have got 20-30 Raspberry Pis, but also 20-30 SD cards to maintain! How do you deal with it if you have more than 20-30 students? Few options.
- Give them each an SD card. This can have a few issues though if all the students in your school will be using them.. 100, 200, 300 SD cards to maintain!?!?!
- Have multiple user accounts on each Raspberry Pi, but make sure none will ever be needed at the same time.
- Just use builtin Pi user on a set of 30 SD cards, pupils save their work to their pendrive. This brings the problem of having to plug a pendrive in at end of every lesson, if you want to save stuff in the class, you also need a (powered) USB hub.
All of the above options are a bit rubbish, there is no single perfect answer.
One big issue though with all of the above is, what if an SD card or pendrive fails?……..
What if? If using any of the above options, it is gone… All that students work is gone, lost forever! This makes none of those options suitable for use with important coursework (GCSE or A-level CS)
At the Raspberry Jamboree last year, this point was brought up. The suggestion was the “magic pendrive”. The Raspberry Pis were configured to dump all the students work onto a special pendrive when it was plugged into the computer. This sounds simple and like a good solution, but when it needs to be done at the end of every lesson, it starts to get a little less viable.
This is what led me to start 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 /home/user on the server.
So why should I use this?
A few reasons
- Centralised operating system – The operating system for the Raspberry Pis is stored on the server, centrally. This means if you want to make a change to it, say update a package or a configuration file, simple, just modify it on the server.
- Centralised users – The user accounts are stored on the server, not the Raspberry Pis. This means any student can sit down at any Raspberry Pi in the classroom, log on and get access to all their files.
- Centralised files – The pupils home folder of all their work is stored centrally. This means only a single folder (/home) has to be backed up, and all the students work is instantly backed up.
- Work collection – Raspi-LTSP contains a simple but effective system for collecting work from students, they just place it in a folder in their home folder called handin. Then the teacher selects an option in Raspi-LTSP and it goes and collects the work from every student, placing it in a single folder for the teacher to mark.
I want to see videos of it in action!
Well lucky for you, Ben Smith (@ManchesterBudo), a computer science teacher based near Blackpool has been trialing the system for a number of months now and has created some videos of it in action.
I am sold! How do I get started?
As mentioned above, a few prerequisites.
- You need a network switch. It must have at least a single gigabit port (10/100/1000mbit), also sometimes called a stacking port. It is fine if the rest of 100mbit (10/100mbit). These can be picked up off ebay for less than £20, example1
A single gigabit port is essential as the server must plug into it.
- You need a classroom set of model B Raspberry Pis.
- You need enough Ethernet CAT5 Ethernet cables to reach from your switch to Raspberry Pis
- An old router or a DHCP server installed on the server machine to manage IP addresses on the network
- A server machine – this can be an old desktop machine, it does not need to have large amounts of processing power, should have at least 2gb of RAM and at least 70gb of hard drive space. You will be formatting this machine. Finally, it must also have a gigabit Ethernet port.
The setup process is very simple, but requires internet to build Raspbian. Once it is finished, it won’t need an internet connection, unless you want to update or install new software.