47

How do I check what options are compiled into a Linux kernel without looking at /boot/config-* and if I don't have access to the /boot/config-* file that's left over?

U880D
  • 597
  • 7
  • 17
Amandasaurus
  • 30,211
  • 62
  • 184
  • 246

2 Answers2

45

Unless your kernel was built with CONFIG_IKCONFIG_PROC, which would make the config available in /proc as sysadmin1138 mentioned above, you're pretty much out of luck. Debian and RH based kernel packages do, however, generally install a config-$version file in /boot. So unless it's a custom kernel, it should be available there.

Kyle Brandt
  • 82,107
  • 71
  • 302
  • 444
Insyte
  • 9,314
  • 2
  • 27
  • 45
34

I believe /proc/config.gz contains the .config file the kernel was compiled with.

sysadmin1138
  • 131,083
  • 18
  • 173
  • 296
  • 8
    That's only available if `CONFIG_IKCONFIG_PROC` was set when the kernel was built. Doesn't seem to be there by default on RHEL or Ubuntu. – Insyte Aug 06 '09 at 17:19
  • 5
    As of writing, this is enabled by default on Arch :) – Navin Apr 25 '13 at 00:33
  • 7
    to read (or grep) the current settings from config.gz you can unzip it with `$cat /proc/config.gz | gunzip > mykernel.conf` as suggested by [Jarl on superuser.com](http://superuser.com/questions/287371/obtain-kernel-config-from-currently-running-linux-system). – xaa Oct 29 '15 at 10:59
  • It is the case on Arch Linux as `CONFIG_IKCONFIG_PROC=y`. – Terry Wang Jan 04 '18 at 05:11
  • 1
    @xaa Or you can use the single command alternatives `zcat` or `zless`, the latter of which is more convenient as it is a pager which allows you to scroll and search as well. – comfreak Aug 28 '19 at 18:45