LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Invalid module format "no symbol version for module_layout" (https://www.linuxquestions.org/questions/linux-kernel-70/invalid-module-format-no-symbol-version-for-module_layout-4175634069/)

SUSESailor 07-15-2018 04:31 AM

Invalid module format "no symbol version for module_layout"
 
Hello, all.

I just compiled a module for my kernel, following all of the instructions, but when I modprobe the module, I get the "Invalid module format" error and dmesg reports "no symbol version for module_layout".

Now, my research tells me that this would happen if I compiled the module without a Module.symvers file, but I did have one. It was in the particular source directory where I was compiling the module, and it was copied from the one in the main source directory. That one had been generated locally through the make modules command. I got no error messages about a missing Module.symvers when I was compiling the module.

The only thing I can think of is that it is still seeing the old module that I had compiled before I generated the Module.symvers file, but if that's true, how do I get rid of the old module and replace it with the new one?

Thanks in advance!

smallpond 07-16-2018 02:49 PM

"make modules_install" should replace the old copy in /lib/modules/`uname -r`.

Make sure that you have removed the module from the running kernel using modprobe -r before trying to load the new copy.

SUSESailor 07-16-2018 03:31 PM

There never was any old module to rmmod. I am adding a new module that hadn't previously been compiled into the kernel.

The thing is that I had previously tried to compile the new module without Module.symvers and it gave me the exact same error as above. And even with the new one having been compiled WITH Module.symvers, I still get the same error message. So, the only thing I can think of is that the old version of the new module that was compiled without Module.symvers is still the one it's trying to load.

And I manually removed the old attempt at compiling the module from the /lib/modules directory before copying in the new one and running depmod -A.

smallpond 07-17-2018 09:08 AM

You shouldn't need to copy the Module.symvers file. The -C $KDIR tells make where to find the kernel source.

https://elixir.bootlin.com/linux/lat...ld/modules.txt

SUSESailor 07-17-2018 08:11 PM

Okay, then why am I getting this error message?

All of the research that I did says that you get this error message if you compile an external module without Module.symvers. Well, now I've done it both ways - with and without Module.symvers - and I still get the error message. The module still doesn't load and it still tells me "no symbol version for module_layout."

What do I do?

Mara 07-22-2018 08:44 AM

This might be a basic question, but are you sure you compile your module against the kernel you load it to? Could you show us your Makefile and the build command please?

AwesomeMachine 07-25-2018 01:15 AM

Did you run depmod?


All times are GMT -5. The time now is 09:32 PM.