As it's a hardware watchdog, it forcefully resets the system if you fail to send keepalives. It is a hard reset and Linux has no way to react that that. So it's definitely not a safe shutdown. The closest to that in software is probably running '/sbin/reboot -f'.juranga wrote:How does the watchdog shutdown the raspberry pi? Does the wd just cut the power or perform a safe shutdown??
Another way isjuranga wrote: I want to test my raspberry pi 3 for power failure situations and I want to simulate it.
I need to reboot the raspberry pi to continue with the tests.lbog wrote: Another way is
I want an automated process to test the system. Other way will be to use another microprocessor with a relay to simulate power failures, but I would have to "mount" it.MaxK1 wrote:Why not just pull the plug - that cuts power to everything (sdcard etc.)
For reboot (... without unmounting partitions or syncing), you can tryjuranga wrote:I need to reboot the raspberry pi to continue with the tests.lbog wrote: Another way is
Code: Select all
echo b | sudo tee /proc/sysrq-trigger
If you want to test power failure, your test must remove the power from the Pi. The watchdog by itself doesn't do that. So you are right, the method of testing is not correct. You are testing recovery from a watchdog-detected failure ... though of course there has been no failure, the exact mode of potential failure is unknown, so you can't know that a Pi with a real watchdog event will actuially restart....juranga wrote:So I guess that my approach to simulate power failure was not correct, was it? I had the system with the watchdog (wd reset each 10 minutes, 470 times in total) the whole weekend and the raspberry pi is still working perfectly, no file-system corruption. So, the system is really reliable of the approach of the testing is not correct.
IMO the power bank approach is more appropriate than a mains UPS. See here.MaxK1 wrote: Would a UPS "solve" the problem? ($$$) or a power bank that allows simultaneous charge/dis-charge?
MaxK1 wrote:Since we don't really know what the OP is trying to do,
We know enough to know that stopping the watchdog does not simulate power failure. The OP asked about how to test, not about how to prevent the situation. Any thoughts (including mine) about prevention are actually OT.juranga wrote:I want to test my raspberry pi 3 for power failure situations and I want to simulate it.
That's a really great post, thank you for the link!mosespi wrote:I have a similar test.. still ongoing. I got to 26,823 successful boot ups for the regular test and it is on # 21,056 for the write test!!! See:
This was all done using my UPS for the Pi. A supervisor circuit (micro-controller) controls the power state of a switching DC regulator that feeds the Pi, and is reconfigured to simulate a power cut.