Linux Kernel.org misleading about kernel panic

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.


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.