Image of Linux Kernel Development (3rd Edition)
Image of RHCE Red Hat Certified Engineer Linux Study Guide (Exam RH302) (Certification Press)
Image of Modern Operating Systems (3rd Edition)
Image of Operating System Concepts

What is /proc/config.gz?

Linux can store a gzip’ed copy of the kernel configuration file used to build the kernel in the kernel itself, and make it available to users via /proc/config.gz.

This file is not always present in a Linux distribution. It is only present when /proc support is enabled and CONFIG_IKCONFIG and CONFIG_IKCONFIG_PROC are set to Y in the kernel configuration file. Most distributions do not enable it by default; instead they include the kernel configuration file under /boot.

If in-kernel configuration support is built as a kernel module, then before you can use /proc/config.gz, the configs module needs to be loaded into the kernel using insmod or modprobe.

To quickly check a configuration setting, you could use zcat or zgrep:

# zcat /proc/config.gz | grep IKCONFIG

To extract a copy of the kernel configuration file you could do something like the following:

# zcat /proc/config.gz > /boot/config-$(uname -r).new

Finally, if CONFIG_IKCONFIG is set but CONFIG_IKCONFIG_PROC was not set, the extract-ikconfig script can be used to extract the configuration file from a kernel image file.

Comments are closed.