升级Ubuntu造成RTL8125网卡驱动丢失

环境

项目 内容
系统 Ubuntu 20.04
网卡 RTL 8125

起因

哒哒哒,一顿操作猛如虎,造就电脑二百五。因点击了Ubuntu的升级,重启之后,发现网络无法连接,RTL8125的网卡驱动丢失。

找到原有的网卡驱动安装博文–RLT8125 网卡驱动安装流程,按流程去安装,提示error

# 使用dkms重新安装的时候,发现提示已存在
modprobe: ERROR: could not insert 'r8125': Exec format error

处理

1、先卸载r8125驱动
sudo dkms remove r8125/9.004.01 --all

# 命令执行结果如下
-------- Uninstall Beginning --------
Module:  r8125
Version: 9.004.01
Kernel:  5.4.0-65-generic (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

r8125.ko:
 - Uninstallation
   - Deleting from: /lib/modules/5.4.0-65-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod...

DKMS: uninstall completed.

-------- Uninstall Beginning --------
Module:  r8125
Version: 9.004.01
Kernel:  5.8.0-38-generic (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

r8125.ko:
 - Uninstallation
   - Deleting from: /lib/modules/5.8.0-38-generic/
rmdir: 删除 '' 失败: 没有那个文件或目录
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod...

DKMS: uninstall completed.

-------- Uninstall Beginning --------
Module:  r8125
Version: 9.004.01
Kernel:  5.8.0-41-generic (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

r8125.ko:
 - Uninstallation
   - Deleting from: /lib/modules/5.8.0-41-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod...

DKMS: uninstall completed.

------------------------------
Deleting module version: 9.004.01
completely from the DKMS tree.
------------------------------
Done.

2、找到原先驱动安装位置(可以使用find命令搜索)

3、执行原有的网卡驱动安装博文–RLT8125 网卡驱动安装流程 所提示的安装方法

#以下所有命令都处于/usr/src/r8125-9.004.01 驱动目录下运行的哈
sudo dkms add -m r8125 -v 9.004.01

sudo dkms build -m r8125 -v 9.004.01

sudo dkms install -m r8125 -v 9.004.01

sudo depmod -a

sudo modprobe r8125

ifconfig -a

总结

遇到问题,可以多找找解决方法,方法总比困难多,而且这个网卡因为比较新,造成Ubuntu不带这个网卡的驱动功能,我个人还买了一个Ubuntu免驱动的WiFi网卡,方便随时恢复网卡的驱动和处理一些其他的问题

附近下载

加公众号,输入【r8125驱动】获得


更多内容请去公众号【老罗分享】获取

你可能感兴趣的:(运维,ubuntu,网络,linux)