modprobe
The modprobe
command is used to load (or remove) modules from the kernel, and I’m wondering if it shouldn’t be insmod
to load them. Then I looked them up and they are different, although both can be used to load modules to and from the intranet.
insmod
: specifies which module is which, does not load dependent modulesmodprobe
: specifies which module to load, not only that module, but also other dependent modules automatically.
If modprobe
makes an error during loading, it unloads the entire group of modules. modprobe
looks for modules at /lib/modules/<uname -r>
, but does not load the exclusions configured in /etc/modprobe.conf
and /etc/modprobe.d/
.
Of course, the modprobe
dependency analysis is not done in a vacuum, but is generated by depmod
.
- Kernel Module Related Commands
lsmod
: displays status information about modules that have been loaded into the kernel.rmmod
: removal of the specified module from the kernel (modprobe is also a counterpart to insmod).dmesg
: View error logs during loading or unloading.bmodinfo
: displays detailed information about a given module.
ldconfig
The command ldconfig
is used to find a DLL in a specified location and load it into system memory (kernel space or user space?). (No deeper). So, this command is usually run at system startup, so that after we upgrade or compile the new DLLs ourselves, we need to run ldconfig
manually to get the new DLLs to take effect.
ldconfig
finds the DLL in the following locations.
/lib
/usr/lib
- The configuration file
/etc/ld.so.conf
. - The environment variable LD_LIBRARY_PATH corresponds to the directory.
Some notes.
ldconfig
stores the records of the loaded DLLs in a file located at:/etc/ld.so.cache
.- What
ldconfig
does has nothing to do with compile time, but everything to do with running the program, so you should add-L
at compile time, not to confuse it. - DLL files contain library metadata information, so it is not feasible to impersonate an identified library simply by changing the file name.