Prevent reboot on kernel panic?

`Orum

Active Member

Reaction score: 21
Messages: 194

I've got a system that I'm booting via the FreeBSD 11 memstick, as I'm trying to copy data from a backup (connected locally) to a fresh root zfs raid-z1 pool. The dataset in question is about 2.2 TiB that I'm transferring via zfs send piped to zfs recv, and part of the way through the transfer, the system presumably kernel panics and reboots.

I say "presumably" because I'm not sure if that's what is happening, but if memory serves, FreeBSD waits kern.panic_reboot_wait_time (default 15 seconds), and then reboots, normally leaving a kernel dump. The problem is, this is a memstick, and the mounted filesystems are mounted on md(), so any dump is lost on a reboot.

In theory, as I already have the base system copied on to the new pool, I could just boot to that to avoid this issue, but then my worry is, if the system is locking due to failed disk writes (which is what I suspect) then it may not be able to write a kernel dump to those disks anyway. I'd mainly like to just see the panic screen so I can get some idea of what's causing it to reboot.

So what's the canonical way to disable rebooting on a panic? Would simply running sysctl kern.panic_reboot_wait_time=0 do it? Or would that instantly reboot the system :eek:?

Edit: grepping through FreeBSD's source, it looks like, according to line 504 of /sys/kern/kern_shutdown.c, that kern.panic_reboot_wait_time should be set to -1 to prevent rebooting (setting it to 0 is an immediate reboot), assuming I'm reading the source correctly. I'll give that a try and report back assuming it crashes again.
 
Top