I would like to know whether Adafruit's read-only raspi script (described here: https://www.raspberrypi.org/blog/adafruits-read-only/) is suitable for my project.

My project is a camera trap that starts recording audio, video, and data from a number of sensors when it is triggered. Everything runs within a single Python script, which does not write anything to the SD card, though it does need to write to an external USB drive.

I am using a number of libraries including OpenCV, pyserial, pyaudio (for an i2c microphone), and smbus.

Python program runs at about 15% CPU and 20% memory when idle; and 30% CPU and 40% memory when actively recording

The reason I would like it to be read-only is that the project is solar powered, and the pi has no method of monitoring the battery, so it very frequently has the power cut off without a proper shutdown (SD card corruptions). When the battery is again sufficiently charged the pi turns back on and auto-starts the Python script.

will the Adafruit Read only script break any components of my project? Do any Python libraries need to write to files on the SD card? does the script affect CPU performance? Any help is appreciated


| improve this question | | | | |
  • Do you expect that we test it for you? We cannot because we don't have your hardware. – Ingo Jul 22 '19 at 11:22
  • I'm just looking for other people's experiences with the script – J. Long Jul 23 '19 at 0:33

The 300-line script (direct link) is extensible, and for complex projects you'll likely have to modify it.

You can run your existing project through strace and look through the output to identify which files it accesses outside of /tmp. If you find various directories that pyserial or other components are writing to you'll have to set them up for temporary storage too. See how the Adafruit script took care of folders like /var/cache/lightdm and do something similar.

Also, the existing script only mounts /boot and the root partition, so you may need to add a line to mount your external drive read-only.

| improve this answer | | | | |
  • Though mounting the external drive RO is somehow defeating the purpose of a camera trap ;-) – Ghanima Jul 22 '19 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.