Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-21-2016, 06:43 PM   #1
LQ Newbie
Registered: Nov 2010
Posts: 3

Rep: Reputation: 0
kernel module failure for insmod


I am trying to do a insmod of a simple hello world program. Compilation goes fine, but on doing insmod, I get "Invalid module format" error. There are no other messages in dmesg or /var/log/messages when the insmod fails. Details below. Someone please help me unblock this.

strings -a hello.ko | grep -i gcc
GCC: (GNU) 4.9.2
GCC: (GNU) 4.9.2

file hello.ko
hello.ko: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), BuildID[sha1]=5ca50d7986d0e5708d7087130bd93c2d6ef1be4a, not stripped

OPS#insmod hello.ko
insmod: ERROR: could not insert module hello.ko: Invalid module format

OPS# uname -a
Linux switch 3.9.11 #1 SMP Wed Mar 23 21:56:40 UTC 2016 x86_64 GNU/Linux

OPS# modinfo hello.ko
filename: /home/root/hello.ko
description: A Simple Hello World module
author: Name1
license: GPL
srcversion: F545620F75762B1AAE668ED
vermagic: 3.9.11 SMP mod_unload

dmesg | grep -i gcc
[ 0.000000] Linux version 3.9.11 ( (gcc version 4.9.2 (GCC) ) #1 SMP Wed Mar 23 21:56:40 UTC 2016

file output for something which is already installed fine:

file /lib/modules/3.9.11/kernel/net/ipv4/ipcomp.ko
/lib/modules/3.9.11/kernel/net/ipv4/ipcomp.ko: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), BuildID[sha1]=ec09809676e493b03bac76d6f2d4a0d4194676b3, not stripped

Old 06-09-2016, 12:29 AM   #2
Registered: Jun 2015
Distribution: Debian
Posts: 37

Rep: Reputation: 4
Are you sure you've built the module against the headers of the kernel version you're trying to insert it into?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Invalid module format when insmod the kernel module georgewhr Linux - Software 1 10-20-2013 11:41 AM
[SOLVED] kernel module insmod problem HGaurav Programming 1 08-03-2009 08:13 AM
kernel module ( hello word ) insmod fail ptlchetan Programming 4 10-13-2006 04:32 AM
How/Where To Make *.ko file so I can insmod module into Kernel? pat_and_cami Programming 1 04-09-2006 03:48 AM
kernel module insertion using insmod on kernel 2.4.20-8, rh 9.0 gooner Red Hat 1 05-27-2004 05:31 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:41 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration