Realtek

Realtek 8168 腳本不起作用

  • July 30, 2022

我想使用最新的 Realtek 驅動程序,但使用 Ubuntu 22 我無法做到。Realtek 腳本刪除了舊的開源驅動程序,我只是用手機連接了 USB。這是 Realtek 日誌:

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/‘目錄?

您可能啟用了安全啟動,而維護該驅動程序包的人顯然不知道安全啟動要求,或者根本不在乎。

這是您嘗試安裝的驅動程序嗎?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 系統,這可以自動化。

引用自:https://unix.stackexchange.com/questions/711799