“FATAL: Module not found error” using modprobe

前端 未结 6 621
猫巷女王i
猫巷女王i 2021-01-31 18:03

I have a problem with modprobe command... I compiled the hello world module and loaded it with insmod, it works fine and when I do lsmod,

相关标签:
6条回答
  • 2021-01-31 18:41
    Insert this in your Makefile
    
     $(MAKE) -C $(KDIR) M=$(PWD) modules_install                      
    
     it will install the module in the directory /lib/modules/<var>/extra/
     After make , insert module with modprobe module_name (without .ko extension)
    

    OR

    After your normal make, you copy module module_name.ko into   directory  /lib/modules/<var>/extra/
    

    then do modprobe module_name (without .ko extension)

    0 讨论(0)
  • 2021-01-31 18:42

    The reason is that modprobe looks into /lib/modules/$(uname -r) for the modules and therefore won't work with local file path. That's one of differences between modprobe and insmod.

    0 讨论(0)
  • 2021-01-31 18:42

    Try insmod instead of modprobe. Modprobe looks in the module directory /lib/modules/uname -r for all the modules and other files

    0 讨论(0)
  • 2021-01-31 18:45

    The best thing is to actually use the kernel makefile to install the module:

    Here is are snippets to add to your Makefile

    around the top add:

    PWD=$(shell pwd)
    VER=$(shell uname -r)
    KERNEL_BUILD=/lib/modules/$(VER)/build
    # Later if you want to package the module binary you can provide an INSTALL_ROOT
    # INSTALL_ROOT=/tmp/install-root
    

    around the end add:

    install:
            $(MAKE) -C $(KERNEL_BUILD) M=$(PWD) \
               INSTALL_MOD_PATH=$(INSTALL_ROOT) modules_install
    

    and then you can issue

        sudo make install
    

    this will put it either in /lib/modules/$(uname -r)/extra/

    or /lib/modules/$(uname -r)/misc/

    and run depmod appropriately

    0 讨论(0)
  • 2021-01-31 18:48

    i think there should be entry of your your_module.ko in /lib/modules/uname -r/modules.dep and in /lib/modules/uname -r/modules.dep.bin for "modprobe your_module" command to work

    0 讨论(0)
  • 2021-01-31 18:59

    Ensure that your network is brought down before loading module:

    sudo stop networking
    

    It helped me - https://help.ubuntu.com/community/UbuntuBonding

    0 讨论(0)
提交回复
热议问题