No Ethernet Connection in Ubuntu 16.04/Linux Mint 18 with Realtek RTL8111/8168/8411

After installing Linux Mint 18.3, I did some weird things and lost my Ethernet connection though WiFi was working properly. I tried reinstalling Network Manager but no luck.

After some Google search, I was able to find the solution but it was not trivial to find based on provided solutions. This article is written to help people having the same problem. Please make sure that you have the same hardware before applying the solution provided here.

Symptoms

  • The most obvious symptom: NO Ethernet connection
  • No option for Wired connection in Network Settings dialog
  • No eth0 or alternative representations in ifconfig -a
  • lshw -C network prints *-network UNCLAIMED as below:
*-network UNCLAIMED
description: Ethernet interface
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
vendor: Realtek Semiconductor Co., Ltd.
...
  • Furthermore, when I installed a new Linux Kernel, I got an error similar to this:
$ cat /var/lib/dkms/r8168/8.043.02/build/make.log
/var/lib/dkms/r8168/8.041.00/build/r8168_n.c: In function ‘rtl8168_rx_interrupt’:
/var/lib/dkms/r8168/8.041.00/build/r8168_n.c:24846:28: error: ‘struct net_device’ has no member named ‘last_rx’
dev->last_rx = jiffies;

Solution

The solution is quite simple:

1. Remove r8168-dkms driver which caused to this problem.

sudo apt purge r8168-dkms

2. Upgrade your kernel to 4.13 which contains the driver for Realtek RTL8111/8168/8411. At the time of writing this post, the Kernel version is: 4.13.0-26

Update: Jan 24th 2018

Everything was flawless until I upgraded to Linux Kernel 4.13.0-31 which broke the Ethernet connection again. This time enp3s0f1 was listed in ifconfig but the network manager was unable to connect.

After spending an hour, I found a proper fix. The problem was r8168 driver. The default driver available in Ubuntu 16.04 PPA does not support Linux Kernel 4.13. Since r8168 was not available, r8169 was used for Ethernet. You can see this by executing: ethtool -i enp3s0f1

In my system, the output was:

driver: r8169
version: 8.045.08-NAPI
firmware-version:
expansion-rom-version:
bus-info: 0000:03:00.1
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: yes
supports-priv-flags: no

Following this article, I manually installed the latest proprietary r8168 Realtek driver.

1. Install dependencies:

sudo apt-get install build-essential linux-headers-$(uname -r)

2. Download the r8168 driver.

If you run Linux Kernel 4.14 or less, download “LINUX driver for kernel up to 4.7” from here which is the official driver provided by Realtek. This driver does not compile with Linux Kernel 4.15.

Thanks to Fintecheando DevOps who maintains and shared a patched version for Linux Kernel 4.15 in the comment below. Since I am using Linux Mint 19 without any problems, I did not test his driver. Please use this driver at your own risk (There is nothing personal. I just want to remind you that the patch is not official). Clone the patch from his GitHub repository.

3. Blacklist the r8169 driver

sudo sh -c ‘echo blacklist r8169 >> /etc/modprobe.d/blacklist.conf’

4. Extract the archive, if you have downloaded the driver from the official site.

tar xfvj 0010-r8168–8.045.08.tar.bz2

5. Compile and install the driver

Driver from official website:

cd r8168–8.045.08/
sudo ./autorun.sh

Patched driver from GitHub:

cd r8168/
sudo ./autorun.sh

6. Check the driver

$ lsmod | grep r8168
r8168 520192 0

7. Check whether the driver is loaded properly

ethtool -i enp3s0f1

8. Restart the computer

References

I found these AskUbuntu questions useful but none of them ask the exact problem I had. Therefore I end up writing this post to make life easier.

Gobinath Loganathan

Written by

Software Engineer | Lecturer | Blogger: http://www.javahelps.com

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade