Wednesday, 14 September 2011

Networking mystery with Realtek r8169

eth0 stopped working. Maybe due to the 3.0 kernel upgrade?
dhcpcd showed "Link is not ready" and "no carrier" and I could not get an IP.
I tried dhclient instead of dhcpcd, no results, although dhclient seems to be a nicer solution in general (more informative log output and faster connection in my opinion).

My ethernet driver according to lspci -v is:

09:00.0 Ethernet controller:
Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 03)

Subsystem: Lenovo Device 21c5
Flags: bus master, fast devsel, latency 0, IRQ 42
I/O ports at 2000 [size=256] Memory at f0804000 (64-bit, prefetchable) [size=4K] Memory at f0800000 (64-bit, prefetchable) [size=16K] [virtual] Expansion ROM at f0820000 [disabled] [size=128K] Capabilities: [40] Power Management version 3 Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+ Capabilities: [70] Express Endpoint, MSI 01 Capabilities: [ac] MSI-X: Enable- Count=4 Masked- Capabilities: [cc] Vital Product Data Capabilities: [100] Advanced Error Reporting Capabilities: [140] Virtual Channel Capabilities: [160] Device Serial Number 4e-00-00-00-68-4c-e0-00
Kernel driver in use: r8169
Kernel modules: r8169

Google says that the r8169 driver is buggy, if any problem occurs installing a newer driver can help. Ok. How?

* If you have the same issue, please go to the end of this post for a possible solution, you might not need to do all these steps I made.

AUR's r8169 package did not work for me, the download link had an authentication problem, the driver could not be downloaded.

OK. Let's find another source, realtek's homepage:

Actually this package should install the r8168 driver and remove the native r8169 one.
After clicking on several dead links on Realtek's page one moment I could finally download the "LINUX driver for kernel 2.6.x and 2.4.x (Support x86 and x64)" (8.025.00 ) driver package.
I unpacked the tarball and went on the way that the README said but again I faced a problem: the r8168 module could not be loaded (modprobe r8168 said: "FATAL: Module r8168 not found."). At the same time r8169 could not be loaded either (the installation moved it to somewhere else), so now i had no ethernet driver at all. Sad thing, now what?

Googling again I found the solution after a day of madness:
Download the above mentioned Realtek driver package, untar it, step into the install directory, run the according to the README. After do this as root (still in the installation directory):

depmod -a
insmod ./src/r8168.ko
cp ./src/r8168.ko /lib/modules/$(uname -r)/kernel/drivers/net/
modprobe r8168

Now the last two lines of lspci -v have to say something like this:
Kernel driver in use: r8168
Kernel modules: r8168

(instead of r8169).

Now edit your /etc/rc.conf and put r8168 into the MODULES section. If r8169 was there then delete it or restrict it with (... r8168 !r8169 ...)

Huh, that was a hard day!

* And now I see that AUR has a r8168 package. Probably installing this could have solved my problem in one step but it is too late, I have done it in a different - apparently much more difficult - way. Please try this AUR package first if you have a similar problem. You still might need to change your daemons array in your rc.conf to use the newly installed driver instead of the old one.


  1. Hi

    I try the aur package and i cant get my wired connection up

  2. Hello Erik,
    what is the problem exactly? Is either of the modules r8168 or r8169 loaded? You can check it with:
    lsmod | grep r816