Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

Linux 網卡啟動報錯 "device not present" 解決:depmod 重建模組依賴

編輯:Linux 教學

啟動網卡 eth0 時提示 r8169 device eth0 does not seem to be present, delaying initialization,通常是核心模組依賴關係損壞或模組未正確載入導致。本文提供快速修復方案。

現象

[root@mail network-scripts]# ifup eth0
r8169 設備 eth0 似乎不在。將要推遲它的初始化。

根因

  • 核心升級後,第三方驅動(如 Realtek r8169/r8168)未重新編譯安裝
  • /lib/modules/$(uname -r)/modules.dep 依賴文件過期/缺失
  • initramfs 未包含對應網卡驅動

標準修復流程

# 1. 重建模組依賴關係
depmod -a $(uname -r)

# 2. 重新生成 initramfs(確保驅動打包進啟動映像)
# CentOS/RHEL
dracut -f -v
# Debian/Ubuntu
update-initramfs -u -k all

# 3. 重啟驗證
reboot

進階排查(若上述無效)

  1. 確認硬件存在:lspci | grep -i ethernet
  2. 檢查驅動綁定:ethtool -i eth0(若無 eth0,嘗試 ip link 看是否為 ens33 等新命名)
  3. 手動載入模組:modprobe r8169,觀察 dmesg -T 輸出
  4. 若為 Realtek 8111/8168 系列,官方驅動 r8168 效果優於內建 r8169,需下載源碼編譯安裝並 modprobe -r r8169; modprobe r8168
  5. 永久禁用 r8169:echo "blacklist r8169" > /etc/modprobe.d/r8169-blacklist.conf

systemd 網路管理環境下

# 使用 systemd-networkd
networkctl status eth0
systemctl restart systemd-networkd
Copyright © Windows教程網 All Rights Reserved