Home Posts Links Notes Now

r8169 and r8168

2023-12-07

Issues with network card

If I boot with HDMI display and keyboard plugged in everything works fine with the default Proxmox configuration. As soon as I unplug the keyboard connection drops and the only way to bring it back is to ifdown enp3s0 followed by ifup enp3s0. Boot without keyboard plugged in is broken too. Network will stay up for a brief amount of time before dropping.

I initially installed Proxmox 7.4, which shipped with kernel 5.15, and it was affected by the issue. I upgraded the kernel to 6.2 (apt install pve-kernel-6.2, I got 6.2.11-2-pve) and after that the issue stopped until I upgraded to Proxmox 8.0, which ships with another version of kernel 6.2 (6.2.16-3-pve) affected by the issue again.

The network adapter I have is a 03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15), which has a builtin driver in the kernel r8169 and a non-free driver r8168 (apt install r8168-dkms). According to some reports online moving to r8168 might help solving issues with the network adapter. I installed the new module and I've got issues similar to what's described in [SOLVED] Problems with RTL8111/8168/8411 PCI Express Gigabit Ethernet. There they suggest to use r8168 and add these parameters to the kernel r8168.aspm=0. The linked forum thread also specifies other options, but empirically they don't seem to be required.

I added the parameters to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub, ran update-grub and restarted and that seemed to solve the issue.

Proxmox 8.1

I upgraded to Proxmox 8.1, which comes with a new version of the kernel (6.5.11-4-pve). This broke r8168 coming from DKMS:

root@pve:~# dkms autoinstall 
Sign command: /lib/modules/6.5.11-4-pve/build/scripts/sign-file
Binary /lib/modules/6.5.11-4-pve/build/scripts/sign-file not found, modules won't be signed
Error! Your kernel headers for kernel 6.5.11-4-pve cannot be found at /lib/modules/6.5.11-4-pve/build or /lib/modules/6.5.11-4-pve/source.
Please install the linux-headers-6.5.11-4-pve package or use the --kernelsourcedir option to tell DKMS where it's located.
Error! One or more modules failed to install during autoinstall.
Refer to previous errors for more information.

This left me in a state where r8168 wasn't available Nov 24 10:07:43 pve (udev-worker)[591]: could not find module by name='r8168' shown in the logs and r8169 didn't load automatically. It took me a while to figure out why, but it was due to configuration in /etc/modprobe.d/r8168-dkms.conf:

# settings for r8168-dkms

# map the specific PCI IDs instead of blacklisting the whole r8169 module
alias	pci:v00001186d00004300sv00001186sd00004B10bc*sc*i*	r8168
alias	pci:v000010ECd00008168sv*sd*bc*sc*i*			r8168

# if the aliases above do not work, uncomment the following line
# to blacklist the whole r8169 module
#blacklist r8169

Running modprobe -a r8169 ; dhclient gave me connectivity back and so far (with the caveat of very limited testing) I am no longer having issues. To load r8169 on boot I edited /etc/modprobe.d/r8168-dkms.conf commenting out the aliases.

Thanks for reading. Feel free to reach out for any comment or question.