0

Is there any documentation about what the Pi is actually doing during its (excruitatingly) slow power down ? I want to build a Pi4 into a product that will definitely have the power cord pulled on a regular basis. Obviously I could put in some sort of UPS but that adds cost. I was thus wondering could I boot the Pi from a read-only USB memory or something else which then copies a fresh copy of the OS to the SD card before rebooting to run from that. Alternatively make the SD card read only and install a second external SD card reader on USB3 and switch to running from that once a fresh copy is installed, although I assume that would be slower because of the USB3 in the way.

This way I think (?) that when the power is pulled the system will still always be safe.

Anybody done anything like this ?

Note that this is not a duplicate - other discussions have been on how to close the Pi, not how to just crash it and recover

Mike Bryant
  • 141
  • 1
  • 6
  • Welcome. The Pi's power down is not "excruitatingly slow" unless you mistake it for the wrong kind of device. It is on a reasonable par for other similar devices that run a general purpose operating system, such as a smartphone. What it is not like is a pure microcontroller (MCU) based device which cannot run a standard operating system, does not have gigabytes of memory, etc., such as many things used in an embedded context. "I want to build a Pi4 into a product that will definitely have the power cord pulled on a regular basis" -> Don't use a Pi for such a project. – goldilocks Aug 13 '19 at 12:25
  • Sorry but I checked all the previous questions and this is not a duplicate. – Mike Bryant Aug 13 '19 at 12:28
  • And sorry but the Pi is excruitatingly slow on closing. The STM32MK157 does it much faster. And lots of people use Pis for embedded as it's a good fit. Indeed why would the Pi Zero and Pi compute module exist otherwise – Mike Bryant Aug 13 '19 at 12:31
  • I did not say don't use it for "embedded". I said don't use it for something that often won't be shut down properly. If there are alternatives that you already know will do what you want, why don't you just use one of those? But if there is no such option, then you need to rethink your understanding. The STM32, BTW, is a perfect example of exactly what I was referring to: It is not even close to comparable to a Raspberry Pi. It is in a completely different category of device. If that is the kind of thing you need, use it. – goldilocks Aug 13 '19 at 12:38
  • Beyond that, the "How can I kill the power safely without shutting the OS down properly?" has been done to death. If you want to ask a specific question about copying the whole OS from one place to another at boot, and/or about implementing a read-only filesystem, etc., then feel free to do so. But we are not a "brainstorm-with-me", discussion style forum. Please take the tour to understand better how the site works. – goldilocks Aug 13 '19 at 12:38
  • The STM32MP157 has dual A7 cores, Ethernet, 5xUSB, HDMI and runs LInux. It's not a Pi4 but it will outperform older Pis. And it powers down very quickly indeed, I suspect you are thinking about things like the F series which are just MCUs. – Mike Bryant Aug 13 '19 at 15:20
  • If it's pointless argument you want, this is malarky: "It's not a Pi4 but it will outperform older Pis." -> At what??!?? Falling out of a tree? Please, please, please show me a benchmark where that happens. The fact that it shuts down faster is an exact correlation to this. Again, the Pi is on a par with a smartphone. What you are talking about simply is not; it is on par with a touchscreen thermostat. Different scenarios, different devices. – goldilocks Aug 13 '19 at 16:00
  • Go and read up on the STM32MP157. It is a dual core Arm A7 processor optimised to run Linux and supports gigabytes of memory (which I need). It is certainly NOT a thermostat processor for which even the STM32F103 would be overkill. You will find loads of benchmarks which place it somewhere between a Pi3 and a Pi4. And as I said, it shuts its version of Linux down much faster than a Pi4 does with Raspian which indicates the Pi either does more (what ?) or isn't as well optimised. – Mike Bryant Aug 14 '19 at 13:08
  • If you want a hint, trim the OS. If you ran the kind of GNU/Linux you'd use on an STM32, you'd probably have the shutdown time down to < 2s instead of the ~5s which it tends to be under Raspbian. Raspbian is not an embedded OS. It's desktop and/or server oriented, a context where available features etc. will always outweigh boot or shutdown times because they don't really matter much in that context. The idea you have in this question (copying the OS around at boot) is ludicrous. You want to start with a truly minimal OS and go from there. – goldilocks Aug 14 '19 at 13:55

0 Answers0