Mini Guide: Read only Raspberry Pi (without NFS)

Mini Guide: Read only Raspberry Pi (without NFS)
Without NFS

Note: This note was originally in the Raspberry Pi, overlayfs read-write root, read-only NFS base post.

This setup described in the article above also works without the NFS setup.

As we plan to have no 'proper' storage and RAM limits the size of writes we can store there's no point having a swap file.

sudo dphys-swapfile swapoff
sudo dphys-swapfile uninstall
sudo update-rc.d dphys-swapfile remove

Update Ubuntu and the firmware, etc:

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get upgrade
sudo BRANCH=next rpi-update

Then reboot.

Create the initramfs:

sudo mkinitramfs -o /boot/initrd

Add the script and make it executable.

sudo curl https://gist.githubusercontent.com/paul-ridgway/d39cbb30530442dca416734c3ee70162/raw/c490df8be1976dd062a8b5f429ef42ed1b393ecb/ro-root.sh -o /bin/ro-root.sh
sudo chmod +x /bin/ro-root.sh 

Edit /boot/config.txt, adding:

initramfs initrd followkernel
ramfsfile=initrd
ramfsaddr=-1

Edit /boot/cmdline.txt, adding:

init=/bin/ro-root.sh

And now reboot again and it's done, the changes made to the original script to use /proc/mounts over /etc/fstab seem to work in both cases.