我試圖編譯和模塊插入我的內核,但我不斷收到此錯誤:用insmod不能插入一個非常簡單的模塊
insmod: error inserting 'hello.ko': -1 Invalid module format
我跟着本教程在這裏描述的步驟: http://www.cyberciti.biz/tips/compiling-linux-kernel-module.html。而且一切似乎都有意義並且有效。我得到了我的示例模塊編譯,但有一個警告,可能是一個重要的原因導致這件事失敗。警告是這樣的:
WARNING: Symbol version dump /usr/src/linux-3.0.0/Module.symvers is missing; modules will have no dependencies and modversions.
我坦率地不知道爲什麼Module.symvers文件不存在。該/usr/src/linux-3.0.0目錄及其所有內容都是我創造了我使用此命令dowloaded來源後:
apt-get source linux-image-$(uname -r)
那是事實,教程的唯一步驟,我沒有遵循,因爲我無法找到我的內核的確切來源(3.0.0-32-通用),並認爲能力工具會對我進行分類。
我就是一個64位的機器上運行Ubuntu順便說一下,這裏是通過uname -a輸出:
Linux vega 3.0.0-32-generiC#51-Ubuntu SMP Thu Mar 21 15:50:59 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
任何建議,什麼嘗試下?任何推薦的閱讀?
PS1。 經過一些更多的研究,我確認我正在運行3.0.0-32-generic。更新GRUB返回:
Found linux image: /boot/vmlinuz-3.0.0-32-generic
但發出須藤使oldconfig會,並檢查所產生的config文件,我得到這個有趣的行之後:
CONFIG_VERSION_SIGNATURE="Ubuntu 3.0.0-32.51-generic 3.0.69"
這是否有資格作爲一個missmatch?
PS2。 dmesg的輸出這樣的:
[ 5.869900] ADDRCONF(NETDEV_UP): eth1: link is not ready
[ 6.144304] EXT4-fs (dm-1): re-mounted. Opts: errors=remount-ro
[ 6.368936] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[ 6.433919] vesafb: mode is 640x480x32, linelength=2560, pages=0
[ 6.433921] vesafb: scrolling: redraw
[ 6.433923] vesafb: Truecolor: size=8:8:8:8, shift=24:16:8:0
[ 6.435424] vesafb: framebuffer at 0xb0000000, mapped to 0xffffc90012800000, using 1216k, total 1216k
[ 6.435516] Console: switching to colour frame buffer device 80x30
[ 6.443104] EXT4-fs (dm-2): mounted filesystem with ordered data mode. Opts: (null)
[ 6.450198] fb0: VESA VGA frame buffer device
[ 8.884523] e1000e: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
[ 8.885845] ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[ 12.611236] init: ssh main process (762) terminated with status 255
[ 12.624381] init: failsafe main process (752) killed by TERM signal
[ 12.634739] type=1400 audit(1373412287.107:8): apparmor="STATUS" operation="profile_load" name="/usr/sbin/tcpdump" pid=852 comm="apparmor_parser"
[ 12.634873] type=1400 audit(1373412287.107:9): apparmor="STATUS" operation="profile_replace" name="/sbin/dhclient" pid=851 comm="apparmor_parser"
[ 12.635180] type=1400 audit(1373412287.107:10): apparmor="STATUS" operation="profile_replace" name="/usr/lib/NetworkManager/nm-dhcp-client.action" pid=851 comm="apparmor_parser"
[ 12.635403] type=1400 audit(1373412287.107:11): apparmor="STATUS" operation="profile_replace" name="/usr/lib/connman/scripts/dhclient-script" pid=851 comm="apparmor_parser"
[ 19.390991] eth1: no IPv6 routers present
[ 576.758697] hello: no symbol version for module_layout
你剛好運行後insmod的什麼dmesg的說,例如最後10行? – fghj
我剛剛更新了問題以粘貼更多的dmesg輸出行,但我相信只有最後一個是相關的。 – Bilthon
here http://stackoverflow.com/questions/1738539/how-do-i-fix-no-symbol-version-for-module-layout? – fghj