Skip to content

Linux Foundations / Understand the system underneath ยท Step 24 of 38

Lesson: Where the kernel livesSwitch
โ† Linux Foundations

System administration

Where the kernel lives

Find the kernel image, initramfs, configuration and modules on a Linux system.

A kernel is made of files you can find. Knowing them helps when an update fails or /boot fills up.

The /boot directory

bash
ls /boot

On Ubuntu you might see:

config-6.8.0-45-generic
grub
initrd.img-6.8.0-45-generic
System.map-6.8.0-45-generic
vmlinuz-6.8.0-45-generic

Your versions will differ, and there may be several sets.

What each file is

  • vmlinuz-... is the bootable, compressed kernel image that the boot loader loads.
  • initrd.img-... is the initramfs: a small temporary root filesystem in memory with the drivers and tools needed to reach the real root filesystem.
  • System.map-... is a table of kernel symbol names and addresses, used for debugging.
  • config-... records the options chosen when the kernel was built.

Differences between distributions

Fedora and RHEL family systems call the second file initramfs-<version>.img. Arch uses unversioned names such as vmlinuz-linux and initramfs-linux.img. Some setups that use systemd-boot or unified kernel images keep these files on the EFI system partition in other places.

You can search the options of your kernel:

bash
grep CONFIG_EXT4_FS= /boot/config-$(uname -r)
CONFIG_EXT4_FS=y

y means built into the kernel, and m means built as a module. If the file is missing, some systems provide the same information in /proc/config.gz.

Modules

Loadable modules are not in /boot. They are under a directory named after the kernel release:

bash
ls /lib/modules/$(uname -r)
kernel  modules.alias  modules.dep

The list is shortened. On many current systems /lib is a link to /usr/lib.

Which file was booted?

bash
cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-6.8.0-45-generic root=UUID=3f1c9a2e-7b4d-4c1a-9e0f-2a6b8c5d1e44 ro quiet

This is the command line given to the kernel. BOOT_IMAGE is added by GRUB, so other boot loaders may not show it.

A container uses the host's kernel, so do not expect to find that kernel in the container's /boot. Never delete files from /boot by hand to free space. Remove old kernel packages with the package manager instead. The search and archives lab helps you practise finding files.

Try it

  1. Run ls -lh /boot and compare the sizes.
  2. Run uname -r and find the files with the same version.
  3. Run df -h /boot to check free space.
  4. Run cat /proc/cmdline and identify the root setting.

Check your understanding

Where the kernel lives

All 4 sections ยท no timer

Unlimited retries

Questions from every section are combined into one assessment. Answer them all correctly to complete the article.

Your completion saves in this browser. Sign in to sync it to your account.