unable to install r8168-dkms for Realtek NIC

elfino

New Member
Hello everyone.
I'll try to be as breif as possible. I'm really sorry if i'm creating a thread for an old and well-discussed issue.
First and foremost, I'm new to Proxmox and Linux environments. It's a single-node homelab made of a Ryzen 3 CPU + A320 chipset, (i know it isn't recommended at all).

I've succesfully installed it, but i'm experiencing the well-known issue with Realtek ethernet controllers: randomly loosing network connection.
My motherboard has an integrated Realtek RTL8111H NIC, running r8169 driver under Proxmox 8.1 with kernel 6.5.11-6-pve (x86_64)
I searched as much as i could, and tried to fix it by my own, but now i feel i'm stucked. My knowledge limitations are encouraging me to ask for help.
I've read somewhere that Realtek r8168/9 drivers had always been an issue for Linux kernels, and the upgrade from pve 7.4 to 8 open it again..
What i've tried to do is to install the r8168-dkms driver from debian bookworm non-free repo, without success (pve-headers previously installed).

No matter what i do, I (always) get this error:
Code:
Building initial module for 6.5.1-6-pve
Error! Bad return status for module build on kernel: 6.5.1-6-pve (x86_64)
Consult /var/lib/dkms/r8168/8.051.02/build/make.log for more information.
dpkg: error processing package r8168-dkms (--configure):
    installed r8168-dkms package post-installation script subprocess returned error exit status 10
Processing triggers for initramfs-tools (0.142) ...
update-initramfs: Generating /boot/initrd.img-6.5.11-6-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.
Errors were encountered while processing:
    r8168-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)

FWIW each time i try to install it, i completely loose network connection. If i do lspci -vs 1b:00.0, it says "Kernel driver in use: r8169" and "Kernel modules: r8168". Even sometimes the "kerner driver in use" disappears.
Thanks in advance
 
What i've tried to do is to install the r8168-dkms driver from debian bookworm non-free repo, without success (pve-headers previously installed).
Hi,
adding to @gurubert s response, you probably are missing the kernel headers for your currently running kernel, not sure if you have installed them for all of your kernels or just one specific version.

The debian packages for the default kernel / headers are now called proxmox-default-kernel proxmox-default-headers, so please install apt install proxmox-default-kernel proxmox-default-headers

But of course, check the dkms make log for further information.
 
Hi guys, i'd like to thank you for your fast reply. Let me apologize in advance for my little to none experience on Linux.
not sure if you have installed them for all of your kernels or just one specific version.
I don't get what are you pointing out, so if you want to briefly explain me, i'd really appreciate that. I assume that there's one kernel per Proxmox system, and considering i only have one node, it's is the only kernel i've, Am i right? Does this answer your doubt?
The debian packages for the default kernel / headers are now called proxmox-default-kernel proxmox-default-headers, so please install apt install proxmox-default-kernel proxmox-default-headers
In the first intance, i've installed apt install pve-headers as i said, but i remember those words in the console output. That's why i query the installed packages using apt list –-installed | less and i found out this:
Code:
proxmox-default-headers/stable,now 1.0.1 all [installed, automatic]
proxmox-default-kernel/stable,now 1.0.1 all [installed]
So looks like this packages are already installed, right?

Regarding the make.log:
Code:
DKMS make.log for r8168-8.051.02 for kernel 6.5.11-6-pve (×86_64)
Thu Dec 7 02:24:14 AM -03 2023
make: Entering directory '/usr/src/linux-headers-6.5.11-6-pve'
    CC [M] /var/lib/dkms/r8168/8.051.02/build/r8168_n.o
    CC [M] /var/lib/dkms/r8168/8.051.02/build/r8168_asf.o
    CC [M] /var/lib/dkms/r8168/8.051.02/build/rtl_eeprom.o
    CC [M] /var/lib/dkms/r8168/8.051.02/build/rtltool.o
/var/lib/dkms/r8168/8.051.02/build/r8168_n.c: In function "r8168_csum_workaround"
/var/lib/dkms/r8168/8.051.02/build/r8168_n.c:29208:24: error: implicit declaration of function "skb_gso_segment"; did you mean "skb_gso_reset"? [-Werror=implicit-function-declaration]
29208     |        segs= skb_gso_segment(skb, features);
        |              ^~~~~~~~~~~~~~~
        |            skb_gso_reset
/var/lib/dkms/r8168/8.051.02/build/r8168_n.c:29208:22: warning: assignment to "struct sk_buff *" from "int" makes pointer from integer without a cast [-Wint-conversion]
29208     |        segs= skb_gso_segment(skb, features);
        |            ^
cc1: some warnings being treated as errors
make[2]: ***[scripts/Makefile.build:251: /var/lib/dkms/r8168/8.051.02/build/r8168_n.o] Error 1
make[1]: ***[/usr/src/linux-headers-6.5.11-6-pve/Makefile:2039: /var/lib/dkms/r8168/8.051.02/build] Error 2
make: *** [Makefile:234: __sub-make] Error 2
make: Leaving directory '/usr/src/linux-headers-6.5.11-6-pve'
 
Hi,
thank you, that's all i wanted to know. which options do i have now in terms of software? what do you recommend me to do? (aside from using an appropiate hardware o_O)
This is caused by an incompatibility in the r8168-dkms driver with kernels >6.4, as reported in the following bug report:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1050287

I assume that the Proxmox team will need to backport the later r8168-dkms package to PVE8 to restore support for the r8168 non-free driver on later Proxmox kernels.

As a workaround I installed r8168-dkms from trixie. Please be aware that this package version depends on a later dkms version (>= 3.0.11) than what is shipped with PVE8 (bookworm; 3.0.10); hence you will need to force the installation, in my case all I did was:

* Download the .deb file from https://packages.debian.org/trixie/r8168-dkms
* Install it using `dpkg --force-all -i r8168-dkms_8.052.01-1_all.deb`

Please note, that all further apt install/upgrade commands will want to remove the r8168-dkms package until a properly patched package is made available by the Proxmox team.
 
I ran into the same issue upon upgrading from 8.0 to 8.1. I had previously enabled the r8168 package because of the problem with the shipping realtek drivers misidentifying a r8168 as a r8169. Upon reboot the system hung. I can fix for now by pining the older kernel.

Anyone know if the core issue of the shipping driver misidentifying the the NIC has been fixed? In 6.5, can we just use the built in kernel modules and not have to play the dkms r8168 game?

Edit: Looks like it is supposed to work now: https://forum.proxmox.com/threads/a...3-network-not-work-anymore.136831/post-609005
 
Last edited:
This is caused by an incompatibility in the r8168-dkms driver with kernels >6.4, as reported in the following bug report:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1050287

I assume that the Proxmox team will need to backport the later r8168-dkms package to PVE8 to restore support for the r8168 non-free driver on later Proxmox kernels.


Thank you! This information was so helpful to me. I was able to get my downloads from mirror.turnkeylinux.org to go from ~200KBps to ~20MBps. A 100x increase in speed!!!!

Here are the steps I took in case others run into the same issue.

Code:
apt install r8168-dkms
apt install proxmox-headers-6.2
apt install proxmox-kernel-6.2
dkms build -m r8168 -v 8.051.02  -k 6.2.16-20-pve
dkms install -m r8168 -v 8.051.02  -k 6.2.16-20-pve
update-initramfs -u -k 6.2.16-20-pve 
proxmox-boot-tool kernel pin  6.2.16-20-pve
 
I did some digging and it seems that the r8168-dkms package in Debian testing is slightly newer, and fixed for the newer kernels. Unfortunately, it's not in bookworm-backports, probably because it is in the non-free repo.

On my system, I was about to reboot with a pinned 6.2 kernel, and decided to gamble a bit by installing this updated version through dpkg. It does claim a dependency on dkms >= 3.0.11, where we have 3.0.10 on bookworm/stable, but this does not seem to be a real requirement.
Here's what I did:
- wget the package from one of the mirrors (https://packages.debian.org/trixie/r8168-dkms)
- dpkg --force-depends -i r8168-dkms_8.052.01-1_all.deb
- proxmox-boot-tool kernel unpin
- reboot

Early to tell yet, but so far so good, running a 6.5 kernel, with a working network (at least, as well as I expect from Realtek :rolleyes:). Very much in the realm of "do this at your own risk" with my method, so if you can tolerate the older kernel, podmox's instructions above are certainly the cleaner method.

EDIT: minor changes, forgot I can't use markdown here
EDIT2: missed more of the markdown
 
Last edited:
So the system I did this on appears to still be running rock solid since then with the package from Debian trixie/testing, though it's not ideal, as apt is mad at me about the unmet dkms >= 3.0.11 dependency it declares. The package could probably work fully if rebuilt with >= 3.0.10 instead.

Hopefully the updated package gets sent down to stable, or maybe if proxmox could ship an updated package in their repos.
 
As far as I understand you don't need r8168-dkms anymore and the default r8169 module should work when running a fully updated PVE 8.1.4 with RTL8111/8411/8168 NICs.
 
That doesn't appear to be the case on the Dell Wyse 5070 at least, with 10ec:8168. Without the out of tree module, running the 6.5.13 kernel in Proxmox, this system does not have a working Ethernet controller, and this is resolved by installing Realtek's driver separately.

On that note, I was able to take the trixie/testing source, build it in bookworm/stable, and ended up with a package that installs cleanly, and should work. I used a Dockerfile and a bash script so I could build it on my laptop separately, without adding the build-dep packages on the affected machine. Not sure if we can post a .deb package here in the forums, but here's what I used to get one built:

Dockerfile:
Code:
FROM debian:bookworm-slim
RUN apt update
RUN apt install -y dpkg-dev devscripts
RUN echo deb-src http://deb.debian.org/debian testing main contrib non-free non-free-firmware >> /etc/apt/sources.list
RUN apt update
RUN mkdir /build
WORKDIR /build/
RUN apt source -y r8168-dkms
RUN apt build-dep -y r8168-dkms
RUN cd $(find -type d -not -name .) && debuild -b -uc -us

build.sh:
Code:
#!/usr/bin/env bash

image=debtmp
destination_path=./output
tmpdir=$(mktemp -d)
docker build -t $image .
container_id=$(docker create "$image")
docker cp "$container_id:/build" "$tmpdir"
docker rm "$container_id"
if [[ ! -d $destination_path ]]; then
    mkdir $destination_path
fi
cp "$tmpdir/build/"*.deb "$destination_path/"
rm -r "$tmpdir"
docker rm "$container_id"
docker rmi "$image"

It's certainly not the prettiest thing, but it does the trick, and gives you the generated .deb file in ./output, which I then just copied onto the affected system and installed via dpkg -i.

I'm certainly willing to post the package I built here if that's allowed generally and anybody is interested.

Edit to add: this basically results in this package, but built on bookworm, avoiding the dependency issues.
 
Last edited:
I've automated the build via GitHub, in case you prefer not to install build dependencies on your PVE host. Please make sure to review the changes I made in the repository before installing the .deb, though.

GitHub release: https://github.com/nathanhi/r8168/releases/tag/pve8/8.052.01-1-bpo12
.deb binary: https://github.com/nathanhi/r8168/releases/download/pve8/8.052.01-1-bpo12/r8168-dkms_8.052.01-1-bpo12_all.deb
Changes in release: https://github.com/nathanhi/r8168/compare/debian/8.052.01-1...pve8/8.052.01-1-bpo12

The baseline tag debian/8.052.01-1 with commit 15de9fb92a60592020ad86061b8392fa25435ddf is straight from Debians Salsa: https://salsa.debian.org/debian/r8168/-/commits/debian/8.052.01-1?ref_type=tags and reflects the latest release from trixie (https://packages.debian.org/trixie/r8168-dkms).

Once I notice new upstream/Debian releases for the package, I'll provide an updated release on GitHub until r8168-dkms is properly part of bookworm-backports.
 
Last edited:
I've automated the build via GitHub, in case you prefer not to install build dependencies on your PVE host. Please make sure to review the changes I made in the repository before installing the .deb, though.

GitHub release: https://github.com/nathanhi/r8168/releases/tag/pve8/8.052.01-1-bpo12
.deb binary: https://github.com/nathanhi/r8168/releases/download/pve8/8.052.01-1-bpo12/r8168-dkms_8.052.01-1-bpo12_all.deb
Changes in release: https://github.com/nathanhi/r8168/compare/debian/8.052.01-1...pve8/8.052.01-1-bpo12

The baseline tag debian/8.052.01-1 with commit 15de9fb92a60592020ad86061b8392fa25435ddf is straight from Debians Salsa: https://salsa.debian.org/debian/r8168/-/commits/debian/8.052.01-1?ref_type=tags and reflects the latest release from trixie (https://packages.debian.org/trixie/r8168-dkms).

Once I notice new upstream/Debian releases for the package, I'll provide an updated release on GitHub until r8168-dkms is properly part of bookworm-backports.
That's work like a charme for me. Thanks for your work. :)

Best regards,
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!