Based on the Linux Master 1 exam syllabusReport an error
/boot/vmlinuz-version, and modules are in /lib/modules/$(uname -r)/. You check the current version with uname -r.lsmod (loaded list, Used by) and modinfo (description, dependencies, parameters).insmod/rmmod (full path, manual dependencies) and high-level modprobe/modprobe -r (name only, automatic dependencies). It's the same pattern as rpm vs yum.make menuconfig (configure, .config) → make (build) → make modules_install (/lib/modules) → make install (/boot + GRUB). During configuration: * (built-in) / M (module) / blank (excluded)./boot.uname -r # currently running kernel version (e.g. 5.14.0-70.el9.x86_64)
uname -a # full information: kernel, hostname, architecture
ls /boot # vmlinuz-*, initramfs-*, config-*, etc.| File/Path | Meaning |
|---|---|
/boot/vmlinuz-version | Compressed kernel image (loaded at boot) |
/boot/initramfs-version.img | Initial RAM disk (drivers for early boot) |
/boot/config-version | Build configuration used when that kernel was made |
/lib/modules/version/ | Where the modules (.ko) for that kernel live |
/proc/sys/ | View and modify kernel parameters in real time |
The z in vmlinuz means compressed (zipped) — it is a compressed kernel image that gets decompressed into memory at boot. Modules are stored separately by kernel version under /lib/modules/$(uname -r)/. Because of this directory structure, modules don't get mixed up even if you install several kernel versions at the same time. The version that uname -r reports is exactly the name of the current module directory.
Kernel parameters are adjusted in real time through /proc/sys/ (virtual files that are readable and writable) and the sysctl command. For example, you can check the IP forwarding state with sysctl net.ipv4.ip_forward and turn it on with sysctl -w net.ipv4.ip_forward=1. For permanent application, write it in /etc/sysctl.conf. This is another way to "change behavior without rebuilding the kernel".
.ko = kernel object) is a part that is dynamically plugged into the kernel.lsmod # list of all currently loaded modules (+ usage count, dependent modules)
modinfo e1000 # detailed information on a specific module (description, dependencies, parameters)
modinfo -d e1000 # module description onlylsmod has three columns.Module Size Used by
e1000 159744 0
bluetooth 806912 9 btusb,...
| Column | Meaning |
|---|---|
| Module | Module name |
| Size | Memory footprint |
| Used by | Usage count + other modules that depend on this module |
If the "Used by" number in lsmod is greater than 0, it means something else is using that module, so you can't carelessly unload it. The names of the dependent modules are written alongside. lsmod is really just a nicely formatted view of /proc/modules. modinfo reads the metadata (author, license, parameters, dependencies) from the module file itself.
With modinfo, you can find out the parameters that the module accepts (the parm: lines). When loading a module you can adjust its behavior with modprobe module parameter=value, and to apply it automatically at boot, write options module parameter=value in /etc/modprobe.d/*.conf. To prevent a particular module from being loaded automatically, write blacklist module-name in the same directory.
insmod/rmmod) — handle a single module directly.modprobe) — also handles dependencies automatically.insmod /lib/modules/.../e1000.ko # load a module directly (full path, manual dependencies)
rmmod e1000 # remove a module
modprobe e1000 # load including dependent modules automatically (name only)
modprobe -r e1000 # remove, taking dependencies into account (remove)| Task | Low-level | High-level (recommended) |
|---|---|---|
| Load | insmod /path/mod.ko | modprobe mod |
| Remove | rmmod mod | modprobe -r mod |
| Input | Full path | Module name |
| Dependencies | Manual (fails if unresolved) | Resolved automatically |
The biggest difference between insmod and modprobe is automatic dependency resolution. insmod loads only the single .ko you specify, so if that module needs other modules, it fails with an error such as "Unknown symbol". modprobe consults /lib/modules/.../modules.dep (the dependency map), loads the needed modules first, and then loads the target. Moreover, insmod requires the full path, whereas modprobe needs only the name. So in both real work and the exam, modprobe is the answer in most cases.
The modules.dep that modprobe consults is generated by the depmod command. After putting a new module in /lib/modules/.../, you must run depmod -a so the dependency map is refreshed and modprobe can find that module. If you skip this step when building and adding a kernel module yourself, modprobe reports "module not found".
⚠️ Trap: It is common for unloading a module with
rmmodto fail with "Module is in use". This is because the "Used by" inlsmodis not 0. Usingrmmod -fto force removal is dangerous and not recommended. The standard approach is to unload the higher-level modules that depend on it first, or to remove everything together withmodprobe -r, which takes dependencies into account.
# Try it yourself — observing modules (safe: mostly queries)
lsmod | head # loaded modules
lsmod | wc -l # number of modules
modinfo loop # information on the loop module
cat /proc/modules | head # the source of lsmod
ls /lib/modules/$(uname -r)/kernel | head # module treecd /usr/src/linux-version # kernel source directory
make menuconfig # menu-based kernel configuration (generates .config)
make # compile kernel image + modules
make modules_install # install the compiled modules into /lib/modules/
make install # install the kernel image into /boot + update the bootloader| Step | Command | What it does |
|---|---|---|
| 1. Configure | make menuconfig | Choose which features/drivers to include, make modular, or exclude → .config |
| 2. Build | make | Compile the kernel image (vmlinuz) and modules (.ko) |
| 3. Install modules | make modules_install | Copy modules to /lib/modules/version/ |
| 4. Install kernel | make install | Place vmlinuz and initramfs in /boot and update the bootloader (GRUB) |
In the kernel configuration step, each feature is set to one of three states — * (built-in: included in the kernel), M (module: built as a separate .ko and loaded when needed), blank (excluded). The standard approach is to make frequently used core features built-in (*) and occasionally used device drivers modules (M). Making something a module shrinks the kernel image and also saves memory. This choice determines the list of modules that will be installed by make modules_install.
There are several configuration tools. make config (a primitive method that asks questions one by one), make menuconfig (a text menu based on ncurses, the most common), make xconfig (an X Window GUI), and make oldconfig (takes the existing .config and asks only about the items that changed for the new kernel). It is usually safe to copy the current kernel's /boot/config-$(uname -r) to .config and then start with make oldconfig.
⚠️ Trap: You must not change the order of the steps. Modules and the image are only created once
make(build) finishes, somake modules_installandmake installcome after it. Also,make modules_install(modules to /lib/modules) andmake install(kernel to /boot + GRUB update) are separate steps with different destinations. Answer choices that confuse the two as one appear on the exam. After installing a new kernel, you must choose the new kernel from the bootloader menu when booting for it to take effect.
The kernel that Linus Torvalds first released in 1991 was purely monolithic with no module concept — to support a new device you had to recompile the whole kernel. When loadable kernel modules (LKM) were introduced around 1995, it became possible to dynamically plug drivers into and out of a booted kernel. The fact that plugging in a USB stick is recognized immediately today, and that a distribution supports thousands of kinds of hardware with a single kernel, are both thanks to this module structure. "Modular monolithic", which compromises between the performance of a monolithic kernel and the flexibility of a microkernel, is Linux's design philosophy.
.ko (kernel object) : A kernel module file. A part that can be plugged into and out of the kernel.vmlinuz : A compressed (z = zipped) kernel image. It is decompressed into memory at boot./lib/modules/$(uname -r)/ : Where the modules dedicated to that kernel version live. They are split by version, so they don't get mixed up even when several kernels coexist.lsmod : The usage count and dependent modules of that module. If it is not 0, rmmod fails.modules.dep : The dependency map between modules. depmod -a creates it and modprobe consults it.insmod vs modprobe : Loading only a single module by full path vs automatically loading dependent modules too by name alone./etc/modprobe.d/*.conf to prevent a particular module from being loaded automatically.sysctl / /proc/sys/ : The command and virtual files for changing operating parameters in real time without rebuilding the kernel. For permanent application, use /etc/sysctl.conf.* / M / blank : The three choices in kernel configuration for making a feature built-in / separated as a module / excluded.Click a choice to reveal the answer and explanation.
Question 1
Which command checks the version of the currently running kernel?
Question 2
Which best describes the difference between insmod and modprobe?
Question 3
What does it mean when the "Used by" of a module in the lsmod output is not 0?
Question 4
Which command shows detailed information such as the description, dependencies, and parameters of a specific module?
Question 5
What is the role of the make menuconfig step in kernel compilation?
Question 6
What is the correct order of steps in a kernel compile?
Question 7
Which is the most appropriate reason for calling the Linux kernel "modular monolithic"?