分析Linux kernel在“make install”时的“ERROR: modinfo: could not find module power_meter”这类问题

网友whipper在我的文章“(KVM连载)3.3.4 安装KVM”中提到了在编译KVM后安装时的一些错误提示,我以前也遇到过多次的,这次回答他的问题,简单总结一下吧。

问题描述:在编译内核后,make install 时可能遇到“ERROR: modinfo: could not find module XXX”的新题;命令行中操作看到的内容如下:

原因分析:在make install时,为了让新内核中不缺少所需module,会先检查当前系统已经加载了的module(lsmod命令可查看),然后对比新安装的内核模块,如果新的内核模块中缺少一些module(和当前lsmod命令的输出做对比),就会报“ERROR: modinfo: could not find module power_meter”这样的错误信息。

具体来说,缺少相应module而报错,大致可分为3种情况:
1. 确实是缺少了某个module,其解决方法是:如果报的module对于你来说是有用,检查编译kernel时的.config文件,加上对应的配置(配为=m),重新编译和安装modules即可;如果你觉得这个module没啥用,大可不必管它了。

2. 新编译的kernel已经将该选项编译进kernel了(.config中选择为=Y),从而不需要生成这个module的.ko文件,系统找不到对应的.ko文件,但是已经在新内核中了,不必理会这个报错。例如,上面的“ERROR: modinfo: could not find module ext4”是因为我将EXT4文件系统模块编译为built-in了,如下:

3. 模块的名称变了,用当前系统lsmod命令查找的模块名称,在新编译的内核中找不到module了。只需要检查确认即可,如这里的“ERROR: modinfo: could not find module power_meter”就是这种类型,检查方式如下:

最后,如果那些错误报的内核模块,你认为不重要或者都经过上面的分析解决后,你就可以忽略这些错误提示了;尽管有这些“ERROR: modinfo: ”错误提示,但是kernel还是被正确安装了的,往下继续操作使用即可。

master

Stay hungry, stay foolish.

3 Comments

  1. 请教几个模块丢失,在新装的内核中没有,只有原来的内核中有,怎么解决?
    [root@RHRL63 linux-3.4.1]# make install
    /root/kvm_demo/linux-3.4.1/arch/x86/Makefile:96: CONFIG_X86_X32 enabled but no binutils support
    sh /root/kvm_demo/linux-3.4.1/arch/x86/boot/install.sh 3.4.1 arch/x86/boot/bzImage \
    System.map "/boot"
    ERROR: modinfo: could not find module sco
    ERROR: modinfo: could not find module llc
    ERROR: modinfo: could not find module l2cap
    ERROR: modinfo: could not find module vmware_balloon
    查看:不存在包
    [root@RHRL63 linux-3.4.1]# grep sco .config
    # Digital gyroscope sensors
    [root@RHRL63 linux-3.4.1]# grep llc .config
    [root@RHRL63 linux-3.4.1]# grep l2cap .config
    [root@RHRL63 linux-3.4.1]# grep vmware_balloon .config

    查找:只有原来的内核中有,3.4.1中没有
    [root@RHRL63 linux-3.4.1]# lsmod | grep sco
    sco 18101 2
    bluetooth 99516 9 rfcomm,sco,bnep,l2cap,btusb
    [root@RHRL63 linux-3.4.1]# lsmod | grep llc
    llc 5642 2 bridge,stp
    [root@RHRL63 linux-3.4.1]# lsmod | grep l2cap
    l2cap 55906 16 rfcomm,bnep
    bluetooth 99516 9 rfcomm,sco,bnep,l2cap,btusb
    [root@RHRL63 linux-3.4.1]# lsmod | grep vmware_balloon
    vmware_balloon 7199 0
    [root@RHRL63 linux-3.4.1]# find /lib/ -name "*sco.ko"
    /lib/modules/3.4.1/kernel/drivers/net/wan/hdlc_cisco.ko
    /lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/net/wan/hdlc_cisco.ko
    /lib/modules/2.6.32-279.el6.x86_64/kernel/net/bluetooth/sco.ko
    [root@RHRL63 linux-3.4.1]# find /lib/ -name "*llc.ko"
    /lib/modules/2.6.32-279.el6.x86_64/kernel/net/llc/llc.ko
    [root@RHRL63 linux-3.4.1]# find /lib/ -name "*l2cap.ko"
    /lib/modules/2.6.32-279.el6.x86_64/kernel/net/bluetooth/l2cap.ko
    [root@RHRL63 linux-3.4.1]# find /lib/ -name "*vmware_balloon.ko"
    /lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/misc/vmware_balloon.ko

    请教如何解决?

    • 你看下.config文件中都是大写英文吧,grep时有注意吗?另外每个module在config文件中的文字不一定是和module名一样的,要仔细分析里面需要什么config才能生成module。

xzchen进行回复 取消回复

邮箱地址不会被公开。 必填项已用*标注

*