Naoki Aoyama
naa0yama's Blog

naa0yama's Blog

Proxmox VE Realtek r8168 の対応

Naoki Aoyama's photo
Naoki Aoyama
·Mar 27, 2022·

5 min read

Proxmox VE 7.1-1 を利用しているが Realtek 8168 の NIC が搭載されているが、 Realtek 8169 のドライバーが当たりパケロスが発生していた。

# lspci | grep RTL8
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)

解決方法

  1. r8168 のドライバーをインストールする
  2. DKMS を設定
  3. r8169 をブラックリストに入れる

r8168 のドライバーをインストールする

apt remove --purge 'linux-headers-*'
apt install build-essential pve-headers dkms
  • ファイルを展開
tar xf r8168-8.049.02.tar.bz2
  • build の確認
cd r8168-8.049.02
make modules
make clean
  • うまくいくと、エラーは出ずに完了する
# make modules
make -C src/ modules
make[1]: Entering directory '/root/r8168-8.049.02/src'
make -C /lib/modules/5.13.19-6-pve/build M=/root/r8168-8.049.02/src modules
make[2]: Entering directory '/usr/src/linux-headers-5.13.19-6-pve'
  CC [M]  /root/r8168-8.049.02/src/r8168_n.o
  CC [M]  /root/r8168-8.049.02/src/r8168_asf.o
  CC [M]  /root/r8168-8.049.02/src/rtl_eeprom.o
  CC [M]  /root/r8168-8.049.02/src/rtltool.o
  LD [M]  /root/r8168-8.049.02/src/r8168.o
  MODPOST /root/r8168-8.049.02/src/Module.symvers
  CC [M]  /root/r8168-8.049.02/src/r8168.mod.o
  LD [M]  /root/r8168-8.049.02/src/r8168.ko
make[2]: Leaving directory '/usr/src/linux-headers-5.13.19-6-pve'
make[1]: Leaving directory '/root/r8168-8.049.02/src'
  • 中間ファイルの消去は下記のコマンド
# make clean
make -C src/ clean
make[1]: Entering directory '/root/r8168-8.049.02/src'
make -C /lib/modules/5.13.19-6-pve/build M=/root/r8168-8.049.02/src clean
make[2]: Entering directory '/usr/src/linux-headers-5.13.19-6-pve'
  CLEAN   /root/r8168-8.049.02/src/Module.symvers
make[2]: Leaving directory '/usr/src/linux-headers-5.13.19-6-pve'
make[1]: Leaving directory '/root/r8168-8.049.02/src'
  • dkms ファイルの作成
cd 
rm -rf /usr/src/r8168-8.049.02
cp -av r8168-8.049.02 /usr/src/

nano /usr/src/r8168-8.049.02/dkms.conf
PACKAGE_NAME="r8168"
PACKAGE_VERSION="8.049.02"
CLEAN="make clean"
BUILT_MODULE_LOCATION[0]="src/"
BUILT_MODULE_NAME[0]="${PACKAGE_NAME}"
MAKE[0]="cd ${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build; make KVER=${kernelver} modules"
DEST_MODULE_LOCATION[0]="/updates/dkms"
AUTOINSTALL="yes"
  • add, build, install
dkms add -m r8168 -v 8.049.02
dkms build -m r8168 -v 8.049.02
dkms install -m r8168 -v 8.049.02

動作確認

  • 今のバージョンを調べる
# uname -r
5.13.19-6-pve


# dpkg --get-selections | grep -E 'pve-(kernel|headers)'
pve-headers                                     install
pve-headers-5.13                                install
pve-headers-5.13.19-2-pve                       install
pve-headers-5.13.19-6-pve                       install
pve-kernel-5.13                                 install
pve-kernel-5.13.19-5-pve                        install
pve-kernel-5.13.19-6-pve                        install
pve-kernel-helper                               install
  • 不要なカーネルがある場合は消す
    • pve-headers-5.13.19-2-pve
    • pve-kernel-5.13.19-5-pve
# apt autoremove --purge pve-headers-5.13.19-2-pve pve-kernel-5.13.19-5-pve


# dpkg --get-selections | grep -E 'pve-(kernel|headers)'
pve-headers                                     install
pve-headers-5.13                                install
pve-headers-5.13.19-6-pve                       install
pve-kernel-5.13                                 install
pve-kernel-5.13.19-6-pve                        install
pve-kernel-helper                               install
  • dkms ですでに組み込まれているとテストにならないため確認する
    • 今回は 5.13.19-5-pve がすでにあったためアンインストールする
# dkms status
r8168, 8.049.02, 5.13.19-5-pve, x86_64: installed
r8168, 8.049.02, 5.13.19-6-pve, x86_64: installed

# dkms remove -m r8168 -v 8.049.02 -k 5.13.19-5-pve

-------- Uninstall Beginning --------
Module:  r8168
Version: 8.049.02
Kernel:  5.13.19-5-pve (x86_64)
-------------------------------------

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

r8168.ko:
 - Uninstallation
   - Deleting from: /lib/modules/5.13.19-5-pve/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 status
r8168, 8.049.02, 5.13.19-6-pve, x86_64: installed
  • バージョンに対応した pve-headers が必要なのでインストールしておく
apt install pve-headers-5.13.19-5-pve

# dpkg --get-selections | grep -E 'pve-(kernel|headers)'
pve-headers                                     install
pve-headers-5.13                                install
pve-headers-5.13.19-5-pve                       install
pve-headers-5.13.19-6-pve                       install
pve-kernel-5.13                                 install
pve-kernel-5.13.19-6-pve                        install
pve-kernel-helper                               install

今現在稼働してるのが 5.13.19-6-pve だったため、 5.13.19-5-pve で再インストールをしてみる

下記の当たりで正しく処理されているのを確認する

  • Building module:
  • DKMS: build completed.
  • DKMS: install completed.
# apt reinstall pve-kernel-5.13.19-5-pve
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  pve-kernel-5.13.19-5-pve
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 66.9 MB of archives.
After this operation, 328 MB of additional disk space will be used.
Get:1 http://download.proxmox.com/debian/pve bullseye/pve-no-subscription amd64 pve-kernel-5.13.19-5-pve amd64 5.13.19-13 [66.9 MB]
Fetched 64.5 MB in 23s (2,815 kB/s)                                                                                                                                                                         
Selecting previously unselected package pve-kernel-5.13.19-5-pve.
(Reading database ... 104843 files and directories currently installed.)
Preparing to unpack .../pve-kernel-5.13.19-5-pve_5.13.19-13_amd64.deb ...
Unpacking pve-kernel-5.13.19-5-pve (5.13.19-13) ...
Setting up pve-kernel-5.13.19-5-pve (5.13.19-13) ...
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 5.13.19-5-pve /boot/vmlinuz-5.13.19-5-pve
run-parts: executing /etc/kernel/postinst.d/dkms 5.13.19-5-pve /boot/vmlinuz-5.13.19-5-pve
dkms: running auto installation service for kernel 5.13.19-5-pve:
Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
cd /var/lib/dkms/r8168/8.049.02/build; make KVER=5.13.19-5-pve modules.........
cleaning build area...

DKMS: build completed.

r8168.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.13.19-5-pve/updates/dkms/

depmod...

DKMS: install completed.
.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.13.19-5-pve /boot/vmlinuz-5.13.19-5-pve
update-initramfs: Generating /boot/initrd.img-5.13.19-5-pve
Running hook script 'zz-proxmox-boot'..
Re-executing '/etc/kernel/postinst.d/zz-proxmox-boot' in new private mount namespace..
No /etc/kernel/proxmox-boot-uuids found, skipping ESP sync.
run-parts: executing /etc/kernel/postinst.d/proxmox-auto-removal 5.13.19-5-pve /boot/vmlinuz-5.13.19-5-pve
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 5.13.19-5-pve /boot/vmlinuz-5.13.19-5-pve
run-parts: executing /etc/kernel/postinst.d/zz-proxmox-boot 5.13.19-5-pve /boot/vmlinuz-5.13.19-5-pve
Re-executing '/etc/kernel/postinst.d/zz-proxmox-boot' in new private mount namespace..
No /etc/kernel/proxmox-boot-uuids found, skipping ESP sync.
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 5.13.19-5-pve /boot/vmlinuz-5.13.19-5-pve
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.13.19-6-pve
Found initrd image: /boot/initrd.img-5.13.19-6-pve
Found linux image: /boot/vmlinuz-5.13.19-5-pve
Found initrd image: /boot/initrd.img-5.13.19-5-pve
Found memtest86+ image: /boot/memtest86+.bin
Found memtest86+ multiboot image: /boot/memtest86+_multiboot.bin
Adding boot menu entry for EFI firmware configuration
done
Scanning processes...                                                                                                                                                                                        
Scanning processor microcode...                                                                                                                                                                              
Scanning linux images...                                                                                                                                                                                     

Running kernel seems to be up-to-date.

The processor microcode seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.
  • あとかたつけ
# apt autoremove --purge pve-headers-5.13.19-5-pve pve-kernel-5.13.19-5-pve
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  pve-headers-5.13.19-5-pve* pve-kernel-5.13.19-5-pve*
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 411 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 111945 files and directories currently installed.)
Removing pve-headers-5.13.19-5-pve (5.13.19-13) ...
Removing pve-kernel-5.13.19-5-pve (5.13.19-13) ...
Examining /etc/kernel/prerm.d.
run-parts: executing /etc/kernel/prerm.d/dkms 5.13.19-5-pve /boot/vmlinuz-5.13.19-5-pve
dkms: removing: r8168 8.049.02 (5.13.19-5-pve) (x86_64)

-------- Uninstall Beginning --------
Module:  r8168
Version: 8.049.02
Kernel:  5.13.19-5-pve (x86_64)
-------------------------------------

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

r8168.ko:
 - Uninstallation
   - Deleting from: /lib/modules/5.13.19-5-pve/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.
Examining /etc/kernel/postrm.d.
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 5.13.19-5-pve /boot/vmlinuz-5.13.19-5-pve
update-initramfs: Deleting /boot/initrd.img-5.13.19-5-pve
run-parts: executing /etc/kernel/postrm.d/proxmox-auto-removal 5.13.19-5-pve /boot/vmlinuz-5.13.19-5-pve
run-parts: executing /etc/kernel/postrm.d/zz-proxmox-boot 5.13.19-5-pve /boot/vmlinuz-5.13.19-5-pve
Re-executing '/etc/kernel/postrm.d/zz-proxmox-boot' in new private mount namespace..
No /etc/kernel/proxmox-boot-uuids found, skipping ESP sync.
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 5.13.19-5-pve /boot/vmlinuz-5.13.19-5-pve
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.13.19-6-pve
Found initrd image: /boot/initrd.img-5.13.19-6-pve
Found memtest86+ image: /boot/memtest86+.bin
Found memtest86+ multiboot image: /boot/memtest86+_multiboot.bin
Adding boot menu entry for EFI firmware configuration
done
(Reading database ... 81494 files and directories currently installed.)
Purging configuration files for pve-kernel-5.13.19-5-pve (5.13.19-13) ...
Examining /etc/kernel/postrm.d.
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 5.13.19-5-pve /boot/vmlinuz-5.13.19-5-pve
update-initramfs: Deleting /boot/initrd.img-5.13.19-5-pve
run-parts: executing /etc/kernel/postrm.d/proxmox-auto-removal 5.13.19-5-pve /boot/vmlinuz-5.13.19-5-pve
run-parts: executing /etc/kernel/postrm.d/zz-proxmox-boot 5.13.19-5-pve /boot/vmlinuz-5.13.19-5-pve
Re-executing '/etc/kernel/postrm.d/zz-proxmox-boot' in new private mount namespace..
No /etc/kernel/proxmox-boot-uuids found, skipping ESP sync.
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 5.13.19-5-pve /boot/vmlinuz-5.13.19-5-pve
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.13.19-6-pve
Found initrd image: /boot/initrd.img-5.13.19-6-pve
Found memtest86+ image: /boot/memtest86+.bin
Found memtest86+ multiboot image: /boot/memtest86+_multiboot.bin
Adding boot menu entry for EFI firmware configuration
done


# dpkg --get-selections | grep -E 'pve-(kernel|headers)'
pve-headers                                     install
pve-headers-5.13                                install
pve-headers-5.13.19-6-pve                       install
pve-kernel-5.13                                 install
pve-kernel-5.13.19-6-pve                        install
pve-kernel-helper                               install


# dkms status
r8168, 8.049.02, 5.13.19-6-pve, x86_64: installed

r8169 をブラックリストに入れる

cat <<EOF> /etc/modprobe.d/blacklist.conf
blacklist r8169

EOF
 
Share this