Prepare a Raspberry Pi Image for a Kiosk Project

2015-09-25 20:36

I'm playing around with different Raspberry Pi images to use as a base for a kiosk project I'm working on. So far I have created a prototype that works fine and now I'm working on creating a custom image for further development of the project. This is the first post with notes on that endeavour.

The goal is to create a small image with up to date software that is suitable to use as a platform for kiosk projects.

Initial setup

Download, extract and write minibian to an SD card. (I'm using this to get a minimal image as a starting point. I could as well make use of the official Rasbian image if I didn't need to keep the size down.)

Boot and login with default root and password raspberry.

Manually resize the SD card. There's no swap partition so just delete partition 2 and re-create it to fill the SD card, reboot and resize according to the guide.

Update base system

Tell APT to keep installs at a minimum by writing the following to /etc/apt/apt.conf:

APT::Install-Recommends "0";
APT::Install-Suggests "0";

Update /etc/apt/sources.list with additional keywords. Should now look like:

deb http://mirrordirector.raspbian.org/raspbian wheezy main contrib non-free rpi
deb http://archive.raspberrypi.org/debian wheezy main

Update package collection and update system:

apt-get update
apt-get dist-upgrade -y

Upgrade to Jessie

Upgrade to jessie. Replace wheezy with jessie in /etc/apt/sources.list so it looks like:

deb http://mirrordirector.raspbian.org/raspbian jessie main contrib non-free rpi
deb http://archive.raspberrypi.org/debian jessie main

Then run the upgrade:

apt-get update
apt-get dist-upgrade
apt-get autoremove
apt-get clean

Install the Raspberry Pi firmware updater and run it:

apt-get install rpi-update
rpi-update

Reboot to activate the new firmware.

Setup default user

Add sudo:

apt-get install sudo

Create default user:

useradd --create-home --shell /bin/bash --groups sudo kiosk
passwd kiosk

Disable root login with SSH by changing PermitRootLogin to no in /etc/ssh/sshd_config:

...
PermitRootLogin no
...

Make sure we can login with the kiosk user over SSH.