LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 09-10-2008, 10:51 AM   #1
kovlensky
LQ Newbie
 
Registered: Sep 2008
Posts: 3

Rep: Reputation: 0
"Invalid module format" after recompiling kernel without changing .config - why?


Summary for impatient readers - after recompiling stock module without changing single option vendor-supplied modules stop loading (and crash, when forced to load). The question is why?

Long story - I've got Suse 10 machines here running stock kernel and having few closed source modules installed. As I have urgent need for compilig customized kernel I gave it quick shot. The idea is simple - I've got full kernel sources used for compliation, .config and proper environment it was compiled in, so what's the problem? Well, there is. Every single external module working with supplied kernel does not load after recompilation.

How recompilation is done? That's simple:
# uname -r
2.6.16.21-0.8-smp
# rpm -qa|grep 2.6.16.21-0.8
kernel-source-2.6.16.21-0.8
kernel-smp-2.6.16.21-0.8
# cd /usr/src/linux-2.6.16.21-0.8
# zcat /proc/config.gz >.config

later on usual stuff - make clean, bzImage, modules, modules_install, depmod, mkinird, and boot it all up. Modinfo data seem ok - the first one is from closed source module (infinipath), the other one from recompiled module. I can see no single difference, but there must be one.

Any ideas?

# modinfo /lib/modules/2.6.16.21-0.8-smp/updates/ib_mad.ko
filename: /lib/modules/2.6.16.21-0.8-smp/updates/ib_mad.ko
license: Dual BSD/GPL
description: kernel IB MAD API
author: Hal Rosenstock
author: Sean Hefty
vermagic: 2.6.16.21-0.8-smp SMP gcc-4.1
depends: ib_core,ib_core
srcversion: 2020C495F1D3BD881B84968
# modinfo /lib/modules/2.6.16.21-0.8-smp/kernel/fs/
9p/ befs/ cramfs/ freevxfs/ jffs/ nfs/ qnx4/ smbfs/
adfs/ bfs/ dmapi/ fuse/ jffs2/ nfs_common/ quota_v1.ko sysv/
affs/ binfmt_misc.ko efs/ hfs/ jfs/ nfsd/ quota_v2.ko udf/
afs/ cifs/ exportfs/ hfsplus/ lockd/ nls/ reiserfs/ ufs/
autofs/ coda/ ext3/ hpfs/ msdos/ ntfs/ relayfs/ vfat/
autofs4/ configfs/ fat/ jbd/ ncpfs/ ocfs2/ romfs/ xfs/
# modinfo /lib/modules/2.6.16.21-0.8-smp/kernel/fs/fat/fat.ko
filename: /lib/modules/2.6.16.21-0.8-smp/kernel/fs/fat/fat.ko
license: GPL
vermagic: 2.6.16.21-0.8-smp SMP gcc-4.1
depends:
srcversion: 2A176656DA905B97EC126BF
 
Old 09-10-2008, 10:54 AM   #2
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 60
Look at the dmesg output after you attempt to load the module. It will have some useful information about the error. I suspect there's a problem with version mismatch.
 
Old 09-10-2008, 11:09 AM   #3
kovlensky
LQ Newbie
 
Registered: Sep 2008
Posts: 3

Original Poster
Rep: Reputation: 0
That's obvious that the case is version mismatch, otherwise these modules would simply load and work, right? The question was why, when having exact sources and no single .config entry modified? Every single vendor-supplied module complains.

ib_mad: disagrees about version of symbol struct_module
 
Old 09-10-2008, 11:51 AM   #4
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 60
Quote:
Originally Posted by kovlensky View Post
That's obvious that the case is version mismatch, otherwise these modules would simply load and work, right? The question was why, when having exact sources and no single .config entry modified? Every single vendor-supplied module complains.

ib_mad: disagrees about version of symbol struct_module
Where did you get the sources? From kernel.org or from SUSE? By "version" I meant the version lines in the Makefile of your sources. Like these

VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 24
EXTRAVERSION = .5

Check with head /usr/src/linux/Makefile

If these variables don't match, the modules will not load. And they are set in the Makefile, not in the .config. So, if you get source from someplace other than your official distro vendor, they will be different. Although, you can set them yourself.
 
Old 09-10-2008, 12:33 PM   #5
kovlensky
LQ Newbie
 
Registered: Sep 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Both kernel binaries and kernel sources come from SLES10 GA. rpms are called kernel-source-2.6.16.21-0.8 and kernel-smp-2.6.16.21-0.8. There is no Makefile problem unless some data are not displayed - vermagic strings match and that's where data from makefile go. Also .config files extracted from both stock and recompiled kernel match. Makefile settings can be displayed BTW - that's what uname is for.

I'll ask from the other side - when you want to recompile stock kernel the procedure is to install source rpm corresponding to your release, get .config from your kernel or /boot/config.whatever (both match BTW), and simply rebuild the kernel. According to every single piece of documentation I found new kernel should be compatible with the old one. But it isn't. So what was missing on the way? I know the reason looks clear - "disagrees about version of symbol struct_module" message - but how to extract verion of symble struct_module mentioned form both kernel and module? Kernel disagreed, but every single tool that comes into my mind can find no difference.

BTW - stock kernel is also unable to load recompiled modules. So the question is how to display what exactly the difference is.
 
Old 09-10-2008, 12:42 PM   #6
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 60
Does your new kernel have a "smp" in its version string, just like the old did? If so, I don't know what else to check...
 
  


Reply


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
Cisco VPN Client on FC6 2.6.20 "invalid module format" rrautens Fedora 16 06-07-2007 09:21 PM
Realtek 8180 ,Debian, "Invalid module format" medo Linux - Wireless Networking 0 05-25-2005 07:08 AM
fglrx - "Invalid module format" Carl-Fredrik Linux - Hardware 1 10-29-2004 10:55 AM
"Invalid module format" after FULL kernel recompile RedDwarf Linux - General 6 08-07-2004 07:46 PM
"Invalid module format" when I try to install my ATI drivers freddurgan Linux - Newbie 2 05-21-2004 10:49 PM


All times are GMT -5. The time now is 07:39 AM.

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