Skip to content

Instantly share code, notes, and snippets.

@SQLJames
Last active April 26, 2025 07:16
Show Gist options
  • Save SQLJames/fe6fcd5e819d864986ce2eff6ad350da to your computer and use it in GitHub Desktop.
Save SQLJames/fe6fcd5e819d864986ce2eff6ad350da to your computer and use it in GitHub Desktop.
proxmox realtek driver issues

Edit 2

Here are the steps I took to upgrade my nodes when the time came. Make sure that your apt upgrade and apt dist-upgrade don't have any errors.

Additionally, on one of my nodes, I had to confirm the grub install location. So It may be good to do this prior to upgrading by confirming the mount point of your boot disk.

apt remove --purge r8168-dkms -y
rm /etc/modprobe.d/blacklist-r8169.conf
sudo sed -i 's/GRUB_CMDLINE_LINUX="r8168.aspm=0 r8168.eee_enable=0 pcie_aspm=off loglevel=3"/GRUB_CMDLINE_LINUX=""/' /etc/default/grub
update-grub
proxmox-boot-tool refresh
apt update
apt upgrade -y
apt dist-upgrade -y
reboot -n

Edit 1

Updating the proxmox kernel will require you to remove this and potentially reapply https://forum.proxmox.com/threads/autoinstall-for-kernel-6-5-11-3-pve-failed.136818/

Ansible role

https://github.com/PragmaticEngineering/ansibleRole-proxmox-realtek

Descripton

As part of proxmox 8.0 the realtek drivers are having issues where after a certain amount of time the node will go offline and lose connectivity. Here are the steps I took with a no-subscription repo.

to know if you could be affected by this issue, log into your proxmox host, either via ssh or keyboard and display and run:

lspci -nnk

if you are affected, you should see a Ethernet controller from Realtek Semiconductor Co. using the r8169 driver

for example

01:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 15)
        Subsystem: Dell RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [1028:07a3]
        Kernel driver in use: r8169
        Kernel modules: r8169

Summary

vi /etc/apt/sources.list


deb http://ftp.us.debian.org/debian bookworm main contrib non-free non-free-firmware

deb http://ftp.us.debian.org/debian bookworm-updates main contrib non-free non-free-firmware

# security updates
deb http://security.debian.org bookworm-security main contrib non-free non-free-firmware

deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription

apt update

apt install pve-headers -y

apt install r8168-dkms -y

apt upgrade -y

echo blacklist r8169 >> /etc/modprobe.d/blacklist-r8169.conf

sudo sed -i 's/GRUB_CMDLINE_LINUX=""/GRUB_CMDLINE_LINUX="r8168.aspm=0 r8168.eee_enable=0 pcie_aspm=off loglevel=3"/' /etc/default/grub

proxmox-boot-tool refresh

reboot -n

Walkthrough

modify the repository source list. These repositories provide packages and updates for your system. vi /etc/apt/sources.list

deb http://ftp.us.debian.org/debian bookworm main contrib non-free non-free-firmware
deb http://ftp.us.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
# security updates
deb http://security.debian.org bookworm-security main contrib non-free non-free-firmware
deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription

After modifying the sources.list file we need to make sure the system updates the package list from the repositories

apt update

Heres where most issues came up for me, we need to install the pve-headers pacakge. because without it, we will have issues compiling the realtek-dkms package. The -dkms suffix indicates that it's a Dynamic Kernel Module Support package, which means it can be automatically rebuilt whenever the kernel is updated. When you install this package, it uses the kernel headers (provided by pve-headers) to build and install the Realtek network card driver as a kernel module.

apt install pve-headers -y

Install the Realtek 8168 network card driver as a Dynamic Kernel Module Support package. It can automatically rebuild the driver when the kernel is updated.

apt install r8168-dkms -y

Then, for good measure I made sure my other packages were updated.

apt upgrade -y

blacklist the 8169 driver from being loaded

echo blacklist r8169 >> /etc/modprobe.d/blacklist-r8169.conf

Once all of this is completed we are going to update our GRUB to have some specific kernel parameters for our realtek driver

sed -i 's/GRUB_CMDLINE_LINUX=""/GRUB_CMDLINE_LINUX="r8168.aspm=0 r8168.eee_enable=0 pcie_aspm=off loglevel=3"/' /etc/default/grub

Finally, we are are going to refresh the boot configuration for Proxmox and reboot.

proxmox-boot-tool refresh reboot -n

@Aussiefox
Copy link

Thanks SQLJames, working well. As a Linux noob, does this need to be undone at some point?

@encg
Copy link

encg commented Nov 18, 2023

Thanks @SQLJames! My OptiPlex 3080 was having this exact problem.

@snod
Copy link

snod commented Nov 21, 2023

FIREBAT-Mini PC T8 PRO PLUS

I can confirm that this approach works on said device.

@lupsys
Copy link

lupsys commented Nov 25, 2023

After following the steps, when I restart, the card doesn't start automatically. I have to start it manually with modprobe, then bring up the card, and finally restart with systemctl restart networking. What could be happening? I've followed the steps exactly, copy and paste.
After installation, I will check if the module has been installed in /lib/modules/$(uname -r)/kernel/drivers/net/ethernet/realtek, and if the r8168.ko module is not present, only r8169.ko. This is normal because it does not load automatically every time I restart.

@shaunsull
Copy link

See this forum post for the 6.5.11-4-pve kernel. update. I know nothing about how all this driver issue works, but this fixed my issue after upgrading. Since I upgraded three nodes without reading this first (duh!), I had to connect a keyboard and monitor and boot to the old kernel. Note to self, wait for updates to settle and check the forums before jumping in.

https://forum.proxmox.com/threads/proxmox-ve-8-1-released.136960/post-608898

To be able to update the kernel to 6.5.11-4-pve, WITH R8168 kernel module working, you need to build the kernel module for the new version of the kernel. The module was previously build for the kernel version you were running.

@PP-Mclappins
Copy link

I've done the fix, and I am now seeing the correct driver in place when running "lspci -nnk"

Unfortunately after the node reboot, I am still not seeing the card in my networking tab as a Network interface.

going to attempt to manually bring the card up, but not sure how it's going to go, Any ideas?

@skrilla0
Copy link

I'm just discovering this after having stability issues upgrading from 7.4 -> 8 and had to downgrade. Noob question, but should this be applied after upgrading to 8?

@SQLJames
Copy link
Author

I'm just discovering this after having stability issues upgrading from 7.4 -> 8 and had to downgrade. Noob question, but should this be applied after upgrading to 8?

@skrilla0 when I went to 8.2.2 I had to uninstall this patch from the nodes (see edit 2) prior to upgrading otherwise I ran into issues with apt on the upgrade as it would need the new over headers to compile to dkms package again.

@frankievalentine
Copy link

When trying to install r8168-dkms I receive Error! Bad return status for module build on kernel: 6.8.12-2-pve (x86_64). I'm currently on Proxmox 8.2.7. Any fix for this? Thanks!

@jaknz
Copy link

jaknz commented Dec 18, 2024

Same for me, it looks like there are some implicit function declarations that are no longer valid in the source. I've followed these steps to install the latest firmware-realtek and it seems to be working fine for me, with the caveat that it won't be automatically updated in the future.
https://forum.proxmox.com/threads/install-non-free-firmware-on-pve-8-without-removing-meta-package-proxmox-ve.134675/post-595143

When trying to install r8168-dkms I receive Error! Bad return status for module build on kernel: 6.8.12-2-pve (x86_64). I'm currently on Proxmox 8.2.7. Any fix for this? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment