For regular Debian the kernel configuration is stored in /boot/confg-<version>. I looked for Raspbian's equivalent but did not find it there.

However, as also mentioned and thanks to this and another posts' answers, I did find: /proc/config.gz on my precious Raspberrypi, containing a configuration list closely resembling what I would expect from a kernel's config file.

Does this /proc/config.gz archive indeed contain the running Raspbian's kernel configuration settings (assuming I did not alter the kernel configuration myself)?

  • I think /proc/config.gz did contain that information, but I don't think it exists anymore. – joan Aug 24 '16 at 20:06
  • @joan May you be referring to Raspberry Pi 2 and/or 3? I do have it present on my freshly (yesterday) installed Raspbian for RPi1. – woosting Aug 24 '16 at 20:09
  • That could well be the case. I only have a Pi2 running at the moment. I used to use /proc/config.gz when I was building kernels but that would have been on earlier Pi models. – joan Aug 24 '16 at 20:32
  • 1
    @joan It's still there for both stock kernels, it's just compiled in as a module which isn't loaded by default (see below). – goldilocks Aug 25 '16 at 10:44

Yes; /proc/config.gz, if it exists, always refers to the running kernel's configuration (but see the last few paragraph below) since procfs, like sysfs and devtmpfs, which are used to implement the trees mounted at /proc, /sys, and /dev respectively are not on-disk storage or files at all in a conventional sense (depending what your "conventional" is). They're kernel interfaces, which is why most of them have a size of zero -- config.gz is an exception in this sense and will stat an actual and appropriate size, but it still only exists in RAM as part of the kernel.

This is an optional feature, and it may be compiled as a module, which it is in the Raspbian kernels. This means to find it you first have to:

sudo modprobe configs

And presto, /proc/config.gz will appear. For those unfamiliar with .gz this is a compression format; you need to copy that out and uncompress it, and note since you can't write new files to /proc it must be to somewhere else. In one step:

gunzip -c /proc/config.gz > ~/kernel.config

You don't need to use sudo since the file is world readable.

Beware that the configuration is from when the kernel was compiled, and includes options that were compiled as modules. Since you can remove modules from the system and install new ones without recompiling the kernel, it can be inaccurate in that sense. This is relevant if you build your own kernel, then add modules later, then use that file to configure another (upgraded) kernel down the line -- any of the modules you added in the meantime won't be included.

I'd also guess when modular you could swap in a different configs.ko which could report a completely different configuration. I haven't tried this but I should since it would resolve the "whoops what did I do with the real current configuration" issue just mentioned...

  • Wow... I keep being amazed by the elaborate quality of the answers (too bad I am not allowed to vote-up yet)! Thanks all! – woosting Aug 25 '16 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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