Interview Question
Developer Program EngineersCountry: India
modprobe reads the modules from /lib/modules/$(uname -r)/modules.dep.bin (or without the .bin suffix if the other file is not available). From the same file, dependencies are loaded.
modprobe accepts the name of a .ko file in /lib/modules/$(uname -r) (e.g. nvidia-current for the file dkms/nvidia-current.ko) and aliases (modules.alias.bin). Builtins (modules.alias.bin) are recognized as well, but since these modules are loaded by default, there is not point in modprobing this kind of modules.
insmod on the other hand accepts paths to files. The module does not have to reside in /lib/modules/$(uname -r), but dependencies are not automatically loaded. This is the lower program used by modprobe to load modules.
Both insmod and modprobe is using to insert kernel module.
But everyone will prefer modprobe because insmod have no capability to resolve dependency issue . But modprobe can do that.
While we are installing a module using modprobe , first it will check the dependancies in /lib/modules/<kernel-version>/modules.dep. This file contains entries for a module and its corresponding dependencies . modules.dep file is generated by “depmode” command.
modprobe in action :-
List available Kernel modules
# modprobe -l | more
List Currently loaded modules
# lsmod | more
Install new module
# modprobe <module name >
example :- modprobe ip_tables
Remove a module
# modprobe -r <module name>
we can use ” rmmod ” , also to delete a module. But admins prefer modprobe with -r option , because modprobe is cleverer than insmod and rmmod.
Both insmod and modprobe is using to insert kernel module.
But everyone will prefer modprobe because insmod have no capability to resolve dependency issue . But modprobe can do that.
While we are installing a module using modprobe , first it will check the dependancies in /lib/modules/<kernel-version>/modules.dep. This file contains entries for a module and its corresponding dependencies . modules.dep file is generated by “depmode” command.
modprobe in action :-
List available Kernel modules
# modprobe -l | more
List Currently loaded modules
# lsmod | more
Install new module
# modprobe <module name >
example :- modprobe ip_tables
Remove a module
# modprobe -r <module name>
we can use ” rmmod ” , also to delete a module. But admins prefer modprobe with -r option , because modprobe is cleverer than insmod and rmmod.
the two methods are
- Anni February 04, 20161. dynamic insertion as a kernel module (modeprobe and insmod)
2. linking statically to the kernel code