Current linux kernel config

View Current Kernel Configuration¶

Be cautious if examining the files mentioned here, altering them can change the behavior of the actual running kernel!

These two interfaces allow you to view and change the parameters of the currently running kernel.

Note that if you do an ls -l on some of these files, they will show as «0» length, but if you cat them out they actually contain data. Most of them are ASCII and editable, however some are binary. In either case commands like file or stat will typically just return «empty file» or «0» for lengths, although they will show you other information.

The preferred and standard programs for interacting with these functions are lsmod , modinfo , and sysctl , among others.

See what your currently running «kernel release» version is with:

uname -r and substitute its return value in commands by using $(uname -r)

RHEL and derivative distributions (Fedora, CentOS Stream, Scientific Linux, RockyLinux, AlmaLinux, et. al.) also store the configuration used for bootable installed kernels in the /boot directory used by Grub2 as ASCII files:

To check the currently running kernel configuration for a particular value:

cat /boot/config-$(uname -r) | grep -i
  • «=m» if compiled in as a kernel module
  • «=y» if compiled statically into the kernel
  • «is not set» if that setting was commented out
  • a numeric value
  • a quoted string value

Some distributions, like Gentoo and Arch, use the configs kernel module to provide /proc/config.gz by default instead:

zcat /proc/config.gz | grep -i zgrep /proc/config.gz 

For any distribution, if your running kernel has set both CONFIG_IKCONFIG and CONFIG_IKCONFIG_PROC and if

exists and is executable (searchable in the case of a dir) then you can create /proc/config.gz with this command if it is not present:

This document does not currently cover kernel packages that might have come from non-default repos such as:

appstream-debug, appstream-source, baseos-debug, baseos-source, or devel

The kernel-devel packages install the config file used to compile each installed standard kernel package as an ASCII file in the following location:

This file is more commonly accessed by a symlinked path provided by the kernel-core packages:

/lib/modules//build/ -> /usr/src/kernels// 

If you have kernel-debug-devel packages installed, you will also have this directory:

You can look in any of the following for details on the config values used to build an installed kernel:

/lib/modules//config /lib/modules//build/.config /usr/src/kernels//.config /usr/src/kernels/+debug/.config 

Configured modules for the currently running kernel, whether compiled as builtin (i.e., statically into the kernel itself) or a loadable module, are listed by sub directories named as the module name in:

For each installed kernel-release you can examine these files to see what values were compiled into that kernel, and what version of GCC was used to compile it:

cat /lib/modules/$(uname -r)/config | grep -i
cat /lib/modules/$(uname -r)/build/.config | grep -i
cat /usr/src/kernels/$(uname -r)/.config | grep -i
cat /usr/src/kernels/$(uname -r)+debug/.config | grep -i

You can check for kernel module dependencies in the file:

Читайте также:  Linux mint кодеки звука

but it is easier to read or parse the output of the «Used-by» field in lsmod .

Reference:¶

Contributors: Steven Spencer

Источник

View Current Kernel Configuration¶

Be cautious if examining the files mentioned here, altering them can change the behavior of the actual running kernel!

These two interfaces allow you to view and change the parameters of the currently running kernel.

Note that if you do an ls -l on some of these files, they will show as «0» length, but if you cat them out they actually contain data. Most of them are ASCII and editable, however some are binary. In either case commands like file or stat will typically just return «empty file» or «0» for lengths, although they will show you other information.

The preferred and standard programs for interacting with these functions are lsmod , modinfo , and sysctl , among others.

See what your currently running «kernel release» version is with:

uname -r and substitute its return value in commands by using $(uname -r)

RHEL and derivative distributions (Fedora, CentOS Stream, Scientific Linux, RockyLinux, AlmaLinux, et. al.) also store the configuration used for bootable installed kernels in the /boot directory used by Grub2 as ASCII files:

To check the currently running kernel configuration for a particular value:

cat /boot/config-$(uname -r) | grep -i
  • «=m» if compiled in as a kernel module
  • «=y» if compiled statically into the kernel
  • «is not set» if that setting was commented out
  • a numeric value
  • a quoted string value

Some distributions, like Gentoo and Arch, use the configs kernel module to provide /proc/config.gz by default instead:

zcat /proc/config.gz | grep -i zgrep /proc/config.gz 

For any distribution, if your running kernel has set both CONFIG_IKCONFIG and CONFIG_IKCONFIG_PROC and if

exists and is executable (searchable in the case of a dir) then you can create /proc/config.gz with this command if it is not present:

This document does not currently cover kernel packages that might have come from non-default repos such as:

appstream-debug, appstream-source, baseos-debug, baseos-source, or devel

The kernel-devel packages install the config file used to compile each installed standard kernel package as an ASCII file in the following location:

This file is more commonly accessed by a symlinked path provided by the kernel-core packages:

/lib/modules//build/ -> /usr/src/kernels// 

If you have kernel-debug-devel packages installed, you will also have this directory:

You can look in any of the following for details on the config values used to build an installed kernel:

/lib/modules//config /lib/modules//build/.config /usr/src/kernels//.config /usr/src/kernels/+debug/.config 

Configured modules for the currently running kernel, whether compiled as builtin (i.e., statically into the kernel itself) or a loadable module, are listed by sub directories named as the module name in:

For each installed kernel-release you can examine these files to see what values were compiled into that kernel, and what version of GCC was used to compile it:

cat /lib/modules/$(uname -r)/config | grep -i
cat /lib/modules/$(uname -r)/build/.config | grep -i
cat /usr/src/kernels/$(uname -r)/.config | grep -i
cat /usr/src/kernels/$(uname -r)+debug/.config | grep -i

You can check for kernel module dependencies in the file:

Читайте также:  Проверить запущен ли nginx linux

but it is easier to read or parse the output of the «Used-by» field in lsmod .

Reference:¶

Contributors: Steven Spencer

Источник

Where can I find the kernel configuration on each Linux distribution?

I’m pretty sure that all Red Hat and Debian based distributions follow the convention of shipping the kernel configuration in /boot/config-* , but what of other distributions? Or, if this convention is extremely common, which distributions don’t follow it?

This, I think, is a which distribution. question which does not rely on opinion for answer. Kind of a breath of fresh air — there aren’t too many of those. Also, it’s interesting. Thanks.

@mikeserv too broad might fit, though. 😛 On-topic: I think Arch Linux doesn’t. But I don’t have a installation handy to check.

@muru — arch here: ls: cannot access /boot/config*: No such file or directory . But, then again, an archer’s /boot is a very personal thing. On the other hand, ls /proc/config.gz is entirely successful.

2 Answers 2

Debian and derivatives (Ubuntu, Linux Mint, …)

The configuration for the kernel /boot/vmlinuz-VERSION is stored in /boot/config-VERSION . The two files ship in the same package, linux-VERSION or kernel-VERSION .

Arch Linux, Gentoo (if enabled)

The configuration for the running kernel is stored in the kernel binary and can be retrieved with zcat /proc/config.gz .

This file exists when the CONFIG_IKCONFIG option is set when compiling the kernel — and so can be true (or not) regardless of distribution, though the default kernel configuration for the two named does enable it.

Incidentally, arch linux’s default configuration does not name the kernel (or its initramfs image) by version even in /boot — the files there are named only for their corresponding packages. For example, a typical arch linux boot kernel is named /boot/vmlinuz-linux where linux is the package one installs for the default kernel.

The linux kernel source comes with an installation mechanism, make install . This installs files into /boot (vmlinuz-version, System.map-version, and config-version).

The option to make the running kernel’s config available via /proc/config.gz is part of the kernel too, so if this config option has been enabled the file will exist in the /proc filesystem. Almost all distributions have this enabled these days, even Android kernels, and as such, this is the most standard location.

Neither of these locations is dependent on the distribution though. Many distributions take advantage of the ‘default’ location when packaging, as it’s probably convenient to prepare packages this way, but even within a single distribution it’s possible that non-standard kernel packages might place the files elsewhere, or name them differently, although this is unlikely.

Источник

View Current Kernel Configuration¶

Be cautious if examining the files mentioned here, altering them can change the behavior of the actual running kernel!

Читайте также:  Create partitions in linux fdisk

These two interfaces allow you to view and change the parameters of the currently running kernel.

Note that if you do an ls -l on some of these files, they will show as «0» length, but if you cat them out they actually contain data. Most of them are ASCII and editable, however some are binary. In either case commands like file or stat will typically just return «empty file» or «0» for lengths, although they will show you other information.

The preferred and standard programs for interacting with these functions are lsmod , modinfo , and sysctl , among others.

See what your currently running «kernel release» version is with:

uname -r and substitute its return value in commands by using $(uname -r)

RHEL and derivative distributions (Fedora, CentOS Stream, Scientific Linux, RockyLinux, AlmaLinux, et. al.) also store the configuration used for bootable installed kernels in the /boot directory used by Grub2 as ASCII files:

To check the currently running kernel configuration for a particular value:

cat /boot/config-$(uname -r) | grep -i
  • «=m» if compiled in as a kernel module
  • «=y» if compiled statically into the kernel
  • «is not set» if that setting was commented out
  • a numeric value
  • a quoted string value

Some distributions, like Gentoo and Arch, use the configs kernel module to provide /proc/config.gz by default instead:

zcat /proc/config.gz | grep -i zgrep /proc/config.gz 

For any distribution, if your running kernel has set both CONFIG_IKCONFIG and CONFIG_IKCONFIG_PROC and if

exists and is executable (searchable in the case of a dir) then you can create /proc/config.gz with this command if it is not present:

This document does not currently cover kernel packages that might have come from non-default repos such as:

appstream-debug, appstream-source, baseos-debug, baseos-source, or devel

The kernel-devel packages install the config file used to compile each installed standard kernel package as an ASCII file in the following location:

This file is more commonly accessed by a symlinked path provided by the kernel-core packages:

/lib/modules//build/ -> /usr/src/kernels// 

If you have kernel-debug-devel packages installed, you will also have this directory:

You can look in any of the following for details on the config values used to build an installed kernel:

/lib/modules//config /lib/modules//build/.config /usr/src/kernels//.config /usr/src/kernels/+debug/.config 

Configured modules for the currently running kernel, whether compiled as builtin (i.e., statically into the kernel itself) or a loadable module, are listed by sub directories named as the module name in:

For each installed kernel-release you can examine these files to see what values were compiled into that kernel, and what version of GCC was used to compile it:

cat /lib/modules/$(uname -r)/config | grep -i
cat /lib/modules/$(uname -r)/build/.config | grep -i
cat /usr/src/kernels/$(uname -r)/.config | grep -i
cat /usr/src/kernels/$(uname -r)+debug/.config | grep -i

You can check for kernel module dependencies in the file:

but it is easier to read or parse the output of the «Used-by» field in lsmod .

Reference:¶

Contributors: Steven Spencer

Источник

Оцените статью
Adblock
detector