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?
Depending on your system, you'll find it in any one of these:
and possibly more places.
For an actual running kernel, one way to get the config file this is to
cat /proc/config.gz | gunzip > running.config
zcat /proc/config.gz > running.config
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
[*] 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
A Little bit late but maybe it helps someone. I didn't have
/boot/config-$(uname -r) on my Computer. I had to run
modprobe configs as root. Then,
/proc/config.gz was present
If you couldn't find kernel configuration in /boot/ nor in /proc/config.gz, you can try extracting this information from the kernel itself.
Inside any kernel source code there is a script for extracting config located in
scripts/extract-ikconfig, pass the kernel you want its configuration as parameter to this script.
This solution will only work if
Kernel .config support was enabled in the compiled kernel.
Independently of the distribution, you can run:
cat /lib/modules/$(uname -r)/build/.config
Source: https://linux.die.net/man/5/proc (search for