19

Between Debian 5 and 6, the default suggested value for kernel.printk in /etc/sysctl.conf was changed from kernel.printk = 4 4 1 7 to kernel.printk = 3 4 1 3. I understand that the first value corresponds to what is going to the console. What are the next 3 values for?

Do the numerical values have the same meaning as the syslog log levels? Or do they have different definitions?

Am I missing some documentation in my searching, or is the only location to figure this out the kernel source.

21

Sysctl settings are documented in Documentation/sysctl/*.txt in the kernel source tree. On Debian, install linux-doc to have the documentation in usr/share/doc/linux-doc-*/Documentation/ (most distributions have a similar package). From Documentation/sysctl/kernel.txt:

The four values in printk denote: console_loglevel, default_message_loglevel, minimum_console_loglevel and default_console_loglevel respectively.

These values influence printk() behavior when printing or logging error messages. See man 2 syslog for more info on the different loglevels.

  • console_loglevel: messages with a higher priority than this will be printed to the console
  • default_message_loglevel: messages without an explicit priority will be printed with this priority
  • minimum_console_loglevel: minimum (highest) value to which console_loglevel can be set
  • default_console_loglevel: default value for console_loglevel

I don't find any clear prose explanation of what default_console_loglevel is used for. In the Linux kernel source, the kernel.printk sysctl sets console_printk. The default_console_loglevel field doesn't seem to be used anywhere.

  • 1
    This Debian bug 526855, which is the origin of the change, seemed to suggest that there are some conditions where klogd may reset console_loglevel to default_console_loglevel when it calls some kernel function. – Zoredache May 11 '11 at 20:17
  • 1
    @Zoredache: Ah. It did back then, but no longer. The setting only stopped being used in the very kernel version shipped by the current Debian stable, which explains why the setup scripts still support it. – Gilles May 11 '11 at 20:28
4

Description of kernel.printk values

  • "0" → Emergency messages, system is about to crash or is unstable pr_emerg
  • "1" → Something bad happened and action must be taken immediately pr_alert
  • "2" → A critical condition occurred like a serious hardware/software failure pr_crit
  • "3" → An error condition, often used by drivers to indicate difficulties with the hardware pr_err
  • "4" → A warning, meaning nothing serious by itself but might indicate problems pr_warning
  • "5" → Nothing serious, but notably nevertheless. Often used to report security events. pr_notice
  • "6" → Informational message e.g. startup information at driver initialization pr_info
  • "7" → Debug messages pr_debug, pr_devel if DEBUG is defined
  • KERN_DEFAULT "d" The default kernel loglevel
  • KERN_CONT "" "continued" line of log printout (only done after a line that had no enclosing)

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.