3

My laptop has a Realtek RTL8168 Ethernet card, which works pretty well. Except at some times, where the connection just gets dropped and I have to un- and replug the cable in order to reset the connection.

I've tried the preinstalled r8169 module, but now I'm using the r8168 module built with the source from Realtek's website. The problem occurs with both driver modules.

$ lspci | grep Ethernet
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)

$ dmesg
#stops working, no reports
#unplugging
[ 9324.277753] r8168: eth0: link down
[ 9328.636380] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
#replugging
[ 9334.316610] r8168: eth0: link up
[ 9334.316744] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
#Working again

PS: With grep NetworkManager /var/log/syslog, I've fould the following, around the time such a connection interruption happened:

#EDIT:These messages are printed when I plug out the cable. Before, there is nothing
Jan 28 23:40:31 dracarys NetworkManager[912]: <info> (eth0): carrier now OFF (device state 100, deferring action for 4 seconds)
Jan 28 23:40:35 dracarys NetworkManager[912]: <info> (eth0): device state change: activated -> unavailable (reason 'carrier-changed') [100 20 40]
Jan 28 23:40:35 dracarys NetworkManager[912]: <info> (eth0): deactivating device (reason 'carrier-changed') [40]
Jan 28 23:40:35 dracarys NetworkManager[912]: <info> (eth0): canceled DHCP transaction, DHCP client pid 6975
Jan 28 23:40:35 dracarys NetworkManager[912]: <warn> DNS: plugin dnsmasq update failed
Jan 28 23:40:35 dracarys NetworkManager[912]: <info> Removing DNS information from /sbin/resolvconf
Jan 28 23:40:35 dracarys NetworkManager[912]: <info> NetworkManager state is now DISCONNECTED
#replug
Jan 28 23:40:40 dracarys NetworkManager[912]: <info> (eth0): carrier now ON (device state 20)
Jan 28 23:40:40 dracarys NetworkManager[912]: <info> (eth0): device state change: unavailable -> disconnected (reason 'carrier-changed') [20 30 40]
Jan 28 23:40:40 dracarys NetworkManager[912]: <info> Auto-activating connection 'Wired connection 1'.
Jan 28 23:40:40 dracarys NetworkManager[912]: <info> Activation (eth0) starting connection 'Wired connection 1'
Jan 28 23:40:40 dracarys NetworkManager[912]: <info> (eth0): device state change: disconnected -> prepare (reason 'none') [30 40 0]
Jan 28 23:40:40 dracarys NetworkManager[912]: <info> NetworkManager state is now CONNECTING

And then it worked again

Any ideas on how to fix this? Let me know if you need additional information.

EDIT: $ modinfo r8168

filename:       /lib/modules/3.13.0-37-generic/kernel/drivers/net/ethernet/realtek/r8168.ko
version:        8.038.00-NAPI
license:        GPL
description:    RealTek RTL-8168 Gigabit Ethernet driver
author:         Realtek and the Linux r8168 crew <netdev@vger.kernel.org>
srcversion:     7600C3366E422907A1D79F1
alias:          pci:v00001186d00004300sv00001186sd00004B10bc*sc*i*
alias:          pci:v000010ECd00008168sv*sd*bc*sc*i*
depends:        
vermagic:       3.13.0-37-generic SMP mod_unload modversions 
parm:           eee_enable:int
parm:           speed:force phy operation. Deprecated by ethtool (8). (ushort)
parm:           duplex:force phy operation. Deprecated by ethtool (8). (int)
parm:           autoneg:force phy operation. Deprecated by ethtool (8). (int)
parm:           aspm:Enable ASPM. (int)
parm:           s5wol:Enable Shutdown Wake On Lan. (int)
parm:           rx_copybreak:Copy breakpoint for copy-only-tiny-frames (int)
parm:           timer_count:Timer Interrupt Interval. (int)
parm:           debug:Debug verbosity level (0=none, ..., 16=all) (int)
  • There is a command line utility systool, which is a part of sysfsutils package. It allows viewing with which parameters enabled/disabled the module is actually loaded during runtime. I'd suggest you download that, check what parameters are set for your r8168 module, and then play around with changing those options by adding them to /etc/modprobe/r8168.conf file. Among other things, instead of uplugging/replugging, restart the network-manager service with sudo service network-manager restart – Sergiy Kolodyazhnyy Feb 2 '15 at 6:11
  • 1
    Seppi, I had an HP NW 9440 a few years back with the exact same problem and it turned out to be a wiring problem. (long story) Did you try another cable and/or visually inspecting (with a magnifying glass) the wires inside your port? – Fabby Feb 2 '15 at 14:10
  • @Serg The only parameter is eee_enable, which is not activated. How exactly would I enable it? (But I doubt it would change anything) – s3lph Feb 2 '15 at 14:35
  • @the_Seppi Well, eee_enable isnt the only thing I'd try to toggle. I'll post it in more details as an answer soon. – Sergiy Kolodyazhnyy Feb 2 '15 at 20:11
  • By the way, is it a recent issue ? has it started after upgrading to a newer kernel ? – Sergiy Kolodyazhnyy Feb 2 '15 at 20:34
1

N.B : This answer is by no means final. I've came up with a couple possible solutions based on some research online as well as personal suggestions from experience.

Replace Kernel Module

From researching online, it appears that frequently the best solution is to replace the r8168 module that comes with Ubuntu installation, with a newer , updated version. For instance, this crunchbang post.

This Ubuntu Forums post from 2012 documents a script for a newer, updated version of the r8168 module. You can do sudo apt-get install linux-headers-$(uname -r) or sudo apt-get install --reinstall linux-headers-$(uname -r) , and then follow matera.ttp's instructions. Praseonym, who also posted there, suggests installing the driver with dkms , which is supposed to rebuild modules for each kernel update. Now, you should have dkms already installed, and you could check it with which dkms . So you could either use Praseonym's instructions or matera.ttp's . The idea is the same.

Tweak Module Settings

For many network issues tweaking the module configurations could help solve the issues, but frankly I doubt it's an issue, since you've used r8169 with same effect. Nonetheless , give it a try.

In the /etc/modprobe.d/ directory, create r8168.conf file. In that file, write:

options eee_enable=1

Save and reboot.

Now, you could do very much same thing with other options. For instance, my first guess was to add options timer_count=3600 to the r8168.conf file. Why 3600 ? Assuming that the parameter deals with time, then it's most likely seconds.

I've found a case where it actually didn't work, and the problem was bios related. Refer to this page: http://ubuntuforums.org/showthread.php?t=2138125&page=2

If everything else fails

I've mentioned on other posts as well, that sometimes hardware is the issue and no matter how much tweaking you do - it won't help. In personal experience , I've dealt with two rtl8192 wireless chipsets, one of which was giving weird sound bug, but the other works almost flawlessly.

I suggest you explore possible replacements for your ethernet card. My suggestion would be portable usb hub with ethernet slot, much like these

  • "do the [...] same thing with other options"? eee_enable is the only displayed parameter in systool -vm r8168. Btw. there's a new version of the driver (8.039). I'm currently compiling it and then we'll see whether it fixes things. – s3lph Feb 3 '15 at 18:35
  • It complains about your config file: libkmod: ERROR ../libkmod/libkmod-config.c:686 kmod_config_parse: /etc/modprobe.d/r8168.conf line 1: ignoring bad line starting with 'options' – s3lph Feb 3 '15 at 18:38
0

A few days ago I found a new release of the driver (8.039.900) on Realtek's website. I downloaded, compiled and installed it, and never experienced any connection drops since.

Update r8168:

The most current driver source can be downloaded here.

Extract the downloaded archive and run

sudo make

in the extraction folder. After compilation, the currently installed r8168 module will be automatically replaced by the new version (which in my opinion should only happen when running make install)

To load the new version, run

sudo modprobe -r r8168 && sudo modprobe r8168

PS: Don't use the installation script which comes with this driver. It will uninstall the old module (no matter whether r8168 or r8169) before even attempting to compile the new one. If the compilation fails, you're left without internet, if you don't have WiFi or another Ethernet card.

-1

I think, you need to install more stable official driver for Realtek (RTL8111/RTL8168) ethernet card.

1. Get root privileges

Get root privileges, while typing “su” or (when you use Ubuntu) “sudo -s” in a terminal.

2. Get the requirements

To build and install the driver, we need the kernel headers and the build tools like gcc. To get them, just easily type in a terminal:

apt-get install build-essential

3. Get the driver

Now, go to the official download page from Realtek for the Linux/UNIX Driver for the RTL8111/RTL8168 ethernet card and download the latest driver version.

Link: Realtek Download Page

4. Untar the archive

The driver is compressed to an archive. So uncompress it with the following command:

tar xfvj r8168-8.025.00.tar.bz2

NOTE: Please do not forget to replace the “r8168-8.025.00.tar.bz2″ with the driver version which you have downloaded!

5. Blacklist old driver

We have to blacklist the old driver (r8169) to prevent the system to load it. To do this, easily set a new entry in “/etc/modprobe.d/blacklist.conf” which is called:

blacklist r8169

or just enter in the terminal again

echo “blacklist r8169″ >> /etc/modprobe.d/blacklist.conf

to do this in only one command.

6. Build and install the new driver

Now, the whole requirements to install the new driver are done. Let us now change in the driver directory, which we have uncompressed in a few steps before:

cd r8168-8.025.00

NOTE: Again, please do not forget, to change “r8168-8.025.00″ to the version which you have downloaded.

The only think we have to do now is, to build the driver and install it. To build it, just type:

make clean modules

after a few secondes (depending on your CPU), the driver is build and you can install it with:

make install

7. Welcome r8168

One of our last steps is, to let the system know about the r8168 driver. With the command

depmod -a

you rebuild the kernel module dependencies and with an

insmod ./src/r8168.ko

you insert the new kernel module (the driver) into the kernel.

8. Make it available for boot

To always use the new module, you have to make a new initrd boot file. Just do

mkinitramfs -o /boot/initrd.img-`uname -r` `uname -r`

in a terminal. Here we make the initrd file with the help of the “uname -r” command, which allows us to get the version of the actually running kernel.

At least, you have to add in the “/etc/modules” file a new entry, which is called “r8168″, to get the driver automatically loaded after boot. As an alternative you can do the last step again with only one command:

echo “r8168″ >> /etc/modules

That’s it! After a reboot you should have the best possible performance with the RTL8111/RTL8168 and additionally no other network problems should be available anymore (no break down).

After the reboot you can check if the right driver is loaded with this command:

lspci -v

with this command you should find your RTL8111/RTL8168 network card in a list and the additional command “Kernel driver in use: r8168″.

  • As I already mentioned in my question, I am already using r8168. So, unfortunately, your answer is useless to me. – s3lph Jan 29 '15 at 14:09
  • @the_Seppi I have the same chipset and I did this solution a few days ago. Previously my wireless was disconnecting but now it works well. I think this did the trick: echo “blacklist r8169″ >> /etc/modprobe.d/blacklist.conf – mertyildiran Jan 29 '15 at 23:06
  • I've done exactly the same when installing r8168. And back then I also blacklisted r8169. So basically, I've already applied your answer without success. – s3lph Jan 30 '15 at 11:39
  • @the_Seppi What is your laptop brand and model? I have experienced a similar issue on my Lenovo Flex 2. – mertyildiran Jan 30 '15 at 11:45
  • HP ProBook 455 G1 – s3lph Jan 31 '15 at 1:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.