2

I have a great software running on my Raspberry Pi 4 and we will send it to customers for production.

The image on the SD card is Ubuntu. I would like to know if we can add any security to protect the Raspberry Pi, I am pretty sure our customers will plug it and unplug it, this manipulation is not safe and it can create corruption in the SD card. Is there any software able to prevent this kind of issues ?

Ajouve
  • 131
  • 3
  • 4
    I'd suggest (depending on what you're doing with the pi) looking into making the file system read only. https://medium.com/swlh/make-your-raspberry-pi-file-system-read-only-raspbian-buster-c558694de79 this should prevent any corruption that may be caused by just unplugging it. The only issue would be if you need to save files or preferences you'd have to look at a partition or usb stick to save preferences/files to. – rohtua Aug 12 '20 at 14:59

2 Answers2

3

You don't tell us how the Raspberry Pi is used. If you need to write data persistent to a storage, there is no way to have a software solution to avoid data lost on power interruption. Even such a software has no chance to do its work. You need a power fail battery buffer to keep power up for several seconds to gracefully shutdown the RasPi. You should find simple solutions for the Raspberry Pi on the web, keyword UPS.

If you don't need to store persistent data but only start always with the same predefined stable configuration you can use a read only filesystem that does not modify the operating system so you can start it without corruption after a power fail. In particular together with a union filesystem it is very comfortable by managing temporary data storage. One example you can find at How do I make the OS reset itself every time it boots up?.

Another solution is to tell your customers not to interrupt the power of the RasPi. Nowadays it is well known not to do it for computer. And yes, they will learn it very quick ;-)

Ingo
  • 42,107
  • 20
  • 85
  • 197
1

Some further things that might help:

  1. Use an industrial SLC MicroSD card. They are more expensive but come with advanced patents than hep preventing card corruption on sudden power loss.

  2. If no writing on the micro SDcard is required you could turn it into read only. That way you will make sure the data stays as it is.

  3. There are some small UPS-like hats that detect power interruptions. You can set a shutdown command when a power interruption is detected and the pi is running on the UPS.

  4. Make sure to add a shutdown button/switch and a function LED. This way it is a lot easier for everyone to shutdown the pi, even for those that are bored to type a shutdown command.

qeiynn
  • 67
  • 1
  • 6