最近在Centos7系統中遇到一個問題,我先將/lib/modules/3.10.0-1062.el7.x86_64/kernel/drivers/net/ethernet/intel/igb/目錄下面的igb.ko.xz驅動文件刪除,然後將新編譯的igb.ko驅動文件放到/lib/modules/3.10.0-1062.el7.x86_64/updates/drivers/net/ethernet/intel/igb/目錄,重啓系統後,輸入ethtool -i eth0命令發現網卡驅動版本是之前刪掉的igb版本,不是我新的igb版本
[root@localhost intel]# ethtool -i eth0
driver: igb
version: 5.6.0-k
firmware-version: 3.25, 0x800005cd
expansion-rom-version:
輸入modinfo igb命令發現igb版本又是新的,我都把原來的驅動文件刪除了,但系統還是加載原來的驅動,很奇怪的問題。
filename: /lib/modules/3.10.0-1062.el7.x86_64/updates/drivers/net/ethernet/intel/igb/igb.ko
version: 5.3.5.18
license: GPL
description: Intel(R) Gigabit Ethernet Linux Driver
這個問題困擾了我兩三天,最後在igb驅動源碼的README說明文件找到了原因。
To build igb driver with DCA
----------------------------
If your kernel supports DCA, the driver will build by default with DCA enabled.
Note: For certain distributions like (but not limited to) RedHat Enterprise
Linux 7 and Ubuntu, once the driver is installed the initrd/initramfs file may
need to be updated to prevent the OS loading old versions of the igb driver.
The dracut utility may be used on RedHat distributions:
# dracut --force
For Ubuntu:
# update-initramfs -u
從原文中瞭解到Centos7版本替換驅動文件後,需要執行dracut --force命令來更新initrd/initramfs,以防止加載舊版本的igb驅動。
再次重新啓動系統後,輸入ethtool -i eth0命令發現網卡驅動版本已經更新了。