insmod: Invalid module format error | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

insmod: Invalid module format error

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-02-2012
rupeshkp728 rupeshkp728 is offline
Registered User
 
Join Date: May 2010
Last Activity: 8 October 2014, 5:26 AM EDT
Posts: 172
Thanks: 120
Thanked 1 Time in 1 Post
insmod: Invalid module format error

I have open suse kernel kernel 3.1.0-1.2-desktop on which I used kernel source 3.1.10-1.2 downloaded from kernel.org.

The module gets built.
While loading a kernel module I am getting Invalid module format error with description "first_driver: no symbol version for module_layout"

The following are the logs:

Code:
linux-k2kj:/home/rkpsuse/FirstDriver # insmod first_driver.ko 
insmod: error inserting 'first_driver.ko': -1 Invalid module format

linux-k2kj:/home/rkpsuse/FirstDriver # modinfo first_driver.ko 
filename:       first_driver.ko
description:    My First Driver
author:         Emertxe Info. Tech
license:        GPL
srcversion:     C4CCFC5DA59927FA4A479E6
depends:        
vermagic:       3.1.10-1.2-desktop SMP preempt mod_unload modversions 686 

linux-k2kj:/home/rkpsuse/FirstDriver # uname -r
3.1.0-1.2-desktop

dmesg
first_driver: no symbol version for module_layout

I guess this is because of mismatching kernel versions.

Cannot I use kernel source 3.1.10-1.2-desktop on kernel 3.1.0-1.2-desktop?
Where can I get the kernel source for 3.1.0-1.2-desktop

How to resolve this issue?
Sponsored Links
    #2  
Old 02-02-2012
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 17 December 2014, 4:46 PM EST
Location: Saskatchewan
Posts: 20,015
Thanks: 855
Thanked 3,448 Times in 3,221 Posts
You should be using suse's kernel source, not kernel.org's kernel source. They probably have their own patches and changes which make building your own drivers from a custom kernel and having them work with your existing one difficult.
The Following User Says Thank You to Corona688 For This Useful Post:
rupeshkp728 (02-02-2012)
Sponsored Links
    #3  
Old 02-02-2012
rupeshkp728 rupeshkp728 is offline
Registered User
 
Join Date: May 2010
Last Activity: 8 October 2014, 5:26 AM EDT
Posts: 172
Thanks: 120
Thanked 1 Time in 1 Post
Thanks Coronna for the reply.
Where can I find the suse kernel source?

Are the sites:
kernel-source-3.1.0-1.2.1.noarch.rpm openSUSE 12.1 Free Download

or

RPM resource kernel-source

fine to download the suse kernel source?
    #4  
Old 02-02-2012
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 17 December 2014, 4:46 PM EST
Location: Saskatchewan
Posts: 20,015
Thanks: 855
Thanked 3,448 Times in 3,221 Posts
I'd be shocked if SUSE didn't have a way to download packages itself, instead of forcing you to install random RPM's trawled manually from the internet in the hope they're the "right" ones.
Sponsored Links
    #5  
Old 02-03-2012
rupeshkp728 rupeshkp728 is offline
Registered User
 
Join Date: May 2010
Last Activity: 8 October 2014, 5:26 AM EDT
Posts: 172
Thanks: 120
Thanked 1 Time in 1 Post
I have linux installed in vmware which is not connected to net and so I have to manually download the source.

---------- Post updated 02-03-12 at 01:03 PM ---------- Previous update was 02-02-12 at 08:56 PM ----------

Now I have open suse kernel kernel 3.1.0-1.2-desktop and its kernel source.

Again the module gets built.
While loading a kernel module I am getting Invalid module format error with description "first_driver: no symbol version for module_layout"

The following are the logs:

Code:
linux-k2kj:/home/rkpsuse/Emertxe/CourseTemplates/FirstDriver # insmod first_driver.ko 
insmod: error inserting 'first_driver.ko': -1 Invalid module format

linux-k2kj:/home/rkpsuse/Emertxe/CourseTemplates/FirstDriver # modinfo first_driver.ko 
filename:       first_driver.ko
description:    My First Driver
author:         Emertxe Info. Tech
license:        GPL
srcversion:     C4CCFC5DA59927FA4A479E6
depends:        
vermagic:       3.1.0-1.2-desktop SMP preempt mod_unload modversions 686 

linux-k2kj:/home/rkpsuse/Emertxe/CourseTemplates/FirstDriver # dmesg | tail
[ 8797.391736] first_driver: no symbol version for module_layout

linux-k2kj:/home/rkpsuse/Emertxe/CourseTemplates/FirstDriver # uname -r
3.1.0-1.2-desktop

FYI I have compiled the kernel as follows:
Make mrprpoper
make menuconfig
Make
Make modules
Make modules_install
Make install

Am I missing something?
How to resolve this issue?
Sponsored Links
    #6  
Old 02-03-2012
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 17 December 2014, 4:46 PM EST
Location: Saskatchewan
Posts: 20,015
Thanks: 855
Thanked 3,448 Times in 3,221 Posts
Did you build your new kernel starting with the same options your original kernel was built with? They may be available in /proc/config.gz. They may also be stored under /boot somewhere, as config-kernelname. Kernel settings can drastically alter the way the kernel works so, if you don't build the kernel with the right options, the module won't match the kernel, and the kernel will rightly refuse to load it.


Code:
modprobe config # might not be necessary
gunzip < /proc/config.gz > .config
make menuconfig

The Following User Says Thank You to Corona688 For This Useful Post:
rupeshkp728 (02-03-2012)
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
module has an invalid magic number edgarvm AIX 1 07-09-2010 01:45 AM
insmod error - no such device Brian-UOIT UNIX for Dummies Questions & Answers 1 10-07-2008 11:30 AM
Much time in insmod of huge kernel module ptprabu Programming 0 11-28-2007 11:48 AM
insmod: a module named e1000 already exists admart IP Networking 0 12-30-2005 01:51 PM



All times are GMT -4. The time now is 09:24 AM.