Kernel/IKCONFIG Support

From Gentoo Wiki
< Kernel
Jump to:navigation Jump to:search

Configuration and usage of In-kernel Config (IKCONFIG) support for kernel beginners.


In-kernel .config support, also known as IKCONFIG, allows users to build a copy of the configuration the kernel was built with inside the kernel itself. This allows them to inspect the configuration of the kernel while it is running, without having to worry whether they changed or cleaned the source directory after it was built.

Why is it important?

This can assist users with debugging things like if a particular driver was compiled when the kernel was built, whether a networking option was enabled, or any other configuration option when they built the kernel, and is often asked for when looking for support on the forums or IRC channels.

Some people advise against enabling IKCONFIG support as it contains specific information about what features are (or are not) built in to the running kernel, and can pose a security risk if someone with malicious intent gains access to it

Enabling IKCONFIG Support

Kernel .config support can be enabled either built in to the kernel, or as a module. If built in to the kernel, there will always be a /proc/config.gz file to read the configuration from. If preferred, it can be built as a module so that the configuration is only available when the user loads the module.

General Setup  --->
    <*/M> Kernel .config support
        [*] Enable access to .config through /proc/config.gz

Accessing IKCONFIG

If users built IKCONFIG support as a module, then before they can use it they will need to load the module in to the kernel. This can be done by running the following command:

root #modprobe configs

Users should now be able to see the file /proc/config.gz. This is a compressed copy of the entire kernel configuration at build time.

When users finish looking at the configuration, they can unload the module with:

root #modprobe -r configs

The module should now have been unloaded and the /proc/config.gz file removed.


/proc/config.gz is a compressed copy of the kernel configuration, which means that in order to read it, it needs to be decompressed. There are two ways to do that.

Quick queries

If users just need to check one or two options, then the easiest way to read the file is to grep it through the decompressor to find what they're looking for.

user $zgrep IKCONFIG /proc/config.gz

Full file

Alternatively, if users want a more in-depth look at the configuration of the running kernel, they will need to copy the compressed file from where it is and decompress it.

user $cp /proc/config.gz /home/user/config.gz
user $gunzip /home/user/config.gz
user $nano /home/user/config

Optional: Load configs module on boot

If the kernel was built with IKCONFIG support as a module, and module is to be loaded when the system boots, add it to the list of auto-loaded modules for their system.

FILE /etc/modules-load.d/configs.conf