Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I accidentally deleted my .config for my kernel configuration on Linux, and seem to remember there was a way to retrieve the kernel configuration via the proc filesystem somehow.

Is this still possible, and if so how would I do it?

share|improve this question
    
you should accept new123456's answer – mgalgs Oct 5 '12 at 19:02
    
@Sonny Ordell: There are now two valid answers. Can you accept one of them? – Hennes Oct 2 '13 at 14:43
    
@Hennes User has not been online since Jun 27 '11 at 16:19. Don't think he's going to be accepting anything. – DanteTheEgregore Oct 2 '13 at 14:49
    
  1. /proc/config.gz
  2. /boot/config
  3. /boot/config-$(uname -r)

Depending on your system, you'll find it in any one of those (possibly more) places.

share|improve this answer
    
On some distros (Fedora/Redhat) it's /boot/config-2.6.18-194.el5 or similar, with the kernel release string appended. – Phil May 23 '11 at 15:50
1  
@Phil I run a distro (Zenwalk) where those filenames are symlinked by the latest kernel package to /boot/config. I'll go ahead and add these to the list - thanks for reminding me. – new123456 May 23 '11 at 20:15

For an actual running kernel, one way to get the config file this is to

cat /proc/config.gz | gunzip > running.config

or,

zcat /proc/config.gz > running.config

Then running.config will contain the configuration of the running linux kernel.

However this is only possible if your running linux kernel was configured to have /proc/config.gz. The configuration for this is found in

  • General setup
    • [*] Kernel .config support
      • [*] Enable access to .config through /proc/config.gz

Most distributions do not have this configuration set. They provide kernel config files in their kernel packages and is usually found in /boot/ directory.

share|improve this answer
    
These are known as CONFIG_IKCONFIG and CONFIG_IKCONFIG_PROC, if you're grepping for them. – chronospoon Mar 26 '15 at 18:34

A Little bit late but maybe it helps someone. I didn't have /proc/config.gz nor /boot/config nor /boot/config-$(uname -r) on my Computer. I had to run modprobe configs as root. Then, /proc/config.gz was present

share|improve this answer
    
Can confirm on Intel MIC embedded Linux (BusyBox), this is necessary and works. – Mark Lakata Feb 23 at 18:59
1  
Same for Raspbian on Raspberry Pi 2 – Drew McGowen Mar 24 at 2:39
1  
FATAL: Module configs not found. on OMV 2.2 (Debian Wheezy) so glad they provided it in /boot/config-$(uname -r) – lliseil Apr 12 at 11:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .