2

The NOTES section of $ man 5 sysctl.conf states: The description of individual parameters can be found in the kernel documentation.

But is there a way for me to find this kernel documentation offline? Is it a package that I'd need to install?

For example, I came across the kernel.panic parameter, which on my system is set to 0 by default. Looking it up online here, it's described to be:

panic:

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.

But there is no reasonable way I'd guessed that the 0 there referred to 0 seconds till auto reboot without searching it up online.

Jethro Cao
  • 123
  • 3
  • 2
    What's your distro? On Debian you'd need the `linux-doc` package and the document would be `/usr/share/doc/linux-doc/Documentation/sysctl/kernel.txt.gz`. – Freddy Mar 28 '21 at 01:18
  • 1
    0 doesn't mean reboot immediately, BTW: https://unix.stackexchange.com/q/564735/70524 – muru Mar 28 '21 at 01:27
  • @Freddy pretty much exactly what I was looking for, thanks! I'm looking for the EL-family actually, and a quick search revealed that the `kernel-doc` package is what I need. – Jethro Cao Mar 28 '21 at 01:43
  • @muru thanks for the link, didn't know about `man 5 proc`, which looks also helpful for my purposes. And that was indeed my second guess on what the `0` value did lol. (sort of like how an ipv4 of `0.0.0.0` can either mean no valid address or all valid addresses) – Jethro Cao Mar 28 '21 at 01:48

1 Answers1

3

But is there a way for me to find this kernel documentation offline? Is it a package that I'd need to install?

Yes, most distributions provide the kernel documentation for their kernel in a package. On Debian, this is linux-doc, which is a meta-package pulling in the default kernel’s documentation for whichever release you’re using (version-specific packages are available too, *e.g. linux-doc-4.19). On RHEL, CentOS etc. it’s kernel-doc.

You’ll find the file you’re looking for in this case in /usr/share/doc/kernel-doc-*/Documentation/sysctl/kernel.txt on RHEL. In newer versions the file has been converted to ReSTructured text and can be found in .../Documentation/admin-guide/sysctl/kernel.rst (which is also where you can find the current kernel sysctl documentation on the kernel web site).

Checking the packaged version gives you a better chance to get the documentation matching your running kernel; in some cases though the current documentation is more accurate, even for older kernels, and this is the case here — I improved the documentation following Linux Kernel.org misleading about kernel panic /proc/sys/kernel/panic, and that ended up in version 5.7 of the kernel.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164