Previous Lecture
Next Lecture
Topics Covered:
CONFIG_IKCONFIG
/proc/config.gz
extract-ikconfig
Kernel Config Verification
CONFIG_LOCALVERSION
/proc/cmdline
Linux 6.x
Why Verify? Trust, But Check.
You have gone through the effort of configuring, compiling, installing, and booting a custom Linux kernel. That is no small task. But how do you know for certain that the kernel you are running is actually the one you built — and that your configuration choices actually took effect?
Blindly assuming things is never a good practice in engineering. Linux gives you several tools to verify your kernel’s identity and configuration with confidence. In this tutorial, we cover three complementary methods that together give you a complete picture.
These techniques apply equally to kernel 6.x systems. In fact, in modern kernels the infrastructure has only improved — more configuration options are queryable, and the proc filesystem interface is rock-solid.
Here is a quick overview of the three methods we will explore in detail:
| # | Method | Tool Used | What It Tells You |
|---|---|---|---|
| 1 | Version check | uname -r |
Which kernel version is running right now |
| 2 | Embedded config extraction | extract-ikconfig |
Full kernel .config baked into the kernel image |
| 3 | Proc filesystem query | /proc/config.gz |
Same config but accessible at runtime via procfs |
Methods 2 and 3 both require that CONFIG_IKCONFIG was enabled when building your kernel. If you have not enabled it, only method 1 is available. We will explain how to check this and what to do in either case.
The quickest way to confirm you are running the right kernel is the uname command. It stands for unix name and reports information about the running system.
uname -r
The -r flag asks for the kernel release version. On a custom-built kernel 6.x, you might see:
6.8.0-myproject
This string comes directly from how you configured the kernel before building it. Let’s break it down:
| 6 | . | 8 | . | 0 | -myproject |
| Major version |
Minor version |
Patch level |
LOCALVERSION (your custom tag) |
The -myproject part comes from the CONFIG_LOCALVERSION setting in your kernel configuration. When you set it to -myproject during make menuconfig, it gets appended to the version string — making it immediately obvious which custom build is running.
For a more complete system info dump, use uname -a which shows everything:
uname -a
Linux myhostname 6.8.0-myproject #1 SMP PREEMPT Sat Jun 1 10:30:00 IST 2024 x86_64 x86_64 x86_64 GNU/Linux
| Field | Example | Meaning |
|---|---|---|
-s |
Linux | Operating system kernel name |
-n |
myhostname | Network hostname of the machine |
-r |
6.8.0-myproject | Kernel release version (most important) |
-v |
#1 SMP PREEMPT … | Build number and date of this kernel compilation |
-m |
x86_64 | Hardware (CPU) architecture |
-o |
GNU/Linux | Operating system |
Here is something many developers do not know: Linux can embed a copy of the entire .config file used to build it directly inside the kernel image. When you enable CONFIG_IKCONFIG during kernel configuration, the build system compresses and bakes the configuration file into the vmlinuz image itself.
This means you can always retrieve the exact configuration that was used to build any kernel image, even years later, as long as you have the vmlinuz file.
The tool to extract it is a shell script that comes with the kernel source:
scripts/extract-ikconfig /boot/vmlinuz-6.8.0-myproject
This dumps the full kernel configuration to stdout. Since it can be hundreds or thousands of lines, you typically pipe it to grep to find specific options:
# Check if a specific feature is enabled
scripts/extract-ikconfig /boot/vmlinuz-6.8.0-myproject | grep CONFIG_IKCONFIG
# Expected output:
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
Let’s look at what some typical options look like:
CONFIG_USB=m # As a module (loadable at runtime)
# CONFIG_HAMRADIO is not set # Disabled / not compiled
These three forms are how every configuration option appears. =y means the feature is compiled directly into the kernel binary. =m means it is built as a loadable kernel module. is not set means the feature was disabled.
CONFIG_IKCONFIG=y is already enabled by default, so the config is always available. On custom builds, you must explicitly enable it in make menuconfig under: General Setup → Kernel .config support.You do not even need the kernel source tree to use extract-ikconfig. The script can be obtained directly:
# On Ubuntu/Debian — the script is in the linux-source package
# Or you can use the one bundled with kernel-source package
# Alternative: use grep + dd (the old-school way that always works)
grep -a 'CONFIG_' /boot/vmlinuz-6.8.0-myproject | head -30
The third method is the most elegant. When you enable CONFIG_IKCONFIG_PROC (which requires CONFIG_IKCONFIG to also be enabled), the kernel exposes its own configuration as a compressed file in the proc filesystem at /proc/config.gz.
This means you can query the running kernel’s configuration at any time without touching any files on disk:
# Decompress and search for a config option
zcat /proc/config.gz | grep CONFIG_PREEMPT
# Expected output on a preemptible kernel:
CONFIG_PREEMPT=y
# CONFIG_PREEMPT_NONE is not set
You can also dump the entire config to a file for later comparison:
zcat /proc/config.gz > /tmp/running-kernel.config
| Config Option | What It Does | Enables |
|---|---|---|
| CONFIG_IKCONFIG=y | Embeds the .config inside the vmlinuz image | extract-ikconfig script (method 2) |
| CONFIG_IKCONFIG_PROC=y | Exposes that embedded config via /proc/config.gz | /proc/config.gz access (method 3) |
When you boot a freshly compiled kernel, here is a systematic checklist to verify everything is correct:
1
Confirm you are running the right kernel
uname -r
# Should show: 6.x.y-yourtag
2
Check the boot parameters the kernel received
cat /proc/cmdline
# Shows: BOOT_IMAGE=/boot/vmlinuz-6.x.y-yourtag root=UUID=... ro quiet splash
3
Verify CONFIG_IKCONFIG is enabled (prerequisite for steps 4 and 5)
zcat /proc/config.gz | grep CONFIG_IKCONFIG
# Expected:
# CONFIG_IKCONFIG=y
# CONFIG_IKCONFIG_PROC=y
4
Check specific config options you changed
zcat /proc/config.gz | grep -E "CONFIG_PREEMPT|CONFIG_SMP|CONFIG_HZ"
# Verify each option matches what you set during make menuconfig
5
Save the full config for documentation
zcat /proc/config.gz > /home/user/kernel-6.8.0-myproject.config
| Just booted your custom kernel | ||
| ↓ | ||
uname -r → Does the version string match? |
||
| ✅ YES → Continue | ❌ NO → Wrong kernel booted, check GRUB default | |
| ↓ | ||
zcat /proc/config.gz | grep CONFIG_IKCONFIG → Is it =y? |
||
| ✅ YES → Use zcat /proc/config.gz for all checks | ❌ NO → Use extract-ikconfig or rebuild with IKCONFIG=y | |
The concepts above apply to all modern kernels, but here are some specific things that differ between older 5.x kernels (used in many textbooks) and the current 6.x kernel series:
| Topic | Kernel 5.x (older textbooks) | Kernel 6.x (current) |
|---|---|---|
| GRUB version | GRUB 2.04 | GRUB 2.06 / 2.12 — same interface, more security features |
| CONFIG_IKCONFIG default | Off by default on most distros | On (=y) by default on Ubuntu 22.04+, Fedora 38+ |
| Single-user mode | append single or 1 |
systemd may still ask for root password — use init=/bin/bash for bypass |
| extract-ikconfig location | Only in kernel source tree | Available in linux-source package, or copy from scripts/ |
| Version numbering | 5.4.x, 5.10.x, 5.15.x | 6.1.x (LTS), 6.6.x (LTS), 6.8.x, 6.9.x etc. |
Interview Questions & Answers
Frequently asked questions in Linux kernel and embedded systems interviews on kernel configuration verification topics.
uname -r to display the kernel release version. For complete information including architecture and build date, use uname -a. The version string format is major.minor.patch-localversion, for example 6.8.0-myproject..config file directly inside the compiled kernel image (vmlinuz). This allows you to extract the exact configuration of any kernel image later, which is invaluable for auditing production systems, reproducing builds, and debugging configuration-related issues./proc/config.gz is a virtual file in the proc filesystem that exposes the running kernel’s configuration as a gzip-compressed file. It requires CONFIG_IKCONFIG_PROC=y to be set (in addition to CONFIG_IKCONFIG=y). You read it with zcat /proc/config.gz or zcat /proc/config.gz | grep OPTION_NAME.make menuconfig under General Setup → Local version – append to kernel release. After setting it to, say, -myproject, the kernel version shown by uname -r becomes 6.8.0-myproject. This is a simple and effective way to identify custom-built kernels at a glance.CONFIG_FOO=y means the feature is compiled directly into the kernel image and is always available. CONFIG_FOO=m means it is built as a loadable kernel module, which can be loaded or unloaded at runtime with modprobe. # CONFIG_FOO is not set means the feature is completely disabled and will not be available in any form./proc/cmdline shows the command-line arguments that were passed to the kernel by the bootloader (GRUB) at boot time — things like root=UUID=..., quiet, splash. These are runtime boot arguments. /proc/config.gz shows the build-time configuration options that were compiled into the kernel — the contents of the .config file used when running make. Both are important but answer different questions about the kernel.zcat /proc/config.gz | grep CONFIG_SMP. If /proc/config.gz is not available, try grep -a CONFIG_SMP /boot/vmlinuz-$(uname -r) or use the extract-ikconfig script on the vmlinuz image. Additionally, uname -a output contains “SMP” in the version string if SMP is enabled.Well Done — Chapter 3 Complete!
You now know how to boot a custom kernel, customize GRUB, and verify your kernel configuration. Ready for Chapter 4?
Previous Lecture Next Lecture
