Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there a way to know if the kernel was compiled with a certain option activated (i.e. CONFIG_PROC_EVENTS=y) without having to pull out the kernel sources package and looking in the config file?

share|improve this question
add comment

2 Answers

Kernel options can be found in /proc/config.gz.

zgrep CONFIG_PROC_EVENTS= /proc/config.gz
share|improve this answer
5  
This only works if kernel is compiled with CONFIG_IKCONFIG_PROC set. –  Bruce Ediger Jul 17 '13 at 3:46
    
This did not work for me on any of the distros that I had available: Debian, RedHat based, nor Ubuntu. These are all stock systems so I don't think this approach is that useful unless you built your kernel yourself or your particular distro provides it. –  slm Jul 17 '13 at 11:25
    
In distro kernels, the IKCONFIG option may be enabled only as a module. Try to modprobe configs and check if /proc/config.gz shows up. –  XZS Sep 5 '13 at 15:21
add comment

If you look through your /boot directory you'll notice these files:

$ ls -l /boot/|grep config
-rw-r--r--  1 root root   109919 Oct 21  2011 config-2.6.35.14-100.fc14.x86_64
-rw-r--r--  1 root root   109919 Oct 27  2011 config-2.6.35.14-103.fc14.x86_64
-rw-r--r--  1 root root   109919 Nov 23  2011 config-2.6.35.14-106.fc14.x86_64

Notice what version of the Kernel you're using:

$ uname -r
2.6.35.14-106.fc14.x86_64

If you grep through the appropriate "config-uname -r" file you can see what options the Kernel was built with:

$ grep CONFIG_PROC_EVENTS= /boot/config-`uname -r`
CONFIG_PROC_EVENTS=y

References

share|improve this answer
2  
That's true in Debian based distros, but may not be true in others, i.e. Arch Linux. –  ntrrgc Jul 17 '13 at 6:56
    
@ntrrgc - I can't confirm for ArchLinux, but it's that way for RedHat, Debian, & Ubuntu. These 3 distros cover most of the *nix world. If someone has a ArchLinux distro can you please confirm this approach? –  slm Jul 17 '13 at 11:24
    
I use Arch Linux and I can confirm this does not work in Arch Linux. –  ntrrgc Jul 17 '13 at 15:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.