Hi world,
I have build a small camera system based on a PI zero + Camera v2.
I want to make it a true read-only system the simplest way, no more update needed, no file writing ...
I'm using the last Strech version and all tutorials are about 'overlay'.
Can't I just use simple way like :
> disable swap
> mount some files in ram disk (logs & cie)
> make SD card read-only
Is there a tutorial about RO system for Raspian Strech version ?
Thanks.
- thagrol
- Posts: 4258
- Joined: Fri Jan 13, 2012 4:41 pm
- Location: Darkest Somerset, UK
- Contact: Website
Re: simple RO headless pi zero system
I've had success with this: https://learn.adafruit.com/read-only-raspberry-pi/
Does what you're asking for.
Does what you're asking for.
Arguing with strangers on the internet since 1993.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
Re: simple RO headless pi zero system
I will try this, thanks for your help.
- Joel_Mckay
- Posts: 295
- Joined: Mon Nov 12, 2012 10:22 pm
- Contact: Website
Re: simple RO headless pi zero system
Indeed, I put together a gpu mate desktop Raspbian Stretch pi3 kernel version with Overlay, AUFS, and the vc4 core bug fix.
https://sourceforge.net/projects/microm ... -pi/files/
(there is still that flash & gpu enabled VLC plug-in bug that requires restarting midori once)
> disable swap
not a good idea for users given the ram drive fills quickly, but I simply moved the swap file into a user partition
(The OS / and /boot is read-only)
> mount some files in ram disk (logs & cie)
already done, keep in mind you'll need to modify several processes (mostly systemd related)
> make SD card read-only
While the program is compiled in this OS, it doesn't really allow easy updates
You could easily modify the scripts for your setup with:
1. remount the os in RW mode
2. cp -R /home/pi /root/pi
3. apt-get remove purge dphys-swapfile
4. unmount /home
5. mv /root/pi /home/pi
6. comment out /home mount in /etc/fstab*
7. edit RO/RW mount shell scripts in /opt to support card (un)locking (the sdcard program is in /usr/local/ )
8. reboot in RO
Be aware you will have about 40MB of changes in /home before the system runs out of ram.
However, I'm sure you can rebuild the ramdisk file for your needs, and start purging files you don't need to make the OS smaller.

Best of luck,
~J~
https://sourceforge.net/projects/microm ... -pi/files/
(there is still that flash & gpu enabled VLC plug-in bug that requires restarting midori once)
> disable swap
not a good idea for users given the ram drive fills quickly, but I simply moved the swap file into a user partition
(The OS / and /boot is read-only)
> mount some files in ram disk (logs & cie)
already done, keep in mind you'll need to modify several processes (mostly systemd related)
> make SD card read-only
While the program is compiled in this OS, it doesn't really allow easy updates
You could easily modify the scripts for your setup with:
1. remount the os in RW mode
2. cp -R /home/pi /root/pi
3. apt-get remove purge dphys-swapfile
4. unmount /home
5. mv /root/pi /home/pi
6. comment out /home mount in /etc/fstab*
7. edit RO/RW mount shell scripts in /opt to support card (un)locking (the sdcard program is in /usr/local/ )
8. reboot in RO
Be aware you will have about 40MB of changes in /home before the system runs out of ram.
However, I'm sure you can rebuild the ramdisk file for your needs, and start purging files you don't need to make the OS smaller.

Best of luck,
~J~
- HawaiianPi
- Posts: 6217
- Joined: Mon Apr 08, 2013 4:53 am
- Location: Aloha, Oregon USA
Re: simple RO headless pi zero system
You might want to take a look at Tinycore Linux for the Pi. http://tinycorelinux.net/ports.html
It runs entirely from RAM, so no writes to the SD card.
It runs entirely from RAM, so no writes to the SD card.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?
lots of pop-ups...and where is that annoying music coming from?
Re: simple RO headless pi zero system
Another ramdisk distro alternative is my Nard.HawaiianPi wrote: ↑Mon Sep 10, 2018 10:34 amIt runs entirely from RAM, so no writes to the SD card.
http://www.nard.se/
Author of the robust Nard distro http://www.nard.se