Walker News

How To Check What Kernel Build Options Enabled In The Linux Kernel?

Linux Kernel Build Options is the list of optional Linux kernel features that a system engineer can explicitly turn on or off during kernel compilation.

By selectively enabling Kernel Build Options, Linux administrator can build an optimized Linux kernel for a specific system crafted for particular purpose (e.g. Linux firewall, router, database server, etc).

Now, how could you tell what are the Kernel Build Options enabled in the Linux kernel running on production server, if you did not build it?

My ex-co phoned me just now and asked how could he check or confirm his Red Hat Enterprise Linux server supports the “secret” Linux magic SysRq key, which requires CONFIG_MAGIC_SYSRQ option enabled at kernel compile time.
The magic SysRq key is a key combination using the SysRq key (Print Screen) that allows user to perform low-level commands regardless of the Linux kernel’s state (hang or panic).

Since it’s a standard RHEL installation, I suggested him to take a look on Linux kernel configuration file that installed to /boot partition.
It’s a (recommended) practice of copying Linux kernel configuration file to /boot partition each time after the kernel image is compiled and installed to this partition, to serve purpose of documentation and reference.

In his RHEL 4 server, there two config files exists in /boot partition, one for SMP and another one is setup for non-SMP kernel compilation.

For accuracy, execute uname -r to print the kernel release and look for the corresponding config file of kernel release reported by uname -r command (as shown in the screenshot):

How to verify some specific Linux Kernel Build Options are enabled for the running Linux kernel?
How to verify some specific Linux Kernel Build Options are enabled for the running Linux kernel?

In this case, the correct Linux kernel configuration to look for is /boot/config-2.6.9-42.ELsmp and this command confirms that his RHEL4 kernel supports the magic SysRq key:
cat /boot/config-2.6.9-42.ELsmp | grep CONFIG_MAGIC_SYSRQ

He can enable or disable this supported feature by manipulating /proc/sys/kernel/sysrq or kernel.sysrq.

Custom Search

  1. Customize Linux Command Prompt To Differentiate Between Live And Test Servers – Walker News 04-12-08@02:34

    […] not uncommon a Linux administrator initiate remote connection to test server and live servers concurrently, especially when migrating […]

  2. White FrosT 07-12-09@02:03

    What about
    grep CONFIG_MAGIC_SYSRQ /boot/config-2.6.9-42.ELsmp
    that would be a little more efficient and give the same results as:
    cat /boot/config-2.6.9-42.ELsmp | grep CONFIG_MAGIC_SYSRQ

  3. Walker 07-12-09@02:10

    Thank you for the suggestion. I appreciate it.

  4. 4fenixx 17-06-10@04:58

    No other way to check a kernel built-in capability if not config files are provided ?
    if they are as module i suppose lsmod does the work but sometimes you are in a strange machine trying to configure something just to find out there arent compiled kernel support.

  5. Irfan 12-07-11@03:19


    Yes there is. If the config doesn’t exist in /boot, you can do the same thing by looking directly in /proc/config.gz with:

    gzip -cd /proc/config.gz | grep CONFIG_MAGIC_SYSRQ

2017  •  Privacy Policy