Realtek 8168 脚本不起作用

Realtek 8168 脚本不起作用

我想使用最新的 Realtek 驱动程序,但对于 Ubuntu 22 我无法做到。 Realtek 脚本删除了旧的开源驱动程序,我只用 USB 与我的手机连接。这是瑞昱日志:

make -C src/ clean
make[1]: Entering directory '/home/deb/Downloads/r8168-8.050.03/src'
make -C /lib/modules/5.15.0-41-generic/build M=/home/deb/Downloads/r8168-8.050.03/src clean
make[2]: Entering directory '/usr/src/linux-headers-5.15.0-41-generic'
  CLEAN   /home/deb/Downloads/r8168-8.050.03/src/Module.symvers
make[2]: Leaving directory '/usr/src/linux-headers-5.15.0-41-generic'
make[1]: Leaving directory '/home/deb/Downloads/r8168-8.050.03/src'
make -C src/ modules
make[1]: Entering directory '/home/deb/Downloads/r8168-8.050.03/src'
make -C /lib/modules/5.15.0-41-generic/build M=/home/deb/Downloads/r8168-8.050.03/src modules
make[2]: Entering directory '/usr/src/linux-headers-5.15.0-41-generic'
  CC [M]  /home/deb/Downloads/r8168-8.050.03/src/r8168_n.o
  CC [M]  /home/deb/Downloads/r8168-8.050.03/src/r8168_asf.o
  CC [M]  /home/deb/Downloads/r8168-8.050.03/src/rtl_eeprom.o
  CC [M]  /home/deb/Downloads/r8168-8.050.03/src/rtltool.o
  LD [M]  /home/deb/Downloads/r8168-8.050.03/src/r8168.o
  MODPOST /home/deb/Downloads/r8168-8.050.03/src/Module.symvers
  CC [M]  /home/deb/Downloads/r8168-8.050.03/src/r8168.mod.o
  LD [M]  /home/deb/Downloads/r8168-8.050.03/src/r8168.ko
  BTF [M] /home/deb/Downloads/r8168-8.050.03/src/r8168.ko
make[2]: Leaving directory '/usr/src/linux-headers-5.15.0-41-generic'
make[1]: Leaving directory '/home/deb/Downloads/r8168-8.050.03/src'
make -C src/ install
make[1]: Entering directory '/home/deb/Downloads/r8168-8.050.03/src'
make -C /lib/modules/5.15.0-41-generic/build M=/home/deb/Downloads/r8168-8.050.03/src INSTALL_MOD_DIR=kernel/drivers/net/ethernet/realtek modules_install
make[2]: Entering directory '/usr/src/linux-headers-5.15.0-41-generic'
  INSTALL /lib/modules/5.15.0-41-generic/kernel/drivers/net/ethernet/realtek/r8168.ko
  SIGN    /lib/modules/5.15.0-41-generic/kernel/drivers/net/ethernet/realtek/r8168.ko
  DEPMOD  /lib/modules/5.15.0-41-generic
make[2]: Leaving directory '/usr/src/linux-headers-5.15.0-41-generic'
make[1]: Leaving directory '/home/deb/Downloads/r8168-8.050.03/src'

这是外壳输出:

deb@deb:~/Downloads/r8168-8.050.03$ sudo bash autorun.sh

Check old driver and unload it. 
Build the module and install 
Skipping BTF generation for /home/deb/Downloads/r8168-8.050.03/src/r8168.ko due to unavailability of vmlinux 
arch/x86/Makefile:142: CONFIG_X86_X32 enabled but no binutils support 
At main.c:160:
    - SSL error:FFFFFFFF80000002:system library::No such file or directory: ../crypto/bio/bss_file.c:67
    - SSL error:10000080:BIO routines::no such file: ../crypto/bio/bss_file.c:75 
sign-file: certs/signing_key.pem: No such file or directory 
Warning: modules_install: missing 'System.map' file. Skipping depmod. 
DEPMOD 5.15.0-41-generic 
load module r8168 
modprobe: ERROR: could not insert 'r8168': Operation not permitted 
Updating initramfs. Please wait. 
update-initramfs: Generating /boot/initrd.img-5.15.0-41-generic Completed.

Lspci-k

02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
Subsystem: Acer Incorporated [ALI] RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
Kernel modules: r8168

nmcli 中没有 enp2s0

我不知道为什么每次我想尝试 Linux 时都会遇到一些痛苦的事情,但无论如何它还是发生了。

一些建议?

编辑==================================

感谢您提供信息丰富的答案@telcoM 但事情变得更糟。我有 MOK 文件,但是:

deb@deb:~$ sudo ls /var/lib/shim-signed/mok
MOK.der  MOK.priv

deb@deb:~$ ls /lib/modules/$(uname -r)/kernel/drivers/net/ethernet/realtek
8139cp.ko  8139too.ko  atp.ko  r8168.ko  r8169.bak

deb@deb:~$ sudo kmodsign sha512 \ /var/lib/shim-signed/mok/MOK.priv \ /var/lib/shim-signed/mok/MOK.der \ /lib/modules/$(uname -r)/kernel/drivers/net/ethernet/realtek/r8168.ko
At main.c:249:
- SSL error:FFFFFFFF80000002:system library::No such file or directory: ../crypto/bio/bss_file.c:67
- SSL error:10000080:BIO routines::no such file: ../crypto/bio/bss_file.c:75
kmodsign:  /var/lib/shim-signed/mok/MOK.priv: No such file or directory

所以我查了一下openssl:

deb@deb:~$ ls /usr/lib/ssl/
certs  misc  openssl.cnf  private

我说重新安装有帮助,但也删除了 Chrome 和很多东西。

deb@deb:~$ sudo apt-get remove openssl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apport-symptoms apturl-common cups-server-common gir1.2-dbusmenu-glib-0.4 gir1.2-dee-1.0 gir1.2-goa-1.0 gir1.2-snapd-1 gir1.2-unity-7.0
  gnome-software-common hplip-data libauthen-sasl-perl libclone-perl libcupsimage2 libdata-dump-perl libfile-listing-perl libflatpak0
  libfont-afm-perl libglu1-mesa libhpmud0 libhtml-form-perl libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl
  libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl libhttp-message-perl libhttp-negotiate-perl libimagequant0 libio-html-perl
  libio-socket-ssl-perl liblwp-mediatypes-perl libmailtools-perl libnet-http-perl libnet-smtp-ssl-perl libnet-ssleay-perl libraqm0
  libsane-hpaio libtie-ixhash-perl libtimedate-perl libtry-tiny-perl libvncclient1 libwww-robotrules-perl libxatracker2
  libxml-xpathengine-perl libxvmc1 perl-openssl-defaults printer-driver-postscript-hp python3-blinker python3-cffi-backend python3-chardet
  python3-cryptography python3-dateutil python3-debconf python3-debian python3-distro-info python3-distupgrade python3-idna python3-jeepney
  python3-jwt python3-keyring python3-lazr.uri python3-nacl python3-oauthlib python3-olefile python3-pexpect python3-pil
  python3-problem-report python3-protobuf python3-ptyprocess python3-pymacaroons python3-pyparsing python3-renderpm python3-reportlab
  python3-reportlab-accel python3-rfc3339 python3-secretstorage python3-six python3-systemd python3-tz python3-update-manager
  python3-urllib3 python3-wadllib ubuntu-advantage-desktop-daemon unattended-upgrades x11-apps x11-session-utils xbitmaps xinit xinput
  xserver-xorg-input-all xserver-xorg-input-libinput xserver-xorg-input-wacom xserver-xorg-video-all xserver-xorg-video-amdgpu
  xserver-xorg-video-ati xserver-xorg-video-fbdev xserver-xorg-video-intel xserver-xorg-video-nouveau xserver-xorg-video-qxl
  xserver-xorg-video-radeon xserver-xorg-video-vesa xserver-xorg-video-vmware
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  apport apport-gtk apturl bluez-cups ca-certificates cups cups-browsed cups-core-drivers cups-daemon gnome-online-accounts gnome-software
  gnome-software-plugin-flatpak gnome-software-plugin-snap google-chrome-stable hplip liblwp-protocol-https-perl libnet-dbus-perl libtpms0
  libwww-perl libxml-parser-perl libxml-twig-perl nautilus-share openssl printer-driver-hpcups printer-driver-splix python3-apport
  python3-certifi python3-httplib2 python3-launchpadlib python3-lazr.restfulclient python3-macaroonbakery python3-requests
  python3-software-properties snapd software-properties-common software-properties-gtk ssl-cert swtpm swtpm-tools ubuntu-desktop
  ubuntu-desktop-minimal ubuntu-release-upgrader-core ubuntu-release-upgrader-gtk update-manager update-manager-core update-notifier
  update-notifier-common x11vnc xorg xserver-xorg
0 upgraded, 0 newly installed, 50 to remove and 0 not upgraded.
After this operation, 397 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 197839 files and directories currently installed.)
Removing apport-gtk (2.20.11-0ubuntu82.1) ...
Removing apport (2.20.11-0ubuntu82.1) ...
Removing nautilus-share (0.7.3-2ubuntu6) ...
Removing apturl (0.5.2ubuntu22) ...
Removing bluez-cups (5.64-0ubuntu1) ...
Removing google-chrome-stable (103.0.5060.134-1) ...
Removing ubuntu-desktop (1.481) ...
Removing printer-driver-splix (2.0.0+svn315-7fakesync1build3) ...
Removing hplip (3.21.12+dfsg0-1) ...
Removing printer-driver-hpcups (3.21.12+dfsg0-1) ...
Removing cups (2.4.1op1-1ubuntu4.1) ...
Removing cups-browsed (1.28.15-0ubuntu1) ...
Removing cups-core-drivers (2.4.1op1-1ubuntu4.1) ...
Removing cups-daemon (2.4.1op1-1ubuntu4.1) ...
Removing gnome-online-accounts (3.44.0-1ubuntu1) ...
Removing gnome-software-plugin-flatpak (41.5-2) ...
Removing gnome-software-plugin-snap (41.5-2) ...
Removing gnome-software (41.5-2) ...
Removing libnet-dbus-perl (1.2.0-1build3) ...
Removing libxml-twig-perl (1:3.52-1) ...
Removing libxml-parser-perl:amd64 (2.46-3build1) ...
Removing swtpm-tools (0.6.3-0ubuntu3) ...
Removing swtpm (0.6.3-0ubuntu3) ...
Removing libtpms0:amd64 (0.9.3-0ubuntu1) ...
Removing x11vnc (0.9.16-8) ...
Removing ssl-cert (1.1.2) ...
Removing ubuntu-desktop-minimal (1.481) ...
Removing xorg (1:7.7+23ubuntu2) ...
Removing xserver-xorg (1:7.7+23ubuntu2) ...
Removing python3-apport (2.20.11-0ubuntu82.1) ...
Removing python3-macaroonbakery (1.3.1-2) ...
Removing python3-requests (2.25.1+dfsg-2) ...
Removing python3-certifi (2020.6.20-1) ...
Removing software-properties-gtk (0.99.22.2) ...
Removing software-properties-common (0.99.22.2) ...
Removing python3-software-properties (0.99.22.2) ...
Removing python3-launchpadlib (1.10.16-1) ...
Removing python3-lazr.restfulclient (0.14.4-1) ...
Removing python3-httplib2 (0.20.2-2) ...
Removing snapd (2.55.5+22.04) ...
Warning: Stopping snapd.service, but it can still be activated by:
  snapd.socket
Removing liblwp-protocol-https-perl (6.10-1) ...
Removing libwww-perl (6.61-1) ...
Removing update-notifier (3.192.54) ...
Removing update-manager (1:22.04.9) ...
Removing update-notifier-common (3.192.54) ...
Removing update-manager-core (1:22.04.9) ...
Removing ubuntu-release-upgrader-gtk (1:22.04.11) ...
Removing ubuntu-release-upgrader-core (1:22.04.11) ...
Removing ca-certificates (20211016) ...
Removing dangling symlinks from /etc/ssl/certs... done.
Removing openssl (3.0.2-0ubuntu1.6) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...
Processing triggers for libglib2.0-0:amd64 (2.72.1-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for dbus (1.12.20-2ubuntu4) ...
Processing triggers for shared-mime-info (2.1-2) ...
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...

deb@deb:~$ sudo apt-get install openssl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apport-symptoms apturl-common cups-server-common gir1.2-dbusmenu-glib-0.4 gir1.2-dee-1.0 gir1.2-goa-1.0 gir1.2-snapd-1 gir1.2-unity-7.0
  gnome-software-common hplip-data libauthen-sasl-perl libclone-perl libcupsimage2 libdata-dump-perl libfile-listing-perl libflatpak0
  libfont-afm-perl libglu1-mesa libhpmud0 libhtml-form-perl libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl
  libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl libhttp-message-perl libhttp-negotiate-perl libimagequant0 libio-html-perl
  libio-socket-ssl-perl liblwp-mediatypes-perl libmailtools-perl libnet-http-perl libnet-smtp-ssl-perl libnet-ssleay-perl libraqm0
  libsane-hpaio libtie-ixhash-perl libtimedate-perl libtry-tiny-perl libvncclient1 libwww-robotrules-perl libxatracker2
  libxml-xpathengine-perl libxvmc1 perl-openssl-defaults printer-driver-postscript-hp python3-blinker python3-cffi-backend python3-chardet
  python3-cryptography python3-dateutil python3-debconf python3-debian python3-distro-info python3-distupgrade python3-idna python3-jeepney
  python3-jwt python3-keyring python3-lazr.uri python3-nacl python3-oauthlib python3-olefile python3-pexpect python3-pil
  python3-problem-report python3-protobuf python3-ptyprocess python3-pymacaroons python3-pyparsing python3-renderpm python3-reportlab
  python3-reportlab-accel python3-rfc3339 python3-secretstorage python3-six python3-systemd python3-tz python3-update-manager
  python3-urllib3 python3-wadllib ubuntu-advantage-desktop-daemon unattended-upgrades x11-apps x11-session-utils xbitmaps xinit xinput
  xserver-xorg-input-all xserver-xorg-input-libinput xserver-xorg-input-wacom xserver-xorg-video-all xserver-xorg-video-amdgpu
  xserver-xorg-video-ati xserver-xorg-video-fbdev xserver-xorg-video-intel xserver-xorg-video-nouveau xserver-xorg-video-qxl
  xserver-xorg-video-radeon xserver-xorg-video-vesa xserver-xorg-video-vmware
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  ca-certificates
The following NEW packages will be installed:
  openssl
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/1.184 kB of archives.
After this operation, 2.102 kB of additional disk space will be used.
Selecting previously unselected package openssl.
(Reading database ... 195686 files and directories currently installed.)
Preparing to unpack .../openssl_3.0.2-0ubuntu1.6_amd64.deb ...
Unpacking openssl (3.0.2-0ubuntu1.6) ...
Setting up openssl (3.0.2-0ubuntu1.6) ...
Processing triggers for man-db (2.10.2-1) ...

我不知道 Ubuntu 私人标牌密钥是什么?也许问题是“..crypto/”目录?

答案1

您可能启用了安全启动,而维护该驱动程序包的人显然不知道安全启动要求,或者根本不关心。

这是您尝试安装的驱动程序吗?https://github.com/mtorromeo/r8168

这些消息可能是无害的:

Skipping BTF generation for /home/deb/Downloads/r8168-8.050.03/src/r8168.ko due to unavailability of vmlinux 
arch/x86/Makefile:142: CONFIG_X86_X32 enabled but no binutils support 

但此消息表明内核已配置为对所有标准模块进行签名,以便在启用安全启动的情况下使用,并且驱动程序尝试使用相同的过程,但失败了,因为您自然没有 Ubuntu 的私有签名密钥:

At main.c:160:
    - SSL error:FFFFFFFF80000002:system library::No such file or directory: ../crypto/bio/bss_file.c:67
    - SSL error:10000080:BIO routines::no such file: ../crypto/bio/bss_file.c:75 
sign-file: certs/signing_key.pem: No such file or directory 

这意味着生成的模块将是未签名的,因此启用安全启动的系统必须拒绝它。

您可以通过以下步骤自行修复:

  1. 如果您尚未创建安全启动 MOK(机器所有者密钥),请立即创建:
sudo update-secureboot-policy --new-key

如果已经存在 MOK(即/var/lib/shim-signed/mok/目录存在且不为空),那么您可以跳过此步骤来使用它。

如果在安装 Ubuntu 22 的过程中,您激活了选项“安装图形和 Wi-Fi 硬件及其他媒体格式的第三方软件”及其子选项“配置安全启动”,那么您应该已经创建了一个现有的 MOK为你。在这种情况下,您不应创建新的 MOK,因为它可能会导致您的系统可能已在使用的其他第三方驱动程序出现问题。

  1. 使用kmodsign命令对模块进行签名:
sudo kmodsign sha512 \
    /var/lib/shim-signed/mok/MOK.priv \
    /var/lib/shim-signed/mok/MOK.der \
    /lib/modules/$(uname -r)/kernel/drivers/net/r8168.ko
  1. 更新您的 initramfs:
sudo update-initramfs -u
  1. 如果您在步骤 1 中创建了新的 MOK,则需要执行 MOK 注册程序。首先运行以下命令,这将要求您创建新的 MOK 注册密码:
sudo mokutil --import /var/lib/shim-signed/mok/MOK.der

该命令完成后,必须重新启动。这将中断启动过程,并在顶部shimx64.efi显示蓝色屏幕。Perform MOK management您应该选择“注册 MOK”选项,确认它,然后输入您刚刚使用上述命令创建的 MOK 注册密码。如果成功,您应该会看到一个小菜单,顶部项目为“重新启动”。选择它,系统应该正常启动,并带有安全启动签名的r8168.ko模块。

MOK注册成功完成后,MOK注册密码将永远不会再被需要:如果需要重新注册 MOK(可能在刷新 BIOS 后),将为该操作设置新的注册密码。

每当您的系统收到内核更新时,新内核可能会再次无法加载 r8168.ko 模块。如果发生这种情况,您必须手动重建此驱动程序:

  1. cd到您将驱动程序包解压到的目录:
cd ~/Downloads/r8168-8.050.03
  1. 重新运行autorun.sh
sudo bash autorun.sh
  1. 对重建的模块进行签名:(为了可读性,将其包装为多行:删除反斜杠以将此命令作为单个命令行输入)
sudo kmodsign sha512 \
    /var/lib/shim-signed/mok/MOK.priv \
    /var/lib/shim-signed/mok/MOK.der \
    /lib/modules/$(uname -r)/kernel/drivers/net/r8168.ko
  1. 更新您的 initramfs:
sudo update-initramfs -u

是的,如果驱动程序包维护者更新包以使用 DKMS 系统,这可以自动化。

相关内容