# Buggy Realtek Semiconductor RTL8111/8168B driver ?

## Joseph_sys

I have Motherboard: Gigabyte GA-990FXA-UD5

with:  Realtek RTL8111E chip (10/100/1000 Mbit) chip

The kernel-3.1.5-gentoo I'm using is loading:

```
Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)

   Subsystem: Giga-byte Technology GA-EP45-DS5 Motherboard

   Kernel driver in use: r8169
```

dmesg

```
 r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded

 r8169 0000:05:00.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17

 r8169 0000:05:00.0: setting latency timer to 64

 r8169 0000:05:00.0: irq 41 for MSI/MSI-X

 r8169 0000:05:00.0: eth0: RTL8168evl/8111evl at 0xffffc90000c1e000, 1c:6f:65:f9:5a:d6, XID 0c900800 IRQ 41
```

Yesterday, I lost connection.  Trying to reload the net.eth0 gave me some 168.xxx.... address (and I should get:10.0.0.xxx)

I reboot the computer but it did not help, I was still getting IP an "168.xxx...."

I disconnected the computer for 30min and after re-booting it obtained correct IP address.

Is this "Realtek RTL8111/8168B" still buggy?  Should I get an internal network card?  I need reliable connection.

I know there was a problem with this driver in kernel-3.0 dropping connection

----------

## bjlockie

I've been using it for years with no dropped connections.

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

What happens if you run dhcpcd manually?

```
dhcpcd eth0
```

----------

## Joseph_sys

 *bjlockie wrote:*   

> I've been using it for years with no dropped connections.
> 
> 01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)
> 
> What happens if you run dhcpcd manually?
> ...

 

I'll try it.

What kernel are you on?

From my knowledge they had some problems with the kernel-3.0 driver for this card.  Even official Gentoo-iso installation wouldn't obtain the eth0 IP address last December I had to use an older gentoo-iso to boot and install it.

I was somehow suppose to be fixed in 3.1 kernel, that is why I was running 3.1.5.  I see your revision is 01  mine is 06

There is a new driver in portage, maybe I'll load it manually.

http://packages.gentoo.org/package/net-misc/r8168

(this network card hangup on me for the second time since yesterday and the only way to revive it is to do a cold boot, reset the power switch otherwise I'll get a wrong IP address.)

----------

## Joseph_sys

Ho to emerge this driver "net-misc/r8168"

```
* Found sources for kernel version:

 *     3.1.6-gentoo

 * Checking for suitable kernel configuration options...

 *   r8168-8.026.00 requires Realtek 8169 PCI Gigabit Ethernet adapter (CONFIG_R8169) to be DISABLED
```

It keep asking me to disable the one in the kernel.

If I do so my network card will not function, how am I suppose to emerge something?

----------

## agent_jdh

emerge -f r8168

While you have a working ethernet connection; that will download the files required for the ebuild. Then rebuild your kernel (or just delete the .ko file if it's a module), reboot, and emerge r8168.

----------

## Joseph_sys

 *agent_jdh wrote:*   

> emerge -f r8168net-misc/r8168
> 
> While you have a working ethernet connection; that will download the files required for the ebuild. Then rebuild your kernel (or just delete the .ko file if it's a module), reboot, and emerge r8168.

 

I just recompile the kernel without the "R8169" build IN (without rebooting) and I was able to install the "net-misc/r8168".

Do I need to append the /etc/conf.d/modules

modules="r8168"

----------

## agent_jdh

Try it and see - I use the kernel r8169 module and it autoloads fine without having to specify it in /etc/conf.d/modules. YMMV.

----------

## Joseph_sys

 *agent_jdh wrote:*   

> Try it and see - I use the kernel r8169 module and it autoloads fine without having to specify it in /etc/conf.d/modules. YMMV.

 

I just removed any build IN r8169 driver from the kernel and emerge the "net-misc/r8168".

```
find /lib/modules/3.1.6-gentoo/ -type f -iname '*.o' -or -iname '*.ko' | less
```

shows that 

/lib/modules/3.1.6-gentoo/net/r8168.ko is there

However, it seems to me the newest one in the portage: net-misc/r8168-8.026.00

is loading the save network driver as the one that was build-IN kernel-3.1.5 and was giving me problems (losing connection, computer needs cold reboot).

```
Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller [10ec:8168] (rev 06)
```

If I lose connection again I'll be looking looking for more reliable network card, and will black list Realtek from my future network cards.

Do I need to clean the old kernel driver before I load a new one or "net-misc/r8168-8.026.00" is using the same what is in the kernel "R8169"

----------

## Joseph_sys

Do I need to black list the "r8169" if so how?

I've installed: net-misc/r8168-8.026.00

but: lspci -v

still keep showing me I'm using: "Kernel driver in use: r8169"

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

   Subsystem: Giga-byte Technology GA-EP45-DS5 Motherboard

   Flags: bus master, fast devsel, latency 0, IRQ 41

   I/O ports at ae00 [size=256]

   Memory at fd9ff000 (64-bit, prefetchable) [size=4K]

   Memory at fd9f8000 (64-bit, prefetchable) [size=16K]

   Capabilities: [40] Power Management version 3

   Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+

   Capabilities: [70] Express Endpoint, MSI 01

   Capabilities: [b0] MSI-X: Enable- Count=4 Masked-

   Capabilities: [d0] Vital Product Data

   Capabilities: [100] Advanced Error Reporting

   Capabilities: [140] Virtual Channel

   Capabilities: [160] Device Serial Number 12-34-56-78-12-34-56-78

   Kernel driver in use: r8169

   Kernel modules: r8168
```

----------

## j_c_p

 *bjlockie wrote:*   

> I've been using it for years with no dropped connections.
> 
> 01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)
> 
> What happens if you run dhcpcd manually?
> ...

 

You've got an older NIC (rev1) than Joseph_sys : he has got the RTL8111E (rev6 in the driver).

I've got the RTL8111C (rev2 in the driver).

 *Quote:*   

> 02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)
> 
>         Subsystem: Giga-byte Technology GA-EP45-DS5 Motherboard
> 
>         Flags: bus master, fast devsel, latency 0, IRQ 42
> ...

 

It works perfect for me too.

 *Quote:*   

> r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
> 
> r8169 0000:02:00.0: PCI INT A -> GSI 18 (level, low) -> IRQ 18
> 
> r8169 0000:02:00.0: setting latency timer to 64
> ...

 

 *Quote:*   

> r8169 0000:02:00.0: eth0: link down
> 
> r8169 0000:02:00.0: eth0: link down
> 
> ADDRCONF(NETDEV_UP): eth0: link is not ready
> ...

 

/etc/conf.d/net :

 *Quote:*   

> # This blank configuration will automatically use DHCP for any net.*
> 
> # scripts in /etc/init.d.  To create a more complete configuration,
> 
> # please review /etc/conf.d/net.example and save your configuration
> ...

 

jcp@phoenix64 ~ $ rc-status

Runlevel: default

 syslog-ng                                                                                                                                                           [  started  ]

 numlock                                                                                                                                                             [  started  ]

 bluetooth                                                                                                                                                           [  started  ]

 net.eth0                                                                                                                                                            [  started  ]

 cupsd                                                                                                                                                               [  started  ]

 hddtemp                                                                                                                                                             [  started  ]

 postfix                                                                                                                                                             [  started  ]

 sshd                                                                                                                                                                [  started  ]

 udev-postmount                                                                                                                                                      [  started  ]

 vixie-cron                                                                                                                                                          [  started  ]

 xdm                                                                                                                                                                 [  started  ]

 local                                                                                                                                                               [  started  ]

Dynamic Runlevel: hotplugged

Dynamic Runlevel: needed

 udev-mount                                                                                                                                                          [  started  ]

 sysfs                                                                                                                                                               [  started  ]

 dbus                                                                                                                                                                [  started  ]

Dynamic Runlevel: manual

```
CONFIG_NETDEVICES=y

# CONFIG_IFB is not set

# CONFIG_DUMMY is not set

# CONFIG_BONDING is not set

# CONFIG_MACVLAN is not set

# CONFIG_EQUALIZER is not set

# CONFIG_TUN is not set

# CONFIG_VETH is not set

# CONFIG_NET_SB1000 is not set

# CONFIG_ARCNET is not set

CONFIG_MII=y

# CONFIG_PHYLIB is not set

# CONFIG_NET_ETHERNET is not set

CONFIG_NETDEV_1000=y

# CONFIG_ACENIC is not set

# CONFIG_DL2K is not set

# CONFIG_E1000 is not set

# CONFIG_E1000E is not set

# CONFIG_IP1000 is not set

# CONFIG_IGB is not set

# CONFIG_IGBVF is not set

# CONFIG_NS83820 is not set

# CONFIG_HAMACHI is not set

# CONFIG_YELLOWFIN is not set

CONFIG_R8169=y

# CONFIG_SIS190 is not set

# CONFIG_SKGE is not set

# CONFIG_SKY2 is not set

# CONFIG_VIA_VELOCITY is not set

# CONFIG_TIGON3 is not set

# CONFIG_BNX2 is not set

# CONFIG_CNIC is not set

# CONFIG_QLA3XXX is not set

# CONFIG_ATL1 is not set

# CONFIG_ATL1E is not set

# CONFIG_ATL1C is not set

# CONFIG_JME is not set

# CONFIG_STMMAC_ETH is not set

# CONFIG_PCH_GBE is not set

# CONFIG_NETDEV_10000 is not set

# CONFIG_TR is not set

# CONFIG_WLAN is not set
```

----------

## cach0rr0

I have experience with only one system that uses r8169, a server rented from Hetzner (EQ4)

However it does not like hardened newer than 2.6.34. I know of at least one other Gentoo user who has had this same problem (he actually warned me about the issue). I thought it was supposed to be fixed with 3.x kernel, but I guess not. 

This sort of thing sometimes happens, I remember sky2 (Syskonnect Yukon 2) drivers caused a kernel panic a while ago. I think I saw a thread about e1000 having the same thing, but I have seen many threads over the years and my memory could betray me. 

Either way, I know 2.6.34-hardened seems to work ok with r8169, have not tried anything newer since I need this server for work.

----------

## Gusar

Hmm, this is just a guess, but... Do you guys have the linux-firmware package installed? It contains firmware for these cards in the rtl_nic directory. If the driver is compiled as a module, this firmware will get loaded. Might help. I have a "rev 03" of this card and I never had any issues.

----------

## bjlockie

 *Joseph_sys wrote:*   

> 
> 
> What kernel are you on?

 

3.2 now but I have used almost every version.

I update my kernel alot.

----------

## bjlockie

 *Joseph_sys wrote:*   

> Ho to emerge this driver "net-misc/r8168"
> 
> ```
> * Found sources for kernel version:
> 
> ...

 

I have always built it into my kernel, so I have no idea.

----------

## ycUygB1

The Realtek 8168 does not use the 8169 driver.  It uses the driver in http://code.google.com/p/r8168/

which is also in net-misc.  Attempts to use the 8169 driver are misguided and will fail in various ways and degrees.

The Gentoo install media does not contain the 8168 driver.  Thus, Gentoo cannot be easily installed on new hardware that has only this network card.

One would need network connectivity (which one cannot get) in order to retrieve the correct driver.

----------

## Gusar

 *hnaparst wrote:*   

> The Realtek 8168 does not use the 8169 driver.

 

Of course it does. It's what I use. But some people have issues (particularly those with rev06 of the device, while mine is rev03), so there's an external 8168 driver provided by Realtek that works better for them.

----------

## ycUygB1

OK, I stand corrected.  The 8168 uses the 8169 driver, but it doesn't work.  And the Gentoo install media doesn't recognize the hardware and therefore doesn't load the 8169 driver, which doesn't work anyway unless you happen to be doing an install on old hardware.

----------

## Gusar

If you have a variant that isn't recognized at all, please post the output of lspci -nn. The -nn is important, it will show the pci-id that I'm interested in.

----------

## ycUygB1

I am sorry for the delay.  I ordered an e1000 card, and when Amazon delivered it I was able to set up Gentoo.

```
03:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller [10ec:8168] (rev 06)

   Subsystem: ASUSTeK Computer Inc. P8P67 and other motherboards [1043:8432]

   Flags: bus master, fast devsel, latency 0, IRQ 42

   I/O ports at d000 [size=256]

   Memory at f0004000 (64-bit, prefetchable) [size=4K]

   Memory at f0000000 (64-bit, prefetchable) [size=16K]

   Capabilities: [40] Power Management version 3

   Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+

   Capabilities: [70] Express Endpoint, MSI 01

   Capabilities: [b0] MSI-X: Enable- Count=4 Masked-

   Capabilities: [d0] Vital Product Data

   Capabilities: [100] Advanced Error Reporting

   Capabilities: [140] Virtual Channel

   Capabilities: [160] Device Serial Number 00-00-00-00-00-00-00-00

   Kernel driver in use: r8169

   Kernel modules: r8169
```

On the fully built-out system, the r8169 module is able to get an IP address with a warning:

```

[   69.163479] r8169 0000:03:00.0: eth1: unable to load firmware patch rtl_nic/rtl8168e-3.fw (-2)

[   69.169416] r8169 0000:03:00.0: eth1: link down

[   69.169433] r8169 0000:03:00.0: eth1: link down

[   70.834321] r8169 0000:03:00.0: eth1: link up
```

I have not tested the stability of this link, although I have read that it is unstable.  The warning does not give me confidence either.

I will just say that:

1.  This card is not automatically recognized by the Gentoo minimal CD.  I think it might have pulled in the r8169 module, but that was as far as it got.

2.  In any event, for some reason, I was not able to connect to the internet with the 8169 module with the Gentoo install media.

2.  I have previously used the r8168 module with excellent success, speed, and stability.

I would humbly suggest that the r8168 module be added to the Gentoo install media.

----------

## Gusar

That firmware is in the linux-firmware package, as I indicated a few posts above. My card works without it, so there must be some integrated firmware already on the chip, but this external one possibly improves the functioning of the thing.

What's the kernel on the install media? Maybe it's simply too old to support your card, and a newer kernel works fine.

----------

## ycUygB1

The kernel on the install media is 3.5.7, which has since been marked as unstable.  The install media was downloaded this month, not sure of the exact date.

----------

