Ethernet not working on Ubuntu - Driver r8169: link down

This is the first time that I am using Ubuntu 14.04 alongside Windows 10 on my Lenovo Z51. My Ethernet connection is not recognized in Ubuntu, but it is connected in Windows. Wireless is working fine.

chirag@chirag:~$ lspci -knn | grep Eth -A2; ifconfig
02:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 15)
Subsystem: Lenovo Device [17aa:3826]
Kernel driver in use: r8169
eth0      Link encap:Ethernet  HWaddr f0:76:1c:b9:ef:d6  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:212 errors:0 dropped:0 overruns:0 frame:0
          TX packets:212 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:19539 (19.5 KB)  TX bytes:19539 (19.5 KB)

wlan1     Link encap:Ethernet  HWaddr ac:e0:10:2e:b1:b7  
          inet addr:10.42.0.18  Bcast:10.42.0.255  Mask:255.255.255.0
          inet6 addr: fe80::aee0:10ff:fe2e:b1b7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1179 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1206 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:838341 (838.3 KB)  TX bytes:183256 (183.2 KB)

chirag@chirag:~$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

I tried adding auto eth0 and iface eth0 inet dhcp in /etc/network/interfaces using

sudo su
gedit /etc/netwwork/interfaces

but after this, it took very long to restart with a message on the startup screen:

Waiting for Network Configuration

and then:

Starting without full Network Configuration

As a result, I removed auto eth0 and iface eth0 inet dhcp from /etc/network/interfaces

After rebooting with the wireless switched off and the ethernet cable attached:

chirag@chirag:~$ dmesg | grep -e eth -e r8169
[    0.965727] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
[    0.965739] r8169 0000:02:00.0: can't disable ASPM; OS doesn't have    ASPM control
[    0.975229] r8169 0000:02:00.0 eth0: RTL8168h/8111h at     0xffffc90000cbe000, f0:76:1c:b9:ef:d6, XID 14100880 IRQ 48
[    0.975232] r8169 0000:02:00.0 eth0: jumbo features [frames: 9200     bytes, tx checksumming: ko]
[    4.311764] vga_switcheroo: detected switching method   \_SB_.PCI0.GFX0.ATPX handle
[    6.616934] r8169 0000:02:00.0 eth0: link down
[    6.616935] r8169 0000:02:00.0 eth0: link down
[    6.617017] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready

chirag@chirag:~$ ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes:   10baseT/Half 10baseT/Full 
                        100baseT/Half 100baseT/Full 
                        1000baseT/Half 1000baseT/Full 
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes:  10baseT/Half 10baseT/Full 
                        100baseT/Half 100baseT/Full 
                        1000baseT/Full 
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Speed: 10Mb/s
Duplex: Half
Port: MII
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Cannot get wake-on-lan settings: Operation not permitted
Current message level: 0x00000033 (51)
               drv probe ifdown ifup
Link detected: no

Link to my network diagnostics result:

http://paste.ubuntu.com/15960787/


Solution 1:

The driver r8169 is problematic and there are several things we might try. Let's start with the simplest first and see if we can fix it. If not, I will edit this answer to proceed to the more complex.

Please open a terminal and do:

sudo ethtool -s eth0 speed 100 duplex full autoneg off

Now check:

dmesg | grep eth0

Does the link come back up? Note that it was previously:

r8169 0000:02:00.0 eth0: link down

I notice that you are dual-booting with Windows. This is an issue with the driver r8169 in some cases. Please see: https://en.opensuse.org/SDB:Realtek_8169_driver_problem In particular:

  1. You enable "Wake-on-lan after shutdown." in the Windows device manager. This prevents the Windows driver to disable the card. With newer Windows driver versions this option is not available anymore, instead there is an option "Shutdown Wake On Lan". Changing that new option from "Enabled" to "Disabled" cannot be confirmed to fix the issue.

Please find and reverse the setting for Wake-on-LAN in Windows. Reboot into Ubuntu and check again:

dmesg | grep -e r8169 -e eth0

Any improvement?

If you have compiled the r8168 driver, I suggest you blacklist r8169:

sudo -i
echo "blacklist r8169"  >>  /etc/modprobe.d/blacklist.conf
exit

Reboot. Confirm that r8168 is loaded:

lsmod

Any improvement?