"FATAL: Error de módulo no encontrado" usando modprobe


Tengo un problema con el comando modprobe... Compilé el módulo hello world y lo cargué con insmod, funciona bien y cuando lo hago lsmod, puedo verlo en la lista de salida. Pero cuando inserto este módulo usando modprobe estoy recibiendo un error FATAL:

root@okapi:/home/ravi# modprobe ./hello.ko 
FATAL: Module ./hello.ko not found.
root@okapi:/home/ravi#

Aquí está el código del módulo:

#include <linux/init.h>
#include <linux/module.h>

MODULE_LICENSE("Dual BSD/GPL");

static int hello_init(void)
{
        printk(KERN_ALERT "Hello, world\n");
        return 0;
}
static void hello_exit(void)
{
        printk(KERN_ALERT "Goodbye, cruel world\n");
}

module_init(hello_init);
module_exit(hello_exit);

Y Makefile

obj-m += hello.o

all:
        make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
        make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
Author: fduff, 2010-06-29

6 answers

La razón es que modprobe busca en /lib/modules/$(uname -r) los módulos y, por lo tanto, no funciona con la ruta del archivo local. Esa es una de las diferencias entre modprobe y insmod.

 24
Author: che,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-05-20 16:01:43

Lo mejor es usar el makefile del kernel para instalar el módulo:

Aquí están los fragmentos de código para agregar a su Makefile

alrededor de la parte superior añadir:

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

alrededor del final añadir:

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

Y luego puede emitir

    sudo make install

Esto lo pondrá en/lib / modules / modules (uname-r)/extra/

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

Y ejecutar depmod apropiadamente

 5
Author: Elf King,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-06-29 23:12:29

Intenta insmod en lugar de modprobe. Modprobe busca en el directorio de módulos / lib / modules / uname -r para todos los módulos y otros files

 2
Author: Sjoerd,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-06-29 12:19:50

Creo que debería haber una entrada de tu your_module.ko in/lib / modules / uname -r/modules.dep y in/lib / modules / uname -r/modules.dep.bin para que funcione el comando" modprobe your_module "

 1
Author: sharath kumar,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-13 09:31:24
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)

O

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

Luego haga modprobe module_name (sin.extensión ko)

 0
Author: Gouse,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-02-23 09:29:46

Asegúrese de que su red se desconecta antes de cargar el módulo:

sudo stop networking

Me ayudó - https://help.ubuntu.com/community/UbuntuBonding

 0
Author: Yaroslav,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-03-16 19:05:25