I always have /proc/sys/kernel/panic set up to 0. Looking at description of this option in kernel.org we can see:


The value in this file represents the number of seconds the kernel waits before rebooting on a panic. When you use the software watchdog, the recommended setting is 60.

From here one can conclude that 0 is 0 seconds waiting before reboot - immediate reboot.
But proc MAN page states the following:

This file gives read/write access to the kernel variable panic_timeout. If this is zero, the kernel will loop on a panic; if nonzero, it indicates that the kernel should autore‐ boot after this number of seconds. When you use the software watchdog device driver, the recommended setting is 60.

Here 0 means antipodal thing - never reboot.

So why such a trusted source gives such a misleading info? Or maybe the MAN page is inaccurate?

P.S. just from a hint in panic_on_oops section (if you happen to read this) you can guess that MAN page is right. Or if you are technically skilled enough to investigate something in kernel source code.

  • Maybe "loop on a panic" is supposed to mean instant reboot (into the next panic)? – Panki Jan 29 '20 at 12:39
  • 8
    "Inaccurate" or perhaps "too general" seems like a much better characterization of this than "lying", which is a harsh accusation to levy against a project maintained by volunteers. Have you looked into submitting a patch with more accurate language? – larsks Jan 29 '20 at 12:41
  • 2
    @larsks Edited to be more friendly. But it has nothing to do with "accusation" at all. It was a regular question perhaps a little incorrectly worded because of my poor English – red0ct Jan 29 '20 at 12:45
  • @larsks: are they really pure volunteers? No side interests? I agree with your comment, but don't err on the other side either. See my answer on man-pages project. – user373503 Jan 29 '20 at 13:29
  • 2
    @rastafile nobody is paid to maintain the kernel documentation; while much of the rest of the kernel is not maintained by “pure volunteers”, the documentation still is. See this talk on the subject by the kernel documentation maintainer, Jonathan Corbet, given at KR 2019. – Stephen Kitt Jan 29 '20 at 14:55

The authoritative source is the implementation in the kernel, so let’s look at that first.

The panic entry in sysctl corresponds to a kernel variable called panic_timeout. This is a signed integer, used to control behaviour on panic as follows:

  • if panic_timeout is strictly positive, the kernel waits after a panic, for panic_timeout seconds;
  • if panic_timeout is non-zero, the kernel reboots after a panic (after waiting, if appropriate);
  • if the kernel hasn’t rebooted, it prints a message and loops forever.

So the manpage is correct, and the kernel’s own documentation was incomplete; but sysctl/kernel.rst now documents panic in more detail. This was fixed in version 5.7-rc1 of the kernel.

  • Upvoted because i love responses that point source code: source code never lie and nothing can be more factual ;-) – binarym Jan 30 '20 at 9:58

So why such a trusted source gives such a misleading info?

First it is only slightly misleading - you rather jump to your conclusion - than a misktake. I would say the kernel.org neglects the special case "0".

I don't know the details of kernel.org, but in essence it is a mix of official kernel Documentation/ (web formatted, grouped), plus some additional info. Best example is the boot params list, which is "gathered" from different places, as they put it.

"kernel.org" lists the "Documentation" link under "Other Resources". It takes you to doc/html/latest/. There is also a mixed bag of links under /doc.

Right at the start the (sphinx formatted) Documentation says:

Kernel documentation, like the kernel itself, is very much a work in progress; that is especially true as we work to integrate our many scattered documents into a coherent whole. Please note that improvements to the documentation are welcome;...

The man 5 proc is part of man-pages project (or package), and there is this guy with the book-to-stun-an-ox who is maintaining it. These pages all have "COLOPHON" as subtitle (section) at the end. They are also heterogenous, some just collected (all the POSIX "1p" pages), and some written to fill the gaps.

On man7.org you directly see Mr. Kerrisk's oeuvre -- I think he does a good job, selling his book but maintaining a collection of open source man pages.

I this case, he is more precise. Both seem related, of course ("When you...device driver... 60").

we work to integrate our many scattered documents into a coherent whole.

This only makes halfways sense. Whose documents were scattered, and by whom?

My pseudocode goes like this:

if timeout > 0   then loop for 'timeout' seconds
if timeout != 0  then reboot
loop for ever

Which means a negative value is immediate reboot, and a positive one has both ifs true. And zero leads directly to the final loop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.