Sagar Jain Sagar Jain - 4 months ago 34
Linux Question

What's the difference between insmod and modprobe?

I know

are used to insert module into the kernel.
But, what's the difference between them?

And, why is it dangerous to insert modules with
option in modprobe?


modprobe is the intelligent version of insmod. insmod simply adds a module where modprobe looks for any dependency (if that particular module is dependent on any other module) and loads them.

Regarding --force option, here is the quote from the man page:

   Try to strip any versioning information from the module which might otherwise
   stop it from loading: this is the same as using both --force-vermagic and
   --force-modversion. Naturally, these checks are there for your protection,
   so using this option is dangerous unless you know what you are doing.

Which indicates it's been used to skip the kernel module version checking. Shouldn't be any problem if you do your own kernel module or from any trusted party. But you should know what you are doing.