insmod ko时出现的错误--设备名称
来源:互联网 发布:php调用接口post请求 编辑:程序博客网 时间:2024/06/05 08:03
在insmod 一个驱动时候遇到了下面这个问题,从dmesg出来的日志中可以看到提示:
sysfs: cannot create duplicate filename '/devices/virtual/char_driver_test'
在系统的/sys/devices/virtual 目录下看到有 char_driver_test 目录, 这个目录是之前
加载过一次这个驱动的时候创建的,但不知道怎么回事在rmmod 的时候没有将这个目录
回收,所以造成这个错误。如是想删掉这个目录应该在下次加载的时候就不会出现这个
错误了,但执行 sudo rm char_driver_test 提示 rm: cannot remove `char_driver_test': Permission denied
怎么也删不掉,重启系统后此文件消失。之后多次进行insmod 和rmmod都没有问题。
这才想到之前加载这个驱动时候遇到的问题,系统提示[ 442.727032] sysfs: cannot create duplicate filename '/dev/char/253:1' 进入 /dev/char目录发现
lrwxrwxrwx 1 root root 14 2011-08-03 01:47 253:1 -> ../bsg/2:0:0:0 主设备号为253、次设备号为1 已经被这个
设备所占用了,所以会产生这个错误。 然后修改主设备号后再次注册时就出现了sysfs: cannot create duplicate filename '/devices/virtual/char_driver_test' 的错误。
[ 442.727022] ------------[ cut here ]------------
[ 442.727029] WARNING: at /build/buildd/linux-2.6.38/fs/sysfs/dir.c:455 sysfs_add_one+0xc8/0xf0()
[ 442.727032] Hardware name: VMware Virtual Platform
[ 442.727032] sysfs: cannot create duplicate filename '/dev/char/253:1'
[ 442.727033] Modules linked in: test1(+) vesafb snd_ens1371 gameport snd_ac97_codec ac97_bus snd_pcm binfmt_misc snd_seq_midi snd_rawmidi snd_seq_midi_event snd_seq snd_timer snd_seq_device ppdev vmw_balloon snd psmouse serio_raw parport_pc soundcore snd_page_alloc shpchp i2c_piix4 lp parport floppy mptspi mptscsih e1000 mptbase scsi_transport_spi [last unloaded: test1]
[ 442.727044] Pid: 2762, comm: insmod Not tainted 2.6.38-8-generic #42-Ubuntu
[ 442.727045] Call Trace:
[ 442.727048] [<ffffffff81065cef>] ? warn_slowpath_common+0x7f/0xc0
[ 442.727050] [<ffffffff81065de6>] ? warn_slowpath_fmt+0x46/0x50
[ 442.727051] [<ffffffff811d5798>] ? sysfs_add_one+0xc8/0xf0
[ 442.727052] [<ffffffff811d60fb>] ? sysfs_do_create_link+0x12b/0x210
[ 442.727054] [<ffffffff812e53a0>] ? sprintf+0x40/0x50
[ 442.727056] [<ffffffff811d61f3>] ? sysfs_create_link+0x13/0x20
[ 442.727060] [<ffffffff813b7c61>] ? device_add+0x1c1/0x410
[ 442.727062] [<ffffffff813b7ece>] ? device_register+0x1e/0x30
[ 442.727063] [<ffffffff813b7fdb>] ? device_create_vargs+0xfb/0x130
[ 442.727065] [<ffffffffa0183000>] ? test1_init+0x0/0x80 [test1]
[ 442.727066] [<ffffffff813b8041>] ? device_create+0x31/0x40
[ 442.727068] [<ffffffff813bbbb6>] ? __class_create+0x66/0xb0
[ 442.727069] [<ffffffffa0183000>] ? test1_init+0x0/0x80 [test1]
[ 442.727071] [<ffffffffa0183078>] ? test1_init+0x78/0x80 [test1]
[ 442.727075] [<ffffffff81002175>] ? do_one_initcall+0x45/0x190
[ 442.727078] [<ffffffff810a4feb>] ? sys_init_module+0xfb/0x250
[ 442.727080] [<ffffffff8100c002>] ? system_call_fastpath+0x16/0x1b
[ 442.727081] ---[ end trace dff37634e58ab5db ]---
总结: 在modinit 中加载或注册的设备在modclean的时候都必须要释放掉,不然会出现上面这种错误。
[1037324.866148] ------------[ cut here ]------------
[1037324.866157] WARNING: at /build/buildd/linux-2.6.38/fs/sysfs/dir.c:455 sysfs_add_one+0xc8/0xf0()
[1037324.866159] Hardware name: VMware Virtual Platform
[1037324.866160] sysfs: cannot create duplicate filename '/devices/virtual/char_driver_test'
[1037324.866161] Modules linked in: test1(+) usb_storage uas vesafb snd_ens1371 gameport snd_ac97_codec ac97_bus snd_pcm snd_seq_midi snd_rawmidi binfmt_misc snd_seq_midi_event snd_seq snd_timer snd_seq_device ppdev psmouse vmw_balloon snd serio_raw soundcore snd_page_alloc parport_pc shpchp i2c_piix4 lp parport mptspi e1000 mptscsih mptbase scsi_transport_spi floppy [last unloaded: test1]
[1037324.866476] Pid: 15430, comm: insmod Tainted: G W 2.6.38-8-generic #42-Ubuntu
[1037324.866477] Call Trace:
[1037324.866483] [<ffffffff81065cef>] ? warn_slowpath_common+0x7f/0xc0
[1037324.866485] [<ffffffff81065de6>] ? warn_slowpath_fmt+0x46/0x50
[1037324.866486] [<ffffffff811d5798>] ? sysfs_add_one+0xc8/0xf0
[1037324.866488] [<ffffffff811d583f>] ? create_dir+0x7f/0xd0
[1037324.866489] [<ffffffff811d592d>] ? sysfs_create_dir+0x7d/0xc0
[1037324.866493] [<ffffffff812dcf17>] ? kobject_add_internal+0xb7/0x240
[1037324.866494] [<ffffffff812dd32d>] ? kobject_add+0x6d/0xb0
[1037324.866497] [<ffffffff8115557f>] ? kmem_cache_alloc_trace+0xff/0x120
[1037324.866501] [<ffffffff813b7790>] ? get_device_parent.clone.9+0x150/0x1c0
[1037324.866503] [<ffffffff813b7b85>] ? device_add+0xe5/0x410
[1037324.866504] [<ffffffff813b7ece>] ? device_register+0x1e/0x30
[1037324.866506] [<ffffffff813b7fdb>] ? device_create_vargs+0xfb/0x130
[1037324.866508] [<ffffffffa01a4000>] ? test1_init+0x0/0x80 [test1]
[1037324.866509] [<ffffffff813b8041>] ? device_create+0x31/0x40
[1037324.866511] [<ffffffff813bbbb6>] ? __class_create+0x66/0xb0
[1037324.866512] [<ffffffffa01a4000>] ? test1_init+0x0/0x80 [test1]
[1037324.866514] [<ffffffffa01a4078>] ? test1_init+0x78/0x80 [test1]
[1037324.866516] [<ffffffff81002175>] ? do_one_initcall+0x45/0x190
[1037324.866519] [<ffffffff810a4feb>] ? sys_init_module+0xfb/0x250
[1037324.866521] [<ffffffff8100c002>] ? system_call_fastpath+0x16/0x1b
[1037324.866523] ---[ end trace f36d738cd6e2ae8f ]---
[1037324.866524] kobject_add_internal failed for char_driver_test with -EEXIST, don't try to register things with the same name in the same directory.
[1037324.866526] Pid: 15430, comm: insmod Tainted: G W 2.6.38-8-generic #42-Ubuntu
[1037324.866527] Call Trace:
[1037324.866528] [<ffffffff812dd002>] ? kobject_add_internal+0x1a2/0x240
[1037324.866530] [<ffffffff812dd32d>] ? kobject_add+0x6d/0xb0
[1037324.866531] [<ffffffff8115557f>] ? kmem_cache_alloc_trace+0xff/0x120
[1037324.866533] [<ffffffff813b7790>] ? get_device_parent.clone.9+0x150/0x1c0
[1037324.866534] [<ffffffff813b7b85>] ? device_add+0xe5/0x410
[1037324.866535] [<ffffffff813b7ece>] ? device_register+0x1e/0x30
[1037324.866536] [<ffffffff813b7fdb>] ? device_create_vargs+0xfb/0x130
[1037324.866538] [<ffffffffa01a4000>] ? test1_init+0x0/0x80 [test1]
[1037324.866539] [<ffffffff813b8041>] ? device_create+0x31/0x40
[1037324.866541] [<ffffffff813bbbb6>] ? __class_create+0x66/0xb0
[1037324.866542] [<ffffffffa01a4000>] ? test1_init+0x0/0x80 [test1]
[1037324.866544] [<ffffffffa01a4078>] ? test1_init+0x78/0x80 [test1]
[1037324.866545] [<ffffffff81002175>] ? do_one_initcall+0x45/0x190
[1037324.866547] [<ffffffff810a4feb>] ? sys_init_module+0xfb/0x250
[1037324.866548] [<ffffffff8100c002>] ? system_call_fastpath+0x16/0x1b
- insmod ko时出现的错误--设备名称
- insmod 时出现的错误
- 通过dmesg | tail 看insmod ko时输出的log
- 如何在android设备上insmod自己单独编译的.ko,解决签名问题
- 往开发板写led驱动时出现错误:insmod: can't insert 's3c_led.ko': unknown symbol in module or invalid parameter
- ubuntu 12.04出现insmod: error inserting 'hello.ko': -1 Device or resource busy的解决办法
- 加载rt3070sta.ko出现insmod: can't insert 'rt3070sta.ko': invalid module format问题
- linux加载ko时出现Unknown symbol 错误(调用了EXPORT_SYMBOL出来的函数)
- 重复insmod 一个ko模块导致的异常问题解决方法
- 嵌入式linux 内核模块调试ko的 insmod问题
- linux insmod error ko文件
- insmod module.ko 出现Invalid parameters, dmesg显示信息:disagrees about version of symbol..
- 谁决定.ko文件的名称?
- 驱动模块加载错误:insmod: can't insert 'xx.ko': invalid module format
- 模块插入错误 insmod: can't insert 'memdev.ko': Device or resource busy
- 驱动加载错误:insmod: error inserting 'hello.ko': -1 Device or resource busy
- 模块插入错误 insmod: can't insert 'memdev.ko': Device or resource busy
- insmod错误~~~~~~
- 经典图像边缘检测(模板法思想)——Kirsch算子
- HR绩效考核
- jbpm4.3 eclipse下 helloworld
- 忘了什么时候写的,也忘了曾经那份自如的心情。。。。。。。。。。
- 设计模式之(二)原型模式Prototype
- insmod ko时出现的错误--设备名称
- 第六章:通用标签:深入浅出struts2
- android-是否同意条约
- Qt学习——堆栈窗体QStackedWidget类 .
- 每天写出好代码的5个建议
- Qt学习——布局管理器QLayout类 .
- Socket获取客户端IP地址及端口号
- 关于PreparedStatement和Statement具体区别
- Oracle XE express edition 安装问题