Fixing RTL8111/8168B kernel module on Debian/Ubuntu

For many years, issues with the r8169 module have plagued Debian and related Linux distributions such as Ubuntu.

You’ll see lots of ifconfig errors and stuff like this on desktop mainboards with a Realtek NIC:

Oct 29 07:40:32 c1100d335 kernel: [1996163.743022] NETDEV WATCHDOG: eth0: transmit timed out
Oct 29 07:40:32 c1100d335 kernel: [1996163.777667] r8169: eth0: link up
Oct 29 08:17:38 c1100d335 kernel: [1998515.536001] NETDEV WATCHDOG: eth0: transmit timed out
Oct 29 08:17:38 c1100d335 kernel: [1998515.554022] r8169: eth0: link up
Oct 29 08:38:50 c1100d335 kernel: [1999866.799565] NETDEV WATCHDOG: eth0: transmit timed out
Oct 29 08:38:50 c1100d335 kernel: [1999866.817750] r8169: eth0: link up
Oct 29 09:12:56 c1100d335 kernel: [2002018.492904] NETDEV WATCHDOG: eth0: transmit timed out
Oct 29 09:12:56 c1100d335 kernel: [2002018.508900] r8169: eth0: link up
Oct 29 09:56:20 c1100d335 kernel: [2004766.751497] NETDEV WATCHDOG: eth0: transmit timed out
Oct 29 09:56:20 c1100d335 kernel: [2004766.771105] r8169: eth0: link up
Oct 29 10:19:38 c1100d335 kernel: [2006244.296991] NETDEV WATCHDOG: eth0: transmit timed out
Oct 29 10:19:38 c1100d335 kernel: [2006244.319198] r8169: eth0: link up
Oct 29 10:41:02 c1100d335 kernel: [2007610.618895] NETDEV WATCHDOG: eth0: transmit timed out
Oct 29 10:41:02 c1100d335 kernel: [2007610.636753] r8169: eth0: link up
Oct 29 10:53:38 c1100d335 kernel: [2008416.126505] NETDEV WATCHDOG: eth0: transmit timed out
Oct 29 10:53:38 c1100d335 kernel: [2008416.228687] r8169: eth0: link up

Or if you’re lucky, you get this:

Oct 29 15:21:29 mirror kernel: [20796.791066] NETDEV WATCHDOG: eth0: transmit timed out
Oct 29 15:21:29 mirror kernel: [20796.791109] ------------[ cut here ]------------
Oct 29 15:21:29 mirror kernel: [20796.791133] WARNING: at net/sched/sch_generic.c:222 dev_watchdog+0xa6/0xfb()
Oct 29 15:21:29 mirror kernel: [20796.791159] Modules linked in: nf_conntrack_ipv4 xt_tcpudp xt_conntrack iptable_mangle nf_conntrack_ftp ipt_REJECT ipt_LOG xt_limit xt_multiport xt_state nf_conntrack iptable_filter ip_tables x_tables ipv6 loop parport_pc parport i2c_i801 i2c_core psmouse button snd_hda_intel serio_raw snd_pcm snd_timer snd soundcore snd_page_alloc rng_core pcspkr intel_agp evdev ext3 jbd mbcache sd_mod piix ide_pci_generic ide_core usbhid hid ff_memless ata_generic ata_piix libata scsi_mod dock uhci_hcd ehci_hcd r8169 thermal processor fan thermal_sys [last unloaded: scsi_wait_scan]
Oct 29 15:21:29 mirror kernel: [20796.791457] Pid: 0, comm: swapper Not tainted 2.6.26-2-amd64 #1
Oct 29 15:21:29 mirror kernel: [20796.791482]
Oct 29 15:21:29 mirror kernel: [20796.791484] Call Trace:
Oct 29 15:21:29 mirror kernel: [20796.791517]  <IRQ>  [<ffffffff80234958>] warn_on_slowpath+0x51/0x7a
Oct 29 15:21:29 mirror kernel: [20796.795054]  [<ffffffff803cc972>] dev_watchdog+0x0/0xfb
Oct 29 15:21:29 mirror kernel: [20796.795054]  [<ffffffff802353f3>] printk+0x4e/0x56
Oct 29 15:21:29 mirror kernel: [20796.795054]  [<ffffffff80212507>] read_tsc+0x9/0x20
Oct 29 15:21:29 mirror kernel: [20796.795054]  [<ffffffff8023cf15>] lock_timer_base+0x26/0x4b
Oct 29 15:21:29 mirror kernel: [20796.795054]  [<ffffffff8023d0a4>] __mod_timer+0xbd/0xcc
Oct 29 15:21:29 mirror kernel: [20796.795054]  [<ffffffff80243847>] queue_delayed_work_on+0xb8/0xc8
Oct 29 15:21:29 mirror kernel: [20796.795054]  [<ffffffff803cc972>] dev_watchdog+0x0/0xfb
Oct 29 15:21:29 mirror kernel: [20796.795054]  [<ffffffff803cca18>] dev_watchdog+0xa6/0xfb
Oct 29 15:21:29 mirror kernel: [20796.795054]  [<ffffffff803cc972>] dev_watchdog+0x0/0xfb
Oct 29 15:21:29 mirror kernel: [20796.795054]  [<ffffffff8023c9d5>] run_timer_softirq+0x16a/0x1e2
Oct 29 15:21:29 mirror kernel: [20796.795054]  [<ffffffff802393a1>] __do_softirq+0x5c/0xd1
Oct 29 15:21:29 mirror kernel: [20796.795054]  [<ffffffff8020d2dc>] call_softirq+0x1c/0x28
Oct 29 15:21:29 mirror kernel: [20796.795054]  [<ffffffff8020f3e8>] do_softirq+0x3c/0x81
Oct 29 15:21:29 mirror kernel: [20796.795054]  [<ffffffff802392ff>] irq_exit+0x3f/0x85
Oct 29 15:21:29 mirror kernel: [20796.795054]  [<ffffffff8021aaab>] smp_apic_timer_interrupt+0x8c/0xa4
Oct 29 15:21:29 mirror kernel: [20796.795054]  [<ffffffff80212b57>] mwait_idle+0x0/0x4d
Oct 29 15:21:29 mirror kernel: [20796.795054]  [<ffffffff8020cd02>] apic_timer_interrupt+0x72/0x80
Oct 29 15:21:29 mirror kernel: [20796.795054]  <EOI>  [<ffffffff80212b98>] mwait_idle+0x41/0x4d
Oct 29 15:21:29 mirror kernel: [20796.795054]  [<ffffffff8020ad04>] cpu_idle+0x8e/0xb8
Oct 29 15:21:29 mirror kernel: [20796.795054]
Oct 29 15:21:29 mirror kernel: [20796.795054] ---[ end trace 90f2af131b1794c6 ]---
Oct 29 15:21:29 mirror kernel: [20796.811063] r8169: eth0: link up

If you’re REALLY lucky (or leave the machine powered up for a few weeks), you might see this followed by a complete lock-up:

Oct 28 09:40:35 mirror kernel: [1800333.162704] NETDEV WATCHDOG: eth0: transmit timed out
Oct 28 09:41:40 mirror kernel: [1800397.679803] Modules linked in: nf_conntrack_ipv4 xt_tcpudp xt_conntrack iptable_mangle nf_conntrack_ftp ipt_REJECT ipt_LOG xt_limit xt_multiport xt_state nf_conntrack iptable_filter ip_tables x_tables i
pv6 loop parport_pc parport button snd_hda_intel pcspkr rng_core snd_pcm snd_timer snd soundcore snd_page_alloc psmouse i2c_i801 serio_raw i2c_core intel_agp evdev ext3 jbd mbcache usbhid hid ff_memless sd_mod piix ide_pci_generic ide_cor
e r8169 ata_generic ata_piix libata scsi_mod ehci_hcd dock uhci_hcd thermal processor fan thermal_sys [last unloaded: scsi_wait_scan]
Oct 28 09:41:40 mirror kernel: [1800397.679803] CPU 2:
Oct 28 09:41:40 mirror kernel: [1800397.679803] Modules linked in: nf_conntrack_ipv4 xt_tcpudp xt_conntrack iptable_mangle nf_conntrack_ftp ipt_REJECT ipt_LOG xt_limit xt_multiport xt_state nf_conntrack iptable_filter ip_tables x_tables i
pv6 loop parport_pc parport button snd_hda_intel pcspkr rng_core snd_pcm snd_timer snd soundcore snd_page_alloc psmouse i2c_i801 serio_raw i2c_core intel_agp evdev ext3 jbd mbcache usbhid hid ff_memless sd_mod piix ide_pci_generic ide_cor
e r8169 ata_generic ata_piix libata scsi_mod ehci_hcd dock uhci_hcd thermal processor fan thermal_sys [last unloaded: scsi_wait_scan]
Oct 28 09:41:40 mirror kernel: [1800397.679803] Pid: 17, comm: events/2 Tainted: G        W 2.6.26-2-amd64 #1
Oct 28 09:41:40 mirror kernel: [1800397.679803] RIP: 0010:[<ffffffff8042a52a>]  [<ffffffff8042a52a>] _spin_lock+0x10/0x15
Oct 28 09:41:40 mirror kernel: [1800397.679803] RSP: 0018:ffff81007f3f7ec8  EFLAGS: 00000287
Oct 28 09:41:40 mirror kernel: [1800397.679803] RAX: 000000000000100f RBX: 0000000000000100 RCX: ffffffff803f1263
Oct 28 09:41:40 mirror kernel: [1800397.679803] RDX: ffff8100379803e8 RSI: 0000000000000011 RDI: ffff81001a483080
Oct 28 09:41:40 mirror kernel: [1800397.679803] RBP: ffff81007f3f7e40 R08: ffff81001a4833e0 R09: 0000000000000000
Oct 28 09:41:40 mirror kernel: [1800397.679803] R10: ffff810080a4e000 R11: ffffffff8021a857 R12: ffffffff8020cd02
Oct 28 09:41:40 mirror kernel: [1800397.679803] R13: ffff81007f3f7e40 R14: ffff81001a483040 R15: ffff81001a483040
Oct 28 09:41:40 mirror kernel: [1800397.679803] FS:  0000000000000000(0000) GS:ffff81007f378240(0000) knlGS:0000000000000000
Oct 28 09:41:40 mirror kernel: [1800397.679803] CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
Oct 28 09:41:40 mirror kernel: [1800397.679803] CR2: 00007f1cbc2c2f20 CR3: 0000000000201000 CR4: 00000000000006e0
Oct 28 09:41:40 mirror kernel: [1800397.679803] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Oct 28 09:41:40 mirror kernel: [1800397.679803] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Oct 28 09:41:40 mirror kernel: [1800397.679803]
Oct 28 09:41:40 mirror kernel: [1800397.679803] Call Trace:
Oct 28 09:41:40 mirror kernel: [1800397.679803]  <IRQ>  [<ffffffff803f1275>] ? tcp_delack_timer+0x12/0x1eb
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff803f1263>] ? tcp_delack_timer+0x0/0x1eb
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff8023c9d5>] ? run_timer_softirq+0x16a/0x1e2
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff802393a1>] ? __do_softirq+0x5c/0xd1
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff8020d2dc>] ? call_softirq+0x1c/0x28
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff8020f3e8>] ? do_softirq+0x3c/0x81
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff802392ff>] ? irq_exit+0x3f/0x85
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff8021aaab>] ? smp_apic_timer_interrupt+0x8c/0xa4
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff8020cd02>] ? apic_timer_interrupt+0x72/0x80
Oct 28 09:41:40 mirror kernel: [1800397.679803]  <EOI>  [<ffffffffa027835c>] ? :nf_conntrack:nf_conntrack_in+0x2/0x4fe
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff803d4d74>] ? nf_iterate+0x41/0x7d
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff803dcac8>] ? dst_output+0x0/0xb
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff803d4e0d>] ? nf_hook_slow+0x5d/0xbe
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff803dcac8>] ? dst_output+0x0/0xb
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff803dde05>] ? __ip_local_out+0x9b/0x9d
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff803dde10>] ? ip_local_out+0x9/0x1f
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff803de9ce>] ? ip_queue_xmit+0x29f/0x2f2
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff803ee700>] ? tcp_transmit_skb+0x731/0x76e
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff803b66bc>] ? __alloc_skb+0x7f/0x12d
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff803ece9b>] ? tcp_rcv_state_process+0x9f8/0xa2a
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff803f31b7>] ? tcp_v4_do_rcv+0x42b/0x49d
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffffa02a942d>] ? :nf_conntrack_ipv4:ipv4_confirm+0xd1/0xdd
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff803d4d74>] ? nf_iterate+0x41/0x7d
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff803e16e7>] ? __inet_lookup_established+0xf1/0x192
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff803f518f>] ? tcp_v4_rcv+0x693/0x6e4
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff803da7ca>] ? ip_local_deliver_finish+0x120/0x1dd
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff803da687>] ? ip_rcv_finish+0x32f/0x352
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff803daba4>] ? ip_rcv+0x22e/0x273
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffffa009a91c>] ? :r8169:rtl8169_rx_interrupt+0x4fa/0x511
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffffa009ca7e>] ? :r8169:rtl8169_reset_task+0x41/0xea
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffffa009ca3d>] ? :r8169:rtl8169_reset_task+0x0/0xea
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff802430a4>] ? run_workqueue+0x82/0x111
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff80243971>] ? worker_thread+0xd5/0xe0
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff802461a5>] ? autoremove_wake_function+0x0/0x2e
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff8024389c>] ? worker_thread+0x0/0xe0
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff8024607f>] ? kthread+0x47/0x74
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff802300ed>] ? schedule_tail+0x27/0x5c
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff8020cf38>] ? child_rip+0xa/0x12
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff80246038>] ? kthread+0x0/0x74
Oct 28 09:41:40 mirror kernel: [1800397.679803]  [<ffffffff8020cf2e>] ? child_rip+0x0/0x12
Oct 28 09:41:40 mirror kernel: [1800397.679803]

Luckily, there is hope. You can blacklist the in-kernel driver and install a vendor-supplied module.

cd /usr/src
wget http://djlab.com/stuff/r8168-8.032.00.tar.bz2
tar jxvf r8168-8.032.00.tar.bz2
cd r8168-8.032.00
make clean modules
make install
depmod -a
echo "blacklist r8169" >> /etc/modprobe.d/blacklist-network.conf
update-initramfs -u

Then, reboot the box and check which driver you’re using with ‘ethtool -i eth0’. It should now be r8168 instead of r8169:

driver: r8168
version: 8.032.00-NAPI
firmware-version:
bus-info: 0000:01:00.0

Update – 2/22/2011

I’m re-posting Daniel’s automation with DKMS. These are cut-and-paste-ready code-blocks.

Make sure dkms and gcc are installed:

apt-get install dkms gcc

Create the dkms.conf:

cat <<EOF > /usr/src/r8168-8.032.00/dkms.conf
PACKAGE_NAME=r8168
PACKAGE_VERSION=8.032.00
MAKE[0]="'make'"
BUILT_MODULE_NAME[0]=r8168
BUILT_MODULE_LOCATION[0]="src/"
DEST_MODULE_LOCATION[0]="/kernel/updates/dkms"
AUTOINSTALL="YES"
EOF

Then run:

dkms add -m r8168 -v 8.032.00
dkms build -m r8168 -v 8.032.00
dkms install -m r8168 -v 8.032.00

Done! Now it will automatically be compiled and installed for new kernels.

40 Responses to Fixing RTL8111/8168B kernel module on Debian/Ubuntu

  1. Daniel Myall says:

    I used this to fix up a server with issues. If you wish to make this work with dkms so it is automatically rebuilt when the kernel is updated then:

    Make sure dkms and gcc are installed:
    apt-get install dkms gcc

    Create the file /usr/src/r8168-8.019.00/dkms.conf containing:

    *Snipped* — Look at the original post for a working example!

    Done! Now it will automatically be compiled and installed for new kernels.

  2. Tim says:

    @ Daniel : I have an issue with the DKMS method ans debian squeeze:

    root@Jupiter-Dom0:/usr/src# dkms add -m r8168 -v 8.020.00
    dkms.conf: Error! Directive ‘DEST_MODULE_LOCATION’ does not begin with
    ‘/kernel’, ‘/updates’, or ‘/extra’ in record #0.
    Error! Bad conf file.
    File: /usr/src/r8168-8.020.00/dkms.conf
    does not represent a valid dkms.conf file.

    *Snipped* — Look at the original post for a working example!

    Any idea ?

  3. squarism says:

    Awesome follow up Daniel! I was troubleshooting kernel panics while SCP’ing. Found this 8168 driver which fixed the weirdness but this dkms stuff is nice icing on the cake. I just installed some new prebuilt kernel debs from kernel.ubuntu.com and the dkms hooks fired off. Nice, never even heard of dkms. Thanks for the original post and the comment.

  4. happy says:

    awesome. This helped me fix iscsi on Ubuntu 10.10. My motherboard used the r8169 driver, and I replaced it with the r8168 driver and followed daniel’s steps too.

    Before the update, I had terrible hangs, freeze, about 4MB/s transfer over gigabit ethernet, now with the r8169 driver I get 50MB/s over iscsi and no more freezes. no more link up/down messages. Thanks Randy and Daniel.

  5. 1of16 says:

    Damn nice guys! Finally i found the solution for my dell vostro v130!

    btw. there is a never driver. check the realtek website.

  6. Randy says:

    @1of16

    Yes, I know there’s a newer driver but this one works perfectly and their heavy javascript crap doesn’t work with wget or any other command line grabber. Otherwise I would have linked directly.

  7. 1of16 says:

    @Randy
    ok 🙂

    @Tim
    replace the ” with ‘ and it will work 🙂

  8. Randy says:

    @1to16 and @Daniel

    I re-posted the DKMS stuf in code blocks on the original article to fix the charset issues make dkms.conf creation easier.

  9. Edward says:

    when i update the kernel today the r8168 module was not automatically rebuild and install to the new kernel. The new kernel still load the r8169 module.

    I am currently running Ubuntu 10.10 (64bit) and r8168 v8.021.00

    Please help.

  10. 1of16 says:

    You followed all the instructions and blacklisted the driver?
    you took a look at your logfiles?
    I got some problems myself, but only cause I played with both drivers versions and dkms didn’t know what to do 😉 so i removed the drivers, only added the newest and reinstalled the kernel. now its working fine!

  11. […] solution worked. It’s pretty lengthy and I’ll save it for another post. There’s some stuff on the web about it. Basically you use dkms to build a module that supposed to be updated everytime […]

  12. It works like a charm!

    The only thing I have to modify was to adapt the makefile to the debian way:

    KDIR := /usr/src/linux-headers-$(KVER)/

    http://bernaerts.dyndns.org/linux/49-debian-server-rtl8111

    Thank you for sharing your knowledge and time

    Best regards!

    Juan Sierra Pons

  13. bandroidx says:

    installed natty on my brand new sandy bridge machine and was getting epic frame drops, awesome awesome awesome! you are the man.

  14. bandroidx says:

    i forgot to mention, my newer motherboard (H61) required the newer driver, you might want to update your download for that reason. With your posted driver I got a “chip not identified” or something when modprobing the driver. Once i updated it worked.

  15. Terry says:

    Thanks for this – I was experiencing crashes with the r8169 module in recent kernel builds, using Realtek’s driver seems to have resolved the problems.

  16. liori says:

    Success report: Gigabyte GA-Z68X-UD3H-B3 works after applying those instructions, with minor remark: 8.019.00 doesn’t work, I got the newest one (8.024.00).

  17. Chris says:

    FYI – with the newest 8.027.00 version of the driver, I had to change the dkms.conf slightly:

    MAKE[0]="'make'"

    That is, the command in double-quotes is ‘make’ with the single quotes. Doing this causes dkms to avoid sending the KERNELRELEASE argument to make. The r8168 Makefile tries to do something special if KERNELRELEASE is set, but it doesn’t work. Suppressing it made everything work fine for me.

  18. Zrin says:

    The current version of the driver from Realtek (8.028.00) has a buggy src/Makefile, it has to be corrected in orther to compile with dkms:


    ifneq ($(KERNELRELEASE),)
    BASEDIR := /lib/modules/$(KERNELRELEASE)
    else
    BASEDIR := /lib/modules/$(shell uname -r)
    endif

    … (remove endif at the end of the file)

  19. Tomek says:

    All of this is not required anymore for Kubuntu 11.10 and r8168-8.029.00.tar.bz2 driver. All you have to do is this (tested on the fresh copy of the system):

    sudo -s
    apt-get install make gcc
    tar xvjf r8168-8.029.00.tar.bz2
    cd r8168-8.029.00/
    ./autorun.sh

    that is it, than you can check

    lspci -v | grep r8
    Kernel driver in use: r8168
    Kernel modules: r8168

    And the net works fine!

  20. Bughunter says:

    Is this still a problem with current kernels used by squeeze in 2012-04 ? Thanks!

    1. Randy says:

      No idea. Installing these drivers is just habit for me, don’t want to risk it unless there’s evidence it’s solved.

  21. Carlos says:

    Yes, the issue is still present in squeeze (kernel 2.6.32)

  22. alberto says:

    Well, im using latest debian testing (using 0.29.00), and even tho it does not drops packages, once the link of the eth0 goes down is very hard to bring it back without rebooting… Just my 2cents

  23. alberto says:

    the problem comes with the kernel version of the driver. I just installed the one from realteak to check how it goes

  24. Jacco says:

    Just upgraded from Ubuntu 11.10 (fully patched) to Ubuntu 12.04 LTS (which appeared 2 days ago). With Ubuntu 11.10 I used the Realtek-provided driver r8168.
    After upgrading to Ubuntu 12.04 the problem seems to be gone: my onboard rtl8111/8168B still triggers the rtl8169 driver (kernel provided) to be loaded, but now it works like a charm. No hickups anymore, and scp-speed (using arcfour cipher) is > 50 MB/sec.
    Nice! And it was about time!

  25. Marcello says:

    Hi, thanks for the useful information.
    Unfortunately I cannot bring up eth0 after installing r8168 with the dkms method described. The driver compiles and installs fine, I have blacklisted r8169 and rebooted, and r8168 loads automatically just fine.
    BUT, the ethernet interface doesn’t appear.
    I also removed /etc/udev/rules.d/70-persistent-net.rules which then was recreated upon reboot, but that didn’t help either.

    BTW, my card is a D-Link System Inc DGE-528T Gigabit Ethernet Adapter (rev 10)

    If I do a lspci -v, I still read Kernel modules: r8169

  26. Marcello says:

    Forgot to mention, I’m on debian squeeze.

  27. Romain says:

    Many thanks to the author of this article, he saved my life.

    What happened:
    – installed Debian Squeeze on a brand new computer.
    – no problem for one week.
    – installed Windows 7 on another partition.
    – problems began just after : “r8169 0000:03:00.0: eth0: link up” every few seconds in logs.
    – tried the following : reboot, power off, install firmware-realtek firmware-linux-nonfree, rebuild ramfs. None did work.
    – following this blog, I installed driver Realtek 8.019. It did not detecte my card.
    – I downloaded the latest driver : Realtek 8.0.32. Now, it works perfectly.

    Thanks, once again.

    1. Randy says:

      Can you confirm all the install steps are the same for new driver except the version numbers? If so, please email me the driver tarball used and I’ll update the original post (amps@djlab.com). I have issues with the RT website and have a hard time downloading the drivers.

  28. Romain says:

    Randy,

    Sorry, I did not see your answer until now.

    The only thing I changed beside the release version is the /etc/modprobe.d/blacklist-network file name that has been renamed to /etc/modprobe.d/blacklist-network.conf to prevent warning from Debian modprobe.

    I sent the archive at randy at djlab.com. Hope it works.

  29. Randy says:

    Got it, and I updated the post with the newer version number and modprobe.d filename. If anyone has issues let me know.

  30. Jan Schnackenberg says:

    Oh lord… Thank you Chris for the "'make'" hint…

    I’ve tried to get this to work for months and just now I’m stumbling across this.

  31. Flittermice says:

    Thanks for posting this info plus the ‘make’ hint (not knowing this made really big trouble…)
    I can confirm that this works for driver version r8168-8.034.00 as well!

  32. noel ikalina says:

    I need help for this erorr message please!
    foodmansilaysvr@foodmansilaysvr-System-Product-Name:/usr/src/r8168-8.032.00$ depmod -a
    FATAL: Could not open /lib/modules/2.6.38-16-generic/modules.dep.temp for writing: Permission denied

  33. Alt0160 says:

    With 036 drivers you may get and error about RxChkS1um undefined… just open the file /usr/src/r8168-8.036.00/src/r8168_n.c and replace RxChkS1um with RxChkSum.

    BTW it seems that on my computer each kernel update is a “do it again daaaaddy” even using the dkms trick. Must be missing something but i dunno what (skill, intelligence….).

  34. Serg says:

    Good job. Works on Ubuntu server 12.04 with 8.036.00 and dkms.

  35. […] If you have problems with the kernel not even loading the correct module = drivers for RealTek 8168, this may provide necessary insight (ie. hardware detection problem):http://djlab.com/2010/10/fixing-rtl8111-8168b-driver-debian-ubuntu/ […]

  36. […] Der bei Debian/Ubuntu mitgelieferte Treiber “r8169″ ist in Kombination mit der Realtek RTL8111/8168B ein Muster an Unzuverlässigkeit. Die Lösung des Problems fand sich schließlich in Randy’s Blog […]

  37. Michael says:

    worked fine with 8.0039

    did your guide on debian wheezy:

    root@storageSB:~# ethtool -i eth0
    driver: r8168
    version: 8.039.00-NAPI
    firmware-version:
    bus-info: 0000:03:00.0
    supports-statistics: yes
    supports-test: no
    supports-eeprom-access: no
    supports-register-dump: yes
    supports-priv-flags: no