If your Raspberry Pi fails too often… Link to heading
I want to share how I managed to reduce my RPi failure rate significantly.
I have a Raspberry Pi Zero 2 W, which is a tiny single-board computer that is more versatile than you might think. The only problem I have is that if I throw a relatively intense task, it too often freezes and becomes unresponsive, forcing me to hard-restart the system.
I was first suspicious with its temperature being too high, so I was monitoring the temperature as it was doing an intense task
watch -n 1 vcgencmd measure_temp
However, the temperature never reached 70°C, so this wasn’t the culprit. Then, I realized that it might be simply that the task is too intensive that it does not have any resource to respond to the user input. So, I then forced it to do the same task but with just a single-thread. For example, to install Rust, I prepended the command with taskset -c 1:
taskset -c 1 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
Normally, without the taskset -c 1 option, this same command persistently failed, making my RPi unresponsive. However, by limiting it to run on a single-thread, my RPi was able to complete the task, albeit I had to be patient!
So, the solution I found is to always force it to run intensive tasks on a single-thread, even if your RPi is equipped with multi-cores!