linux内核模块加载失败,Linux内核模块加载报错”no symbol version for struct_module”解决办法...

编译iscsi_trgt内核模块后,加载模块失败,提示“Invalid module format“,通过dmesg看到内核打印“no symbol version for struct_module“。

[root@xenserver-chen iscsitarget-1.4.20.2]# insmod /root/iscsitarget-1.4.20.2/kernel/iscsi_trgt.ko

insmod: error inserting ‘/root/iscsitarget-1.4.20.2/kernel/iscsi_trgt.ko’: -1 Invalid module format

[root@xenserver-chen iscsitarget-1.4.20.2]# dmesg

iscsi_trgt: no symbol version for struct_module

[root@xenserver-chen iscsitarget-1.4.20.2]#

使用modinfo查看iscsi_trgt模块vermagic与系统其它模块一致,同时编译模块时指向的内核源码目录、内核.config配置文件均与当前内核版本相同。多次编译,加载还是失败。

进入内核源码目录,发现少了文件Module.symvers,重新编译内核源码make vmlinuz后,生成Module.symvers文件。再次编译iscsi_trgt内核模块,加载成功。问题得到解决。

[root@xenserver-chen linux-2.6.27.42-0.1.1.xs5.6.0.44.111158]# uname -a

Linux xenserver-chen 2.6.27.42-0.1.1.xs5.6.0.44.111158xen #1 SMP Mon May 3 21:26:51 EDT 2010 i686 i686 i386 GNU/Linux

[root@xenserver-flashcache kernel]# modinfo iscsi_trgt.ko

filename:       iscsi_trgt.ko

author:         IET development team

description:    iSCSI Enterprise Target

license:        GPL

version:        1.4.20.2

srcversion:     76916E3D2185ACF4ADDB096

depends:

vermagic:       2.6.27.42-0.1.1.xs5.6.0.44.111158xen SMP mod_unload modversions Xen 686

parm:           worker_thread_pool_size:Size of the worker thread pool (0 = dedicated threads per target (default)) (ulong)

parm:           debug_enable_flags:debug bitmask, low bits (0 … 8) used, see iscsi_dbg.h (ulong)

[root@xenserver-flashcache kernel]# modinfo ext3

filename:       /lib/modules/2.6.27.42-0.1.1.xs5.6.0.44.111158xen/kernel/fs/ext3/ext3.ko

license:        GPL

description:    Second Extended Filesystem with journaling extensions

author:         Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts’o and others

srcversion:     B4BED432A5A321B81F293D7

depends:        jbd

supported:      yes

vermagic:       2.6.27.42-0.1.1.xs5.6.0.44.111158xen SMP mod_unload modversions Xen 686

[root@xenserver-flashcache kernel]#

[root@xenserver-chen linux-2.6.27.42-0.1.1.xs5.6.0.44.111158]# ls

arch   buildconfigs  crypto         firmware  init    kdb     MAINTAINERS  modules.order  README          scripts   usr

block  COPYING       Documentation  fs        ipc     kernel  Makefile     net            REPORTING-BUGS  security  virt

build  CREDITS       drivers        include   Kbuild  lib     mm           perfmon        samples         sound

[root@xenserver-chen linux-2.6.27.42-0.1.1.xs5.6.0.44.111158]#

[root@xenserver-chen linux-2.6.27.42-0.1.1.xs5.6.0.44.111158]# cp /boot/config-2.6.27.42-0.1.1.xs5.6.0.44.111158xen .config

[root@xenserver-chen linux-2.6.27.42-0.1.1.xs5.6.0.44.111158]# make vmlinuz -j16

[root@xenserver-chen linux-2.6.27.42-0.1.1.xs5.6.0.44.111158]# ls

arch          COPYING        drivers   init    kernel       mm              perfmon         scripts     usr

block         CREDITS        firmware  ipc     lib          modules.order   README          security    virt

build         crypto         fs        Kbuild  MAINTAINERSModule.symversREPORTING-BUGS  sound       vmlinux

buildconfigs  Documentation  include   kdb     Makefile     net             samples         System.map  vmlinux.o

[root@xenserver-chen linux-2.6.27.42-0.1.1.xs5.6.0.44.111158]#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值