# How to make Raspberry Pi auto-reboot after kernel panic

**URL:** <https://hub.mender.io/t/how-to-make-raspberry-pi-auto-reboot-after-kernel-panic/5152>\
**Category:** General Discussions\
**Tags:** yocto, raspberry-pi-3, raspberry-pi-4\
**Created:** [July 28, 2022, 5:46am UTC](https://hub.mender.io/t/how-to-make-raspberry-pi-auto-reboot-after-kernel-panic/5152 "2022-07-28T05:46:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![james-onsolution](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@james-onsolution](https://hub.mender.io/u/james-onsolution)\
**Post date:** [July 28, 2022, 5:46am UTC](https://hub.mender.io/t/how-to-make-raspberry-pi-auto-reboot-after-kernel-panic/5152/1 "2022-07-28T05:46:37Z")

</div>

Hi, I have a fairly standard Mender/Yocto build for the Raspberry Pi 3 and 4.

We’re had a few customers in the field encounter kernel panics, which required a manual power-cycle of the Pi to get it running again. So I’d like to implement auto-reboot when a kernel panic happens.

I can do this after boot using `echo 20 >/proc/sys/kernel/panic`, but I was if there was a more ‘proper’ way of doing it, perhaps as an argument passed in from U-Boot?

Does anyone know if this is possible?

Thanks!  
James

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [July 28, 2022, 2:14pm UTC](https://hub.mender.io/t/how-to-make-raspberry-pi-auto-reboot-after-kernel-panic/5152/2 "2022-07-28T14:14:23Z")

</div>

Hi @james-onsolution,

According to [The kernel’s command-line parameters — The Linux Kernel documentation](https://www.kernel.org/doc/html/v5.18/admin-guide/kernel-parameters.html) you can pass `panic= " via command line. Please note that this will only catch situations where the kernel is still properly panicking. If you require more robustness, then you need to look into hardware watchdog functionality.

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![clementp](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/clementp/32/1392_2.png) [@clementp](https://hub.mender.io/u/clementp)\
**Post date:** [August 1, 2022, 12:23pm UTC](https://hub.mender.io/t/how-to-make-raspberry-pi-auto-reboot-after-kernel-panic/5152/3 "2022-08-01T12:23:43Z")

</div>

Directly in the kernel config

│ CONFIG\_PANIC\_TIMEOUT: │  
│ │  
│ Set the timeout value (in seconds) until a reboot occurs when │  
│ the kernel panics. If n = 0, then we wait forever. A timeout │  
│ value n \> 0 will wait n seconds before rebooting, while a timeout │  
│ value n \< 0 will reboot immediately.

---

<div class="post-metadata">

**Author:** ![james-onsolution](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@james-onsolution](https://hub.mender.io/u/james-onsolution)\
**Post date:** [August 3, 2022, 2:00am UTC](https://hub.mender.io/t/how-to-make-raspberry-pi-auto-reboot-after-kernel-panic/5152/4 "2022-08-03T02:00:48Z")

</div>

@clementp Thanks, I’ll give this CONFIG\_PANIC\_TIMEOUT a try soon

@TheYoctoJester In regards to the hardware watchdog, do you know if there is any information about how to get this working on the RPi? From some Googling, it looks like the Pi 3 and 4 have a hardware watchdog built in, but I can’t find much information about how to enable/configure it in Yocto and how to make sure it plays nicely with Mender

---

<div class="post-metadata">

**Author:** ![james-onsolution](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@james-onsolution](https://hub.mender.io/u/james-onsolution)\
**Post date:** [November 8, 2022, 4:48am UTC](https://hub.mender.io/t/how-to-make-raspberry-pi-auto-reboot-after-kernel-panic/5152/5 "2022-11-08T04:48:04Z")

</div>

I’ve only just now revisiting this issue, and I’m not 100% sure how to implement CONFIG\_PANIC\_TIMEOUT. Is there any documentation you can point me towards? @clementp

Kind Regards,  
James
