您的位置:首页 > 其它

转: ERROR: modinfo: could not find module *

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

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

View Code BASH

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

<span style="color: rgb(122, 8, 116); "><strong>[</strong></span>root<span style="font-weight: bold;">@</span>smilejay linux-3.12<span style="color: rgb(122, 8, 116); "><strong>]</strong></span><span style="color: rgb(102, 102, 102); "><em># make modules_install</em></span>
..........
INSTALL sound<span style="font-weight: bold;">/</span>soundcore.ko
INSTALL sound<span style="font-weight: bold;">/</span>synth<span style="font-weight: bold;">/</span>emux<span style="font-weight: bold;">/</span>snd-emux-synth.ko
INSTALL sound<span style="font-weight: bold;">/</span>synth<span style="font-weight: bold;">/</span>snd-util-mem.ko
INSTALL sound<span style="font-weight: bold;">/</span>usb<span style="font-weight: bold;">/</span>snd-usb-audio.ko
INSTALL sound<span style="font-weight: bold;">/</span>usb<span style="font-weight: bold;">/</span>snd-usbmidi-lib.ko
INSTALL sound<span style="font-weight: bold;">/</span>usb<span style="font-weight: bold;">/</span>usx2y<span style="font-weight: bold;">/</span>snd-usb-usx2y.ko
DEPMOD  3.12.0
<span style="color: rgb(122, 8, 116); "><strong>[</strong></span>root<span style="font-weight: bold;">@</span>smilejay linux-3.12<span style="color: rgb(122, 8, 116); "><strong>]</strong></span><span style="color: rgb(102, 102, 102); "><em># make install</em></span>
<span style="color: rgb(194, 12, 185); "><strong>sh</strong></span> <span style="font-weight: bold;">/</span>root<span style="font-weight: bold;">/</span>linux-3.12<span style="font-weight: bold;">/</span>arch<span style="font-weight: bold;">/</span>x86<span style="font-weight: bold;">/</span>boot<span style="font-weight: bold;">/</span>install.sh 3.12.0 arch<span style="font-weight: bold;">/</span>x86<span style="font-weight: bold;">/</span>boot<span style="font-weight: bold;">/</span>bzImage \
System.map <span style="color: rgb(255, 0, 0);">"/boot"</span>
ERROR: modinfo: could not <span style="color: rgb(194, 12, 185); "><strong>find</strong></span> module power_meter
ERROR: modinfo: could not <span style="color: rgb(194, 12, 185); "><strong>find</strong></span> module nf_conntrack_ipv4
ERROR: modinfo: could not <span style="color: rgb(194, 12, 185); "><strong>find</strong></span> module nf_defrag_ipv4
ERROR: modinfo: could not <span style="color: rgb(194, 12, 185); "><strong>find</strong></span> module nf_conntrack_ipv6
ERROR: modinfo: could not <span style="color: rgb(194, 12, 185); "><strong>find</strong></span> module nf_defrag_ipv6
ERROR: modinfo: could not <span style="color: rgb(194, 12, 185); "><strong>find</strong></span> module xt_state
ERROR: modinfo: could not <span style="color: rgb(194, 12, 185); "><strong>find</strong></span> module nf_conntrack
ERROR: modinfo: could not <span style="color: rgb(194, 12, 185); "><strong>find</strong></span> module i2c_piix4
ERROR: modinfo: could not <span style="color: rgb(194, 12, 185); "><strong>find</strong></span> module sg
ERROR: modinfo: could not <span style="color: rgb(194, 12, 185); "><strong>find</strong></span> module ext4
ERROR: modinfo: could not <span style="color: rgb(194, 12, 185); "><strong>find</strong></span> module mbcache
ERROR: modinfo: could not <span style="color: rgb(194, 12, 185); "><strong>find</strong></span> module jbd2
ERROR: modinfo: could not <span style="color: rgb(194, 12, 185); "><strong>find</strong></span> module sr_mod
ERROR: modinfo: could not <span style="color: rgb(194, 12, 185); "><strong>find</strong></span> module cdrom
ERROR: modinfo: could not <span style="color: rgb(194, 12, 185); "><strong>find</strong></span> module pata_acpi
ERROR: modinfo: could not <span style="color: rgb(194, 12, 185); "><strong>find</strong></span> module ata_generic
ERROR: modinfo: could not <span style="color: rgb(194, 12, 185); "><strong>find</strong></span> module ata_piix
原因分析:在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了,如下:

View Code BASH

1
2
3
4
5

<span style="color: rgb(122, 8, 116); "><strong>[</strong></span>root<span style="font-weight: bold;">@</span>smilejay linux-3.12<span style="color: rgb(122, 8, 116); "><strong>]</strong></span><span style="color: rgb(102, 102, 102); "><em># grep EXT4 .config</em></span>
<span style="color: rgb(0, 120, 0);">CONFIG_EXT4_FS</span>=y
<span style="color: rgb(102, 102, 102); "><em># CONFIG_EXT4_FS_POSIX_ACL is not set</em></span>
<span style="color: rgb(102, 102, 102); "><em># CONFIG_EXT4_FS_SECURITY is not set</em></span>
<span style="color: rgb(102, 102, 102); "><em># CONFIG_EXT4_DEBUG is not set</em></span>
3. 模块的名称变了,用当前系统lsmod命令查找的模块名称,在新编译的内核中找不到module了。只需要检查确认即可,如这里的“ERROR: modinfo: could not find module power_meter”就是这种类型,检查方式如下:

View Code BASH

1
2
3
4
56
7
8

<span style="color: rgb(102, 102, 102); "><em># 当前系统已经加载了power_meter模块</em></span>
<span style="color: rgb(122, 8, 116); "><strong>[</strong></span>root<span style="font-weight: bold;">@</span>smilejay ~<span style="color: rgb(122, 8, 116); "><strong>]</strong></span><span style="color: rgb(102, 102, 102); "><em># lsmod | grep meter</em></span>
power_meter             9169  1
 
<span style="color: rgb(102, 102, 102); "><em># 但是kernel 3.12 中该module名称为 acpi_power_meter,和'lsmod'查到的power_meterb不一致。</em></span>
<span style="color: rgb(122, 8, 116); "><strong>[</strong></span>root<span style="font-weight: bold;">@</span>smilejay ~<span style="color: rgb(122, 8, 116); "><strong>]</strong></span><span style="color: rgb(102, 102, 102); "><em># find  /lib/ -name "*power_meter.ko"</em></span>
<span style="font-weight: bold;">/</span>lib<span style="font-weight: bold;">/</span>modules<span style="font-weight: bold;">/</span>2.6.32-358.el6.x86_64<span style="font-weight: bold;">/</span>kernel<span style="font-weight: bold;">/</span>drivers<span style="font-weight: bold;">/</span>acpi<span style="font-weight: bold;">/</span>power_meter.ko
<span style="font-weight: bold;">/</span>lib<span style="font-weight: bold;">/</span>modules<span style="font-weight: bold;">/</span>3.12.0<span style="font-weight: bold;">/</span>kernel<span style="font-weight: bold;">/</span>drivers<span style="font-weight: bold;">/</span>hwmon<span style="font-weight: bold;">/</span>acpi_power_meter.ko
最后,如果那些错误报的内核模块,你认为不重要或者都经过上面的分析解决后,你就可以忽略这些错误提示了;尽管有这些“ERROR: modinfo: ”错误提示,但是kernel还是被正确安装了的,往下继续操作使用即可。

再根据http://smilejay.com/2012/06/kvm_installation/最后的说明,重启系统,操作如下:

检查了grub之后,重新启动系统,选择刚才为了KVM而编译、安装的内核启动。

系统启动后,登录进入系统,通常情况下,系统启动时默认已经加载了kvm和kvm_intel这两个模块;如果没有加载,请手动用modprobe命令依次加载kvm和kvm_intel模块。

[root@jay-linux ~]# modprobe kvm

[root@jay-linux ~]# modprobe kvm_intel

[root@jay-linux ~]# lsmod | grep kvm

kvm_intel 112487 0

kvm 206544 1 kvm_intel

确认KVM相关的模块加载成功后,检查/dev/kvm这个文件,它是kvm内核模块提供给用户空间的qemu-kvm程序使用的一个控制接口,它提供了客户机(Guest)操作系统运行所需要的模拟和实际的硬件设备环境。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: