Posts: 74
Joined: Fri May 11, 2012 10:27 pm

Cotswold Raspberry Jam's custom Raspbian image

Fri Apr 29, 2016 10:13 am

Here at Cotswold Raspberry Jam, I create a custom Raspbian image before each event, pre-loaded with all the files needed for our tutorials, WiFi set up for the venue and a few other features that might be of interest.

Notably, on the first boot (and only the first boot), we automatically expand the filesystem and set the hostname to rpi-XXXX where XXXX is the (hopefully unique within the event) last four digits of the SD card's CID serial number. That means we can address any Pi in our classrooms over the network using Zeroconf/Avahi hostnames rather than having to know individual IP addresses. Very helpful for transferring files when a child asks "can I take my Python / Scratch scripts home with me?", or if a pupil has somehow managed to delete both the working and backup copies of the tutorial files (ye Gods, the backup files are read-only, how do they accidentally manage that?).

We've also cut down the image size (1GB zipped, 2.9GB uncompressed) and made a few choices about packages to delete (no prizes for guessing) and extra ones to add.
Andrew Oakley - Cotswold Raspberry Jam, Gloucestershire -

User avatar
Posts: 2737
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: Cotswold Raspberry Jam's custom Raspbian image

Fri Apr 29, 2016 1:20 pm

Looks like a good piece of work.

Have you looked at PINN - my fork of NOOBS?
It directly supports my noobsconfig package which was designed to apply customisations to an OS as it is installed. It is especially designed for the sort of thing you are doing.

You will have spent a lot of time customising Raspbian for this. But next time there is a new release of Raspbian, you may have to do it all again (or you could apt-get upgrade I suppose).
NOOBSconfig is a way of separating your customisations from the OS image so you can update the image and apply the customisations to the latest image. It also avoids you having to mess about with creating your own custom OS for NOOBS involving xz comrpession etc.
PINN will install the latest Raspbian image, then customise it using some simple file additions to add all the tutorials, wifi settings etc.
Being based on NOOBS, if the student really messes up their Raspbian image, you can start again very easily using the NOOBS recovery system to reinstall your customised image again, without resorting to removing the SD card and re-imaging it on a PC.
PINN also allows the OS to be installed from USB stick, so you could have a master USB stick (or several) which is passed around the students to install from, thus saving space on the SD card.
It can also install your 'run-once' on boot scripts to do any of your final customisations like setting hostname or ip address based on serial number, or any apt-get installations.
In fact Meltwater has produced a whole infrastructure of scripts for noobsconfig that you could make use of on his PiKitchen webpages.

Of course, if you want to reduce the size of your downloaded images by removing packages, it won't help with that - you will still have to remove them first and create a new image. It could however, do an apt-get purge etc on first boot so at least it frees up some SDcard space after installation
But if you do want to change your customisations, such as add new tutorials etc, you only have to distribute the customisations, not the whole of a new image, so that would gain you some download bandwidth/time.
Plus, you could separate your customisations into different packages (or "Flavours" as noobs calls them) so you can just install what you need on top of the standard Raspbian, so perhaps some customisations for the Cotswold Jam, another set for a Code Club, another for a different set of tutorials on python compared with scratch...? etc. Then you only need to carry one standard image around plus your smaller customisations, rather than a complete image for each different custom installation.

Of course, you may not consider this suitable, or want to redo all your hard work! But I put it out there as another option, and for others who may want to do similar things.
PINN - NOOBS with the extras...

Posts: 722
Joined: Sun Apr 17, 2016 4:00 am

Re: Cotswold Raspberry Jam's custom Raspbian image

Sat Apr 30, 2016 2:25 am

PINN versus a hand baked Pi image? The Cotswald approach is what I use for new projects. The PINN approach does not automatically delete stuff. Hand baking wins for me.

Speaking of NOOBS, I have not found a single advantage of NOOBS over a straight download of Raspbian. If NOOBS had more installation questions and options, I would use it. An old distribution of Linux used to ask:
Do you want a print server?
Do you want a Web server?
Do you want Windows with that?

I suspect that would be the best way to go with an enhancement to NOOBS. Customising for training courses is a bit more complicated. As an example, I tried to use some network related software. I had to install new software, delete conflicting software supplied in Raspbian, and change some config files. The process worked only when every change was in the right sequence.

Plus the people using the system have to know the changes. It is often easier to step them through the changes so they understand.

Andrew, what age are your youngest students?

I successful taught an 8 year old to use Tux Paint but not a 5 year old. The 5yo tended to type, enter, then read what he typed. I did not show him commands starting with:
sudo rm -r

User avatar
Posts: 1015
Joined: Tue Oct 18, 2011 11:38 am

Re: Cotswold Raspberry Jam's custom Raspbian image

Sat Apr 30, 2016 7:08 am

If space is an issue then we could make PINN or PiKitchen work with the cut down version of Raspbian.

After-all if you have scripts to install what you wanted then no-one would need to have a "and the kitchen sink" image we currently have. Just start with a common small image and customise it to include only what is wanted.

As for the menu asking what features you want to have...well you can setup up PiKitchen to provide a selection of setups (flavours) which you pick from the NOOBS menu, and those within the PiKitchen can be any combination of components (recipes) you would like. Want a web-server, include that recipe in a flavour...want a one-wire temperature sensor with the server...add the recipe...want that running on start up displaying the temperature on the network...add the recipe. No reason why it "could" be possible to build and configure the flavours within NOOBconfig if there was need.

Easy to trigger NOOBS to automatically select one of those flavours and install on first power up. SO we have the easy setup solution for events...
Include flavours which will automatically run a display or demo right off the automated the first power up, and you have demos sorted!
Would love to see flavours/setups, where you have a full tutorial pop-up after the install and takes someone through the workshop at their own pace.

I even requested NOOBs could be asked to install several at a time, so you could switch between multiple setups within the same card (again more practical if built from a small image). Even better if using PINN as you wouldn't need to carry the recovery images along with it too (setup via USB/network).

I would consider PiKitchen as an experiment to see what could be done with minimal adjustments to the base NOOBS and the NOOBSconfig script... It is always so nice to have your whole system setup and ready to go (network shares, wifi settings, drivers etc etc) just by transferring to the card. I tend to forget that everyone seems to do this every time they install a new release!

PINN can be built to go much further, and be built to make the features user-friendly, if there is support...
A Magazine for Raspberry Pi Users
Read Online or Download for Free.

My new book:

Meltwater's Pi Hardware -

Like the MagPi? @TheMagP1 @TheMagPiTeam

Return to “Raspberry Pi OS”