r8168 with DKMS built for wrong kernel version 27. May 2014
A computer of mine has one of those dreaded Realtek 8168 network chips, that are basically supported by the in-kernel
r8169 module, but crashes in some way when under high load using that driver.
Well the solution is found many places in the internet: Use the
r8168 module provided by Realtek themselves as open source and be happy. But obviously I want to automate the installation of this third-party module, and that’s exactly what DKMS (Dynamic Kernel Module Support) is for, all with triggers on kernel updates and stuff.
There are many places where the
r8168 is described, often stating that we need to use
'make' instead of
make and so on. But seemingly nobody noticed that there is a problem: The module is always built for the currently running kernel version. That’s obvious nonsense when you just installed a new kernel and want to built your network driver before booting the new kernel.
And that’s the fault of the
Makefile provided with the
r8168 module, since it uses
uname -r no matter what to determine where to get the kernel headers. Using the DKMS Packaging guide at the Kubuntu wiki I modified the
dkms.conf to use the supplied kernel version if given:
Interestingly enough, even the
r8168-dkms package in Debian Sid seems to get this wrong (if I didn’t misinterpret the source). Or maybe they do something else to fix it, because they are using
make instead of
So hopefully I will never again boot without a fully functioning network card and maybe even someone else benefits from this little notice.