温馨提示×

centos怎样检测drivers

小樊
44
2026-10-26 17:51:05
栏目: 智能运维

在 CentOS 中“检测 drivers(驱动)”通常分为几种场景:查看已加载的驱动/内核模块、检测硬件是否被识别、检查缺少的驱动、以及查看网卡/显卡等设备驱动情况。下面按常用方法说明。


一、查看已加载的驱动(内核模块)

CentOS 使用 Linux 内核,驱动通常以**内核模块(module)**形式存在。

1. 查看当前已加载的所有驱动

lsmod

2. 查看某个具体驱动是否加载

例如查看网卡驱动 e1000e:

lsmod | grep e1000e

3. 查看某硬件使用的驱动

lspci -k

示例输出中会显示:

Kernel driver in use: e1000e
Kernel modules: e1000e

二、检测硬件是否被识别(是否有驱动)

1. 查看 PCI 设备

lspci
lspci -nn

2. 查看 USB 设备

lsusb

3. 查看磁盘/存储

lsscsi

三、查看具体设备的驱动信息

1. 网卡驱动

ethtool -i eth0

(CentOS 8+/Stream 可能用 nmcli device show)

2. 显卡驱动

lspci | grep -i vga
nvidia-smi     # NVIDIA 专有驱动
glxinfo | grep "OpenGL renderer"

四、检测“缺少驱动 / 未加载驱动”

1. 看内核日志

dmesg | grep -i driver
dmesg | grep -i error

2. 未加载驱动的常见表现

  • lspci -k 中显示:
    Kernel driver in use: N/A
    
  • 设备存在但 ifconfig / ip addr 看不到

3. 手动加载驱动

modprobe <驱动名>

五、CentOS 专用工具

1. 使用 kmod 工具

rpm -qa | grep kmod

2. ELRepo(第三方驱动,如新网卡/显卡)

yum install elrepo-release
yum install kmod-xxx

六、常见场景总结

需求 命令
看所有驱动 lsmod
看设备驱动 lspci -k
网卡驱动 ethtool -i eth0
缺驱动排查 dmesg
加载驱动 modprobe

如果你能说明:

  • CentOS 版本(6 / 7 / 8 / Stream)
  • 检测的是什么硬件(网卡 / 显卡 / 阵列卡 / USB)

我可以给你更精确的命令。

0 踩