Check module status with modprobe --dry-run
In this step, you'll learn how to use the modprobe command with the --dry-run option to check if a module can be loaded and what other modules it depends on, without actually loading it.
The modprobe command is used to add or remove modules from the Linux kernel. It's more sophisticated than the older insmod and rmmod commands because it understands module dependencies. When you try to load a module with modprobe, it will automatically load any other modules that the requested module requires.
The --dry-run option is very useful for testing. It tells modprobe to go through the process of resolving dependencies and checking if the module can be loaded, but it won't actually load the module into the kernel. This allows you to see if there are any issues or missing dependencies before making changes to the running system.
Let's try checking the status of a common module, for example, the fuse module, which is often used for user-space filesystems.
Type the following command in your terminal:
modprobe --dry-run fuse
Press Enter.
If the fuse module and its dependencies are available, you might see output similar to this:
modprobe: INFO: could not insert 'fuse': File exists
This output indicates that the fuse module is likely already loaded (as seen in the previous lsmod step), and modprobe is reporting that it cannot insert it again because it already exists. The --dry-run option still performs the dependency check even if the module is already loaded.
If the module wasn't loaded and could be loaded, the output might be empty or indicate the modules that would be loaded. If there were issues, modprobe would report them here.
Using --dry-run is a safe way to test module loading without affecting your system's state.
Now, try running the modprobe --dry-run fuse command yourself.
Click Continue to move on.