WARNING: This post is really old and it happens that it doesn’t work with newer Kernels ( >= 4.0). You should check out my new article if you want to install the driver for your RTL8111/RTL8168. You can check out the new article here: Click me (updated guide).
The most of the Realtek ethernet cards are working out of the box on a Linux machine. But some of them, for e. g. the RTL8111/RTL8168, making some troubles.
In the last three Ubuntu Versions (11.10, 11.04 and 10.10) and the latest Debian testing, you will have the problem, that the noticed ethernet card above will only work with round about 200kb/s and after a while the whole network connection will break down for more than a minute and than you will be back with your 200kb/s again.
So, this is really annoying and it’s nearly impossible to work with your machine. To solve this problem you have to use the official Realtek (r8168) driver instead of the r8169 driver, which is included in the Linux Kernel.
This tutorial will show you in a few steps, how you can build the official Realtek driver for the RTL8111/RTL8168 ethernet card for Ubuntu or Debian:
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”.
Greetings
ReCon
Thanks for this howto!
I did this and now i hope that everything is going to work well.
I use Linux Mint 11 and had some problems with WLAN. The connection wasn’t stable and broked after a random time, so i had to reconnect. Very annoying.
Keep writing solutions for Unix/Linux problems! It may help people like me!
Hi Veltrakz,
yes, I know, WLAN drivers, especially from realtek, can also be a such of pain to get them really up under Linux ….
Thanks for your feedback! – I try to write as much as I can ๐
Greetings
ReCon
it doesn’ work. on realtek page i can find drivers for kernel 2.6, while ubuntu 11.10 has kernel 3.0. i tried the procedure with latest driver, and it doesn’t work: i don’t know if i did something wrong…
Hi nidzo,
sorry for the late answear …
I’ve tested it with Kubuntu 11.10 (which is the same as Ubuntu 11.10 when you look at the base), with the driver for 2.6 Kernel and it is working without any problems.
A console output would help here, if something went wrong on your side.
Greetings
Thank you so much for sharing your pain. This really helped me too. I had no issue with RedHat 6.1 but when i went back with 5.5 my network never showed up and your step be step instructions solved my problem.
Thank you so much…
Santhosh
Very good, thks ๐
You’re welcome ๐
Well, i didn’t get it work. After restart two modules found – r8168 and r8169 which is still active. I think that old module needs to remove, something like – “sudo rmmod r8169”. And maybe – “sudo update-initramfs -u” is also needed? I’ve got Ubuntu 11.10 64bit.
@Toope: Did you blacklist the old one as listed above?
Thanks!!!!! worked for me ๐
Thanks dude… this really saved my day!
This just worked for me in Ubuntu 11.10. Thanks so much!
Worked like a charm but ethtool tells me only 100Mb/s (with r8168 loaded)
manually setting up the speed doesnยดt work neither ๐ฆ
Thank you so much! I’m a newbie to linux, and this helped a ton.
The only issue I had was with the syntax of the commands you used. For instance, instead of:
mkinitramfs -o /boot/initrd.img-`uname -r` `uname -r`
I had to use:
mkinitramfs -o /boot/initrd.img-$(uname -r) $(uname -r)
…just thought I’d mention it, in case someone else has the same issue.
—Ubuntu 11.10 3.0.0-15
Thanks again
I love u!! Marry ME!!
Hi – thank you very much for posting this. Your instructions work for me except the last step. When I run lspci -v after reboot, I get the following. Everything looks right except “Kernel driver in use: r8168” is missing
—–
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)
Subsystem: Toshiba America Info Systems Device fc30
Flags: bus master, fast devsel, latency 0, IRQ 11
I/O ports at e000 [size=256]
Memory at f0004000 (64-bit, prefetchable) [size=4K]
Memory at f0000000 (64-bit, prefetchable) [size=16K]
Capabilities:
Kernel modules: r8169
——
If I run the depmod and insmod commands again, my network connection works, but then its gone after I reboot (completely gone – there is no “Wired Connection” listed in the GUI Network Manager).
The mkinitramfs command runs without error, and I can see from the timestamp that it does touch the file.
If there is anything you can suggest I try, I’ll very much appreciate it! Thanks!
I should add that I double checked all the steps. I blacklisted r8169 in /etc/modprobe.d/blacklist.conf and I added r8168 to /etc/modules.
I would say something went wrong … easiest way for you would be to do the whole HowTo again.
Which Ubuntu version do you use?
Hi – thanks very much for replying. I provide support for my WordPress plugins, so I know that it can take a lot of time to support people who come to your site.
I am running Ubuntu 11.10
I still have the same problem. Here are all my steps, doing it a second time (I did not run make again though, because the driver works fine until I reboot, so the driver itself is good):
toppa@toppa-desu:~/Downloads/r8168-8.028.00$ sudo -s
[sudo] password for toppa:
root@toppa-desu:~/Downloads/r8168-8.028.00# tail -1 /etc/modprobe.d/blacklist.conf
blacklist r8169
root@toppa-desu:~/Downloads/r8168-8.028.00# depmod -a
root@toppa-desu:~/Downloads/r8168-8.028.00# insmod ./src/r8168.ko
[at this point the wired connection activates and it works great]
root@toppa-desu:~/Downloads/r8168-8.028.00# mkinitramfs -o /boot/initrd.img-`uname -r` `uname -r`
root@toppa-desu:~/Downloads/r8168-8.028.00# tail -1 /etc/modules
r8168
root@toppa-desu:~/Downloads/r8168-8.028.00# lspci -v
[snip]
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)
Subsystem: Toshiba America Info Systems Device fc30
Flags: bus master, fast devsel, latency 0, IRQ 51
I/O ports at e000 [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 07-00-00-00-68-4c-e0-00
Kernel driver in use: r8168
Kernel modules: r8169
[ I noticed the driver numbers don’t match on the last two lines ]
[ I reboot, and I have no wired connection available at all ]
toppa@toppa-desu:~$ lspci -v
[snip]
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)
Subsystem: Toshiba America Info Systems Device fc30
Flags: bus master, fast devsel, latency 0, IRQ 11
I/O ports at e000 [size=256]
Memory at f0004000 (64-bit, prefetchable) [size=4K]
Memory at f0000000 (64-bit, prefetchable) [size=16K]
Capabilities:
Kernel modules: r8169
To get around the problem I suppose could put the depmod and insmod commands in a startup script, but that seems silly (and the depmod command takes a while to run). If you can think of anything else I should try, please let me know – thanks again!
I am dual booting Windows 7 & Oneiric, but I have no networking in Linux because of this issue. Which means I cannot “apt-get install” anything. ๐ฆ
Could somebody please tell me what the dependencies are for build-essential in Oneiric so I can download the debs from Windows 7?
Thanks in advance,
Emanuel
Hm, let’s just say the gordian knot that is “build-essential” is not easily untangled offline. I tried installing Fedora Core 16, but it has the exact same problem with loading 8169. I could easily have solved the problem by chrooting into my Oneiric from Fedora, but, alas, ’twas not to be…
Last resort: now downloading a Precise Pangolin snapshot, fingers crossed.
Lol, I just realized my wlan interface was working in Oneiric. It was just the access point that was acting weird. Wasted two days solving a non-issue (getting Oneiric connected).
So, anyway, followed this how-to, and lo! I have wired internet up and running. Thanks for your how-to!
[…] package (via your software manager or apt), the other is mentioned and explained here, and involves blacklisting the Ubuntu r8168/r8169 driver, and replacing it with the original one […]
Legen… wait for it… dary.
If it weren’t for you I may just have (god forbid) switched back to windows.
Most useful thing I have ever read on the internet.
Hi,
I’ve been through this thing word for word five times now. Only my desperation not to go back to Windows has kept me going.
The only message or whatever I’m getting up that may or may not be of significance is after the line “mkinitramfs -o /boot/initrd.img-`uname -r` `uname -r`” where it gives me warning.
What puzzles me is that the r8169 is present on the blacklist and yet when I run “lspci -v” it’s still showing. I’m going in circles here.
I’m using Mint 12 by the way.
Well, you need the initramfs, otherwise the new kernel driver for the Realtek wouldn’t get loaded …
Some other comment here mentioned, that he had to use: mkinitramfs -o /boot/initrd.img-$(uname -r) $(uname -r)
instead the other command. Did you tried that?
Yeah, tried that and resulted in the same way. I’ve since given up and will wait for 12, hoping they’ve fixed it. Needed a working computer for now. Have tried all sorts from Ndiswrapper to varying methods upon your own that I’ve found with no luck.
I can’t remember the exact message but whenever I was doing the initramfs it warned me about compatibility, I think. My ethernet card is a slightly different model but automatically uses the r8168 driver in Windows with no problems. I tried the supposed original driver too but that didn’t work either.
It’s a LiteOn WN6302L Wireless LAN, said to just be a rebranded Realtek RTL8187SE
06: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 40
I/O ports at ee00 [size=256]
Memory at fbdff000 (64-bit, prefetchable) [size=4K]
Memory at fbdf8000 (64-bit, prefetchable) [size=16K]
Capabilities:
Kernel driver in use: r8168
Kernel modules: r8168, r8169
Why does it say ? is this bad? seems to be working really well tho ๐ love your work!
This just only means, that two drivers are available in the kernel. Are you sure, that you blacklisted the r8169?
Anyway, when it’s working for you, it’s fine.
Thanks that works with Ubuntu 11.10 ๐
I am just about to replace my home server’s boarrd with a new one that uses the RTL8111. The problem is, I also have an R8169 PCIe card that I want to use, so I need both drivers on my system.
This doesn’t bode well….
Made the switch, both the RTL8169 and the RTL8111 are working out of the box for me with no performance or disconnection issues on my system.
Running Gentoo Linux with the standard kernel drivers compiled into the kernel (not downloaded from Realtek).
Glad to her. So this issue affected before your chance on Gentoo as well?
Nope, before my change, I used two RTL8169s (one onboard, one as a PCIe card) and everything was working fine — this is, until the server began suffering kernel panics a few weeks ago. As I hadn’t changed a thing, I concluded that the hardware was breaking down.
That was my reason for the change.
sudo apt-get install linux-backports-modules-net-oneiric-generic
Solved the issue for me, r8169 driver @ ubuntu 11.10 64Bit.
No need for any recompiles or old kernels, just install and restart.
Bug is reported here: https://bugs.launchpad.net/ubuntu/+source/linux-backports-modules-3.0.0/+bug/839393
Thanks for that information!
I wasn’t able to test it yet, but if this works, this would be much easier for many people ๐
Hi ReCon,
Pre-Story:
I have installed Linux Mint 12 (3.0.0-12-generic) on my Extreamer Ultra but I’m having this problem like everyone else.
And my problem started when I installed Linux Mint, its said that it didn’t have any internet connection but the LEDs for the NIC are flashing and glowing (as it should be). But when the installation was completed I noticed that I didn’t have a internet connection.
But when I installed Ubuntu 11.10 it worked fine.
Problem 1:
I can’t even get pass step nr 2: “apt-get install build-essential”.
I get:
Err (website address)
Could not resolve ‘archive.ubuntu.com’
[This repeated around 10 times]
Fail to fetch (website address) Could not resolve ‘archive.ubuntu.com’
[This also repeated around 10 times]
E: Unable to fetch some archives, maybe run apt-get update or try with –fix-missing?
But I suppose this is because it don’t have any connection to the internet.
Problem 2:
Step 5 – Blacklist
When I run the command i get and it doesn’t matter if I run it with “sudo” or not:
bash: /etc/modprobe.d/blacklist.conf: Permission denied
Problem 3:
Step 6
I can unpack the folder and navigate into the folder but when I run the command “make clean modules” I get:
make -C src /clean
make[1]: Entering directory ‘/home/zew/r8168-8.026.00/src’
make -C /lib/modules/3.0.0-12-generic/build SUBDIRS=//home/zew/r8168-8.026.00/src clean
make: Enetering an unknown directory
make: *** /lib/modules/3.0.0-12-generic/build: No such file or directory. Stop.
make: Leaving an unknown directory
make[1]: *** [clean] Error 2
make[1]: Leaning directory ‘/home/zew/r8168-8.026.00/src’
make: ***[clean] Error 2
Any idรฉs?
Br
Zew
Are you sure that your network connection is running fine. For me it looks like, that your network connection has some problems, because there is no connection to the update servers possible.
Can you ping google.de? Can you ping 8.8.8.8?
Do you really have read my tutorial? I mentioned, that you should use “sudo su” to get complete root privileges for the whole proccess. If you do so, the “permission denied” error will not come back anymore.
Without build-essential, it is absolutely normal that this happens.
Thank you!
For some reason it works with driver: r8169.
Br Zowie
Excellent! thanks for this my new desktop computer would not be usable without this!
Just out of curiosity I notic kernel updates wipe this out, and I have to compile and reinsert into the kernel each time, the blacklist, and everything else it there. Is there by chance a way to include it with the rest of thed rivers in the system so it can be injected at the time of kernel update?
I’m running Ubunto 11.10
When I try to run “mkinitramfs -o /boot/initrd.img-`uname -r` `uname -r`” I get a “No such file or directory”.
I ran echo โr8168โณ >> /etc/modules, and it seemed to work. I manually opened the file in a text editor and confirmed that R8168 was supposed to load. But I’m still not getting the new drivers up.
I’ve manually confirmed that R6189 is black listed.
I just tried mkinitramfs -o /boot/initrd.img-$(uname -r) $(uname -r).
No error in the terminal window. but I’m still getting “Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)” when I run “lspci”, and my connection is as buggy as ever.
R8619 is definetly on the blacklist for the system.
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!
Sounds good! This autorun script wasn’t available at the time I’ve written the tutorial.
Are you sure, that the user does not need to install any other software anymore? For e. g. build-essential?
Hi,
autorun.sh does not work like panacea for this problem.
(RTL8111/8168B, rev. 02)
With debian wheezy, 3.2.0-4-686-pae and r8168-8.039.00: no luck. I am offline.
autorun.sh output:
Check old driver and unload it
rmmod r8169
Build the module and install
make: *** /lib/modules/3.2.0-4-686-pae/build: Folder or file does not exist [translated]. Stop.
make[1]: *** [clean] Error 2
make: *** [clean] Error 2
Manual creation of the /build folder does not help to solve this.
Does anybody here have an idea what to try next?
[…] kernel module for the Realtek NIC onboard the Giga-byte motherboard. The following links apply: https://unixblogger.wordpress.com/201…ethernet-card/ http://forums.linuxmint.com/viewtopic.php?f=150&t=97619 Hopefully of use to some who have […]
Everything went fine, but it still didn’t solve my problem, that my WLAN is not on the list of avaible WLANs. Some others secured with passwords are listed, but my home WiFi is not. On Windows it works fine, but in Ubuntu 11 after changing driver to r8168 not. What is wrong?
Ok, forget. I found a solution – another channel
Hello Ich habe eine probleme!
when I put this : insmod ./src/r8168.ko
It says file already exists
and the connection still slow
PLEASE help!!
thanks a lot.
Using Linux mint 12 here. I salute you sir. Thanks for saving me a shit load of time!
Great Thanx for this !
I had the problem obn a dual boot system (ubuntu 11.10/win7) that after booting win7 the network under ubuntu was dead ! i had to plug off the !power cable! and reconnect it to get network under linux work again.
after switching the driver to the 8168 evrything works fine !
done under ubuntu 11.10 3.0.0-14-generic #23-Ubuntu SMP Mon Nov 21 20:28:43 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
I have a problem when i do the step where it says tar xfvj the packet. I downloaded it and everything and i put in the right name but when i do the step it says error no such directory and such of that
Then you aren’t in the right directory, where the downloaded file is stored! You have to use the command “cd” in the terminal to navigate to the destination, where the downloaded file is stored.
Most of these solutions are fine for systems with a single ethx. I have an onboard and a nic. The onboards needs the r8169 and the nic needs the 8168. what to do? This is a server BTW and the onboard is WAN, the nic LAN. netools sees it, and it passes a few packets, but no ip number and status shows link=no
Well, than you can just try to not blacklist the r8169. Normally this should go fine!
So, install the 8168, as mentioned in the Tutorial above and leave the “blacklisting” part out so that both are getting loaded while your system is booting.
After running ./autorun.sh everything seemed fine. Net connection finally worked. No dropped RX packets. BUT after reboot, the system freezes completely with black screen. Last /var/log/message is:
r8186: eth0: link up
Are you useing NetworkManager or the regular ifup method? Are you sure, that the complete system freezes? What’s happening when your pressing STRG+ALT+F2 / +F3 and so on? Did your system switches between the virtual consoles?
There is no keyboard response, so no way to switch to another console. Only single underscore is sometimes displayed in the upper left corner of the screen. So the system is most definitely frozen.
Is there any way to revert back to r8169 driver now, or at least temporarily disable the r8168 which seems to be the culprit? Simply blacklisting it did not do the trick.
So then you can try to load up your Ubuntu (or other distro) in the Rescue mode (GRUB Menu). Normally this should work then and you will be able to delete the installed driver.
danke schon. du bist sehr gut. just the answer i needed.
Thank you! This worked with Kubuntu 12.04 LTS. The “unplugged cable” is finally gone!
Gracias, Thanks you, merci, dank, grazie, ัะฟะฐัะธะฑะพ, ่ฌ่ฌ…works perfect!!!! “There goes my hero” said Foo Fighters! LOL! Thanks once more!!!
[…] manufacturers that do care, the exceptions are notable – Intel GMA, Nvidia, Atheros, among others. Realtek is extremely popular ethernet chips on OEM boards, and while they do have drivers, they're not […]
Hi, im currently running Ubuntu 12.04 LTS Precise. Iโd gone many process even on your instruction given and others. but still my r8168 could not be detected. when i run the command
lsmod | grep r81
it will displayed this
r8168 244911 0
and when i run
lspci | grep Eth
only my build-in ethernet would displayed
00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04)
and this my version
Linux mpv4 3.2.0-30-generic #48-Ubuntu SMP Fri Aug 24 16:52:48 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Someone please help me..sorry for my bad english
[…] by Sauerland Wo steht das? z.B. an all diesen Stellen: https://bugs.launchpad.net/bugs/839393 The pain of an Realtek (RTL8111/RTL8168) ethernet card How to fix RTL8111/8168B ethernet connectivity issues in Linux – dividebyzero Perte connexion […]
This seems to work right up until I get prompted to log in. Running on Precise amd64 server.
The link light comes on when Ubuntu starts running, but as soon as I get to the login prompt it’s gone, and ethtool says “Link detected: no”
Please, any ideas?
Really helpful post, thanks.
I used r8168-8.034.00.tar.bz2 downloaded from http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PNid=13&PFid=5&Level=5&Conn=4&DownTypeID=3&GetDown=false
With this version of the Realtek software you can replace all your steps 5 6 7 and 8 with just ./autorun.sh
If this fails it may be because you don’t have the kernel headers. Install these on Debian 6.0.5 with:
apt-get install linux-headers-2.6.32-5-686
(On other flavours and versions do what’s necessary.)
Peter Talbot, London UK
This worked for me perfectly. But every time I install some updates it stops working again. Is there a way to hard code these changes? I am using 12.0LTS.
Thanks
Very thanks for this useful post.
I was surfing the web searching for rtl8111 datasheet, so I discovered the Issue you have reported.
Some comments report that this Issue exists also on Ubuntu 12.04 that is the platform I use for my LAN server… very thanks guys!!!!
Wow, vielen Dank !!! Wollte schon nach einer anderen Netzwerkkarte schauenโฆ
Thank you so much
[…] driver, but the built-in r8168 chip running under r8169 driver included in the kernel performs way worse than […]
[…] I would follow this posrtion. There should be a file for Linux. https://unixblogger.wordpress.com/201…ethernet-card/ […]
Didn’t solve my problem under 12.10. The r8168 is loaded and everything went well beside the problem is still there. No connection with my RTL8111 Card. ๐ฆ Any other ideas?
I can’t express how happy I’m when this worked for me.
Thanks a lot. With this, I also installed my first kernel module. ๐
[…] connect to the internet, and the r8169 was back in the kernel. I had found the instructions here – https://unixblogger.wordpress.com/201…ethernet-card/ – helpful, although that was written for the 11.10 version. Also even though the system was […]
Worked perfectly on Ubuntu 12.10 ๐
Thanks!
Worked, thank you so much! ๐
Hi,
I have r8168 Realltek card used with default r8169 driver. The problem is that I had pain to get a DHCP response (must wait a long time, invoking dhclient, which can simply nevers has an offer)
Tried to install the r8168, but things getting worse … never get an offer …
I think i’ve managed to go back (by rmmod r8168, blacklisting the r8168, and explicitely load the r8169, and redo a “depmod -a” and a “mkinitramfs ….”).
Not sure to have done everything well to go back …
For instance, is there, somewhere, some backups of initramfs ? Or does the mkinitramfs simply overwrite the former boot image ?
Finaly, is there a chance that this dhcp problem comes from the fact that ipv6 is disabled on my router ?
Tried to configure the networkmanager to use the same static IP (v4) or not, ignore (or not) ipv6 (but it still try to assign an ipv6 anyway …) …
Some more infos :
– ubuntu 11.04
– worked fine no so long time ago (when I installed ubuntu), and now, at each reboot, I have (real) pain to get connected
– close/reopen session, when previously connected, get reconnected directly …
Hi, I went through all of the steps but when I got to the one where it said to enter: insmod ./src/r8168.ko
In the terminal, I got the following error.
root@jose-HP-HDX16-Notebook-PC:~/Downloads/r8168-8.035.00# insmod ./src/r8168.ko
Error: could not load module ./src/r8168.ko: No such file or directory
What did I do wrong? It’s still using the r8169 kernel. Thank you in advance!
First, sorry for the late response.
Well, what does
ls -l ./src/
says?
I get some erros in “make clean modules” step using Ubutun 13.04 with kernel 3.8.0.
The bugtracker is here: https://bugs.launchpad.net/ubuntu/+source/r8168/+bug/1108068 , and the solution is simple:
sudo apt-get update
sudo apt-get install r8168-dkms
Hello, Thankyou for posting these steps but I’m having issues during the “make clean modules” step
—
lewis@Jehuty-OSURR:~/Documents/r8168-8.035.00$ sudo make clean modules
make -C src/ clean
make[1]: Entering directory `/home/lewis/Documents/r8168-8.035.00/src’
make -C /lib/modules/3.8.0-19-generic/build SUBDIRS=/home/lewis/Documents/r8168-8.035.00/src clean
make[2]: Entering directory `/usr/src/linux-headers-3.8.0-19-generic’
CLEAN /home/lewis/Documents/r8168-8.035.00/src/.tmp_versions
make[2]: Leaving directory `/usr/src/linux-headers-3.8.0-19-generic’
make[1]: Leaving directory `/home/lewis/Documents/r8168-8.035.00/src’
make -C src/ modules
make[1]: Entering directory `/home/lewis/Documents/r8168-8.035.00/src’
make -C /lib/modules/3.8.0-19-generic/build SUBDIRS=/home/lewis/Documents/r8168-8.035.00/src modules
make[2]: Entering directory `/usr/src/linux-headers-3.8.0-19-generic’
CC [M] /home/lewis/Documents/r8168-8.035.00/src/r8168_n.o
/home/lewis/Documents/r8168-8.035.00/src/r8168_n.c:14545:1: error: expected โ=โ, โ,โ, โ;โ, โasmโ or โ__attribute__โ before โrtl8168_init_boardโ
/home/lewis/Documents/r8168-8.035.00/src/r8168_n.c:14715:1: error: expected โ=โ, โ,โ, โ;โ, โasmโ or โ__attribute__โ before โrtl8168_init_sequenceโ
/home/lewis/Documents/r8168-8.035.00/src/r8168_n.c:14968:1: error: expected โ=โ, โ,โ, โ;โ, โasmโ or โ__attribute__โ before โrtl8168_init_oneโ
/home/lewis/Documents/r8168-8.035.00/src/r8168_n.c:15132:1: error: expected โ=โ, โ,โ, โ;โ, โasmโ or โ__attribute__โ before โrtl8168_remove_oneโ
/home/lewis/Documents/r8168-8.035.00/src/r8168_n.c:17651:12: error: โrtl8168_init_oneโ undeclared here (not in a function)
/home/lewis/Documents/r8168-8.035.00/src/r8168_n.c:17652:2: error: implicit declaration of function โ__devexit_pโ [-Werror=implicit-function-declaration]
/home/lewis/Documents/r8168-8.035.00/src/r8168_n.c:17652:25: error: โrtl8168_remove_oneโ undeclared here (not in a function)
/home/lewis/Documents/r8168-8.035.00/src/r8168_n.c:17301:12: warning: โrtl8168_pollโ defined but not used [-Wunused-function]
/home/lewis/Documents/r8168-8.035.00/src/r8168_n.c:1368:1: warning: โrtl8168_xmii_reset_pendingโ defined but not used [-Wunused-function]
/home/lewis/Documents/r8168-8.035.00/src/r8168_n.c:1383:1: warning: โrtl8168_xmii_link_okโ defined but not used [-Wunused-function]
/home/lewis/Documents/r8168-8.035.00/src/r8168_n.c:1395:1: warning: โrtl8168_xmii_reset_enableโ defined but not used [-Wunused-function]
/home/lewis/Documents/r8168-8.035.00/src/r8168_n.c:1544:1: warning: โrtl8168_link_optionโ defined but not used [-Wunused-function]
/home/lewis/Documents/r8168-8.035.00/src/r8168_n.c:1823:1: warning: โrtl8168_set_speed_xmiiโ defined but not used [-Wunused-function]
/home/lewis/Documents/r8168-8.035.00/src/r8168_n.c:2151:13: warning: โrtl8168_gset_xmiiโ defined but not used [-Wunused-function]
/home/lewis/Documents/r8168-8.035.00/src/r8168_n.c:2886:13: warning: โrtl8168_get_mac_versionโ defined but not used [-Wunused-function]
/home/lewis/Documents/r8168-8.035.00/src/r8168_n.c:3002:1: warning: โrtl8168_print_mac_versionโ defined but not used [-Wunused-function]
/home/lewis/Documents/r8168-8.035.00/src/r8168_n.c:3044:1: warning: โrtl8168_hw_phy_configโ defined but not used [-Wunused-function]
/home/lewis/Documents/r8168-8.035.00/src/r8168_n.c:13681:1: warning: โrtl8168_release_boardโ defined but not used [-Wunused-function]
/home/lewis/Documents/r8168-8.035.00/src/r8168_n.c:14914:17: warning: โrtl8168_try_msiโ defined but not used [-Wunused-function]
cc1: some warnings being treated as errors
make[3]: *** [/home/lewis/Documents/r8168-8.035.00/src/r8168_n.o] Error 1
make[2]: *** [_module_/home/lewis/Documents/r8168-8.035.00/src] Error 2
make[2]: Leaving directory `/usr/src/linux-headers-3.8.0-19-generic’
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/home/lewis/Documents/r8168-8.035.00/src’
make: *** [modules] Error 2
—
Why am I getting these errors? I assume they are significant, because I tried to follow the later steps afterwards but they wouldn’t work for various reasons (including r8168.ko not existing).
Any idea what I’ve done wrong?
[…] https://unixblogger.wordpress.com/2011/10/18/the-pain-of-an-realtek-rtl8111rtl8168-ethernet-card/ […]
Followed your instructions to the letter today and it works like a charm…. so everything still up to date. Thank’s a lot….
Hi …
Thanks for this awesome post to an annoying problem. Everything was going fine till:
8. Make it available for boot
mkinitramfs -o /boot/initrd.img-‘uname -r’ ‘uname -r’
My system kept giving me FATAL errors stating that there is no such file as ‘uname’.
I wasn’t shure if thes step absolutely had to be done so I went on to:
echo “r8168” >> /etc/modules
That seemed to go OK … however, after the reboot on using ‘lspci -v’ the kernal driver was STILL r8169!
Please … how do I get this installed. Please be gentle I’m a GUI guy.
– Thanks.
Hi again …
I did it again restarting at the “make clean modules” step and making sure that I used the โsudo -sโ permissions this time. It sure looks like it worked just fine this time. I did get a “can’t read private key” error on the “make install” step but it doesn’t seem to matter. After I rebooted “lspci -v” reveals that I have both the r8168 and r8169 modules and the system’s using the r8168 driver. I’ll see if this corrects my wired network from randomly dropping. So far it’s been good so I’ll keep my fingers crossed.
Thanks again for the solution to a very annoying issue.
http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PNid=13&PFid=5&Level=5&Conn=4&DownTypeID=3&GetDown=false#2
get the driver software file from realtek. ( with oracle enterpise linux Release 5 update 4, default nic card driver did not work)
web link
http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PNid=13&PFid=5&Level=5&Conn=4&DownTypeID=3&GetDown=false#2
follow readme file
Unpack the tarball :
# tar vjxf r8168-8.037.00.tar.bz2
Change to the directory:
# cd r8168-8.037.00
If you are running the target kernel, then you should be able to do : (as root or with sudo)
# ./autorun.sh
You can check whether the driver is loaded by using following commands.
# lsmod | grep r8168
# ifconfig -a
It works like magic for me. wasted at least 48 hours to figure out this realtek hardware mess.
It help me to install R8181e-r8103E drivers Ubuntu 12.04 LTS Precise
Pardon me – it iwas r8101E-r8102E Ubuntu 12.04 LTS (precise)
make -C src/ install
make[1]: Entering directory `/home/ivan/Downloads/r8168-8.037.00/src’
make -C /lib/modules/3.8.0-32-generic/build SUBDIRS=/home/ivan/Downloads/r8168-8.037.00/src INSTALL_MOD_DIR=kernel/drivers/net/ethernet/realtek modules_install
make[2]: Entering directory `/usr/src/linux-headers-3.8.0-32-generic’
INSTALL /home/ivan/Downloads/r8168-8.037.00/src/r8168.ko
Can’t read private key
DEPMOD 3.8.0-32-generic
make[2]: Leaving directory `/usr/src/linux-headers-3.8.0-32-generic’
make[1]: Leaving directory `/home/ivan/Downloads/r8168-8.037.00/src’
root@FireflyPC:~/Downloads/r8168-8.037.00# ^C
root@FireflyPC:~/Downloads/r8168-8.037.00#
Got this promlem
Hey Unixblogger,
Thanks for your detailed explanation!
But still I didn’t manage to get wifi…
I blacklisted the 8169 (3times actually, as I saw in the gedit file)
I do see the 8168 driver in my extra programs (don’t know the english version)
It says the Realtek RTL 8168 Gigabit Eternet driver is in use.
But when typing in terminal: sudo lspci -v
the outcome is: kernel driver in use: 8169
kernel modules: 8168, 8169
Why won’t it work? I’m trying to make this work for days in a row…
Thanks in advance for your help!
[…] for others but not for me. I installed the newest r8168 driver (8.037.00) manually based on this: The pain of an Realtek (RTL8111/RTL8168) ethernet card and also run the autorun.sh […]
I’m a novice user, but found your solution and managed to implement it. (I got what looked like a few error messages along the way, but it still worked). This was the end of about 8 hours of frustration – mostly thinking “surely this should work out of the box”!
Many thanks for your original, very clear solution.
John
Thanks a lot for this howto!
I was having problems with my NIC (RTL8111/8168 PCI Express Gigabit Ethernet controller (rev 09)) not being able to reach gigabit speeds (although it was connected at 1000 Mb/s according to ethtool).
After installing the driver it sends data at a steady rate at 118 MB/s.
Thank you!!! This have been frustrating me for weeks!
I was having some connection stability issues with the r8169 driver in Mint 17 (kernel 3.13.0-24). After trying the latest driver from Realtek, problem solved. It’s worth noting that the entire process of compiling and installation has been automated with a script in the most recent release.
Worked file with Debian 3.2.0-4. Mine was a minimalist install, so had to also install a build environment:
sudo apt-get install build-essentials
sudo apt-get install linux-headers-`uname -r`
Thanks
Exactly my problem, perfect fix, thank you!
Thank you very much!!!!
That works for me too.
You solved my problem causing me a big headache!!! ๐
Tony
You’re welcome ๐
thank you very much indeed. just tried the instructions as described above (September 2014) wuth the latest realtek 8168 driver from their website. ๐
[…] drivers especรญficos para dichas tarjetas y nunca he conseguido poner a funcionar como dios manda el driver “fallback” r8168. Steam OS promete instalar un montรณn de drivers propietarios por defecto. Veremos quรฉ tal […]
when i type this command “mkinitramfs -o /boot/initrd.img-`uname -r` `uname -r`” i get this messages http://dpaste.com/19WCJ9P thereinto i have (RTL8101E/RTL8102E).
[…] The pain of an Realtek (RTL8111/RTL8168) ethernet card … โ 02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06) … Running Gentoo Linux with the standard kernel drivers compiled into the kernel (not downloaded from Realtek). Antwort. unixblogger sagt: 22/03/2012 um 07:36. […]
My mate bought a Gigabyte 970A-DS3P motherboard and installed Xubuntu on it only to find that the ethernet did not work. This post fixed everything! Thanks a bunch kind internet stranger.
The latest incarnation of the NIC appears to be the RTL8111G (which appears in the Shuttle XH81V and DS47 machines). According to Realtek’s rather basic support/download site, lunux driver v8.039.00 supports the 8111G. Well, perhaps. The driver certainly gets the NICs going. But performance and reliability are another matter entirely. Forget Gigabit speeds – the 8111G can’t even deliver sustained throughput at 100mbps link speeds. It seems that the NIC frequently slows down or gives a flaky connection. Something’s very wrong. I plugged a generic ยฃ5 USB NIC into the XH81V, and its performance is far better than the onboard 8111G. That’s rather sad.
It looks like the same old Realtek story – pain, pain, pain wth every new product.
True words. For now, it’s better (and of course easier) to just use a NIC which is “Plug ‘n Play” compatible with Linux.
Hi, thanks for your post. When I try to do make install, I get the following output:
make -C src/ install
make[1]: Entering directory `/home/sher/Downloads/r8168-8.039.00/src’
make -C /lib/modules/3.13.0-51-generic/build SUBDIRS=/home/sher/Downloads/r8168-8.039.00/src INSTALL_MOD_DIR=kernel/drivers/net/ethernet/realtek modules_install
make[2]: Entering directory `/usr/src/linux-headers-3.13.0-51-generic’
INSTALL /home/sher/Downloads/r8168-8.039.00/src/r8168.ko
Can’t read private key
DEPMOD 3.13.0-51-generic
make[2]: Leaving directory `/usr/src/linux-headers-3.13.0-51-generic’
make[1]: Leaving directory `/home/sher/Downloads/r8168-8.039.00/src’
Can you please help me with resolving this?
[…] 3.https://unixblogger.wordpress.com/2011/10/18/the-pain-of-an-realtek-rtl8111rtl8168-ethernet-card/ […]
[…] https://unixblogger.wordpress.com/2011/10/18/the-pain-of-an-realtek-rtl8111rtl8168-ethernet-card/ […]
output after
mkinitramfs -o /boot/initrd.img-`uname -r` `uname -r`
libkmod: ERROR ../libkmod/libkmod-config.c:686 kmod_config_parse: /etc/modprobe.d/blacklist.conf line 56: ignoring bad line starting with ‘โblacklist’
libkmod: ERROR ../libkmod/libkmod-config.c:686 kmod_config_parse: /etc/modprobe.d/blacklist.conf line 57: ignoring bad line starting with ‘โblacklist’
Ubuntu 14.04.2 LTS please help
[…] 3.https://unixblogger.wordpress.com/2011/10/18/the-pain-of-an-realtek-rtl8111rtl8168-ethernet-card/ […]
Hi, thanks for your detailed tutorial!
However I can’t find an ‘uninstall’ section in the Makefile
How can I uninstall this driver?
Regards,
[…] EDIT: After some additional googling, I discovered that Realtek 8168 is known for having problems with Linux: http://www.twm-kd.com/linux/realtek-rtl81688111e-and-ubuntu-linux/ https://unixblogger.wordpress.com/2011/10/18/the-pain-of-an-realtek-rtl8111rtl8168-ethernet-card/ […]
[…] https://unixblogger.wordpress.com/2011/10/18/the-pain-of-an-realtek-rtl8111rtl8168-ethernet-card/ […]
[…] Realtek but it doesn’t work. You have to make and make install their latest Ethernet driver. The installation steps. I have to make/make install after every Ubuntu update right now, this is […]
Hi
I have got ubuntu 14.04 with kernel version 3.16.0-57-generic. I have got RTL8111/8168/8411 PCI. The problem is I can not see any wifi network. I have followed all steps avobe and can see Kernel driver in use: r8168. But can’t see any wifi networks. Please help
Laptop model: lenovo thinkpad edge e545(northAmerica)
Debian image : debian-8.2.0-amd64-netinst.iso –
to make bootable usb: ‘LinuxLive USB Creator’
REALTEK DRIVERS
#missing firmware (loaded onto second usb and inserted with both files on usb root when prompted during instalation)
rtl_nic/rtl8168e-3.fw {http://http.debian.net/debian/pool/non-free/f/firmware-nonfree/firmware-nonfree_0.43~bpo70+1.tar.gz
rtlwifi/rtl8188efw.bin {http://http.debian.net/debian/pool/non-free/f/firmware-nonfree/firmware-nonfree_0.43~bpo70+1.tar.gz
seems to have worked, my only issue so far has been the ethernet/wifi drivers
hopefully it helps, i could find much for this specific model, it only took me about 4-5 hours to figure out
but maybe this will cut that down for you
cheers o/
Hi thanks for your tutorial and it really helps me solving most of my problem. I had a Linux workstation with realtek R8168 and was loading r8169 module. I followed your advice and it start working now. However when I was trying to SSH from my laptop to the Linux workstation I still found the connection very slow and may hangup for 1 or 2 minutes. Then I set up a SubVersion server on the Linux workstation and was trying to do a svn checkout of my laptop I found connect even failed. Can you please give more advice? Thanks in advance.
I don’t have internet so I can install build-essential. How can I do that?
Sorry for the late response …
The easiest way would be to use a USB Ethernet card which is Linux compatible. There are a lot out in the wild which costs round about 5-10โฌ (or Dollars).
The way more complicate and unusual option is to download every single package which is needed by the build-essential package and all packages which depend on the dependencies for build-essential … you could say something like a never ending story.
So my adwise: Just get that cheap USB NIC for a temporary way of downloading and installing all needed packages.
Look here for new driver https://sourceforge.net/projects/network-card-driver/?source=navbar and download from git.
To anyone still grappling with this issue. Note if you manage to get r8168 kernel module to load and you can see the interface in ifconfig -a but still cannot get to the router/internet, you need to ensure that the file /etc/network/interfaces has eth1 instead of eth0 in it.
If I had checked it earlier I would have saved an hour or so wondering what i did wrong with the module installation…
Reminder: eth1 not eth0.
Facing the same problem , where can I get drivers for ubuntu 16.04 , which in linux kernel 4.4 , its not available on the link you gave.
Yeah, that’s right, Realtek is actually not offering drivers for Kernels 4.x and higher.
So there are just 3 possibilities right now:
1) You can wait until Realtek makes the driver Kernel 4.x ready.
2) You install and older 3.x Kernel and then go for the driver installations as described in this tutorial.
3) Someone posted in a earlier comment this driver: https://sourceforge.net/projects/network-card-driver/?source=navbar
You could download and compile this driver instead of the one from the Realtek homepage.
If you want to go with 3) and you have success doing compiling and installing, let me know so that I will be able to rewrite this tutorial.
make-C /lib/modules/4.4.0-31-generic/build M=/home/adnan/Desktop/hello modules_install
make: make-C: Command not found
Makefile:32: recipe for target ‘install’ failed
make: *** [install] Error 127
Did you ensure that the build-essentials are installed?
sudo apt-get install build-essential
Yes, it is installed. I am using Ubuntu 16.04
adnan@adnan-Aspire-E5-573G:~$ sudo apt-get install build-essential
[sudo] password for adnan:
Reading package lists… Done
Building dependency tree
Reading state information… Done
build-essential is already the newest version (12.1ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 65 not upgraded
Somebody state, that you can install the package r8168-dkms on your system. The package is available in Ubuntu 16.04. Does this installs the needed driver? And does the driver work reliable?
In Ubuntu 16.04, you can directly install the RTL-8168 driver by the command “apt-get install r8168-dkms”. In fact, this command is also available in all currently maintained Ubuntu versions.
Thanks for that hint. Does the driver installed by that way, work reliable?
[…] lot of people will remember my guide how to get a RTL8111/RTL8168 running under your Linux box. This guide is almost 5 years old now and I wanted to make a complete […]
I’ve created ubuntu-14.04 image and restoring on disk and Motherboard model is GIGABYTE GA-H61M-WW with :
Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06)
Now issue is that, As ubuntu boots up, the link light will go off Ubuntu reports cable is disconnected and ethtool result :
Link Detection: no
For this, too many help over the internet and following many forums but not getting solution yet !
Main issue : After attached ubuntu disk, I’ve re-attached windows 7 disk which was already worked Ethernet card but Now showing Ethernet unplugged !!!
So that reinstall drivers and boot with Linux Live OS but Ethernet not working…, I performed same on two same model PC’s and facing same network card issues !, So I don’t want to performed on another PCs.
My question is that, In built Ethernet is physically failed by Ubuntu on both machine ? How can first solve this issue in windows 7 ? and after Ubuntu ?
Sorry for my late response.
I’m sorry but it’s a little bit hard to understand your question(s). I try to answer it / them as good as possible:
First of all, you should check your BIOS settings. Eventually there are some settings which come across your ethernet. You could also restore your BIOS default settings for testing purposes here.
For Linux: Did you installed and used the official Realtek driver? How did you install the official driver? With apt-get or downloaded the driver by your own and installed it? What does lspci -v say?
For Windows: Well, try to reinstall the driver once more. Make sure you have the driver uninstalled before doing that (uninstall, reboot, reinstall, reboot, …).
Did you also tried another ethernet cable and another ethernet port within your switch / router? Your problem could also be hardware related …
The DKMS module might be outdated for newer kernels. In Mint 18 it was horribly outdated, but (somewhat) newer builds can be found here:
wget http://de.archive.ubuntu.com/ubuntu/pool/universe/r/r8168/
copy and paste fail. There shouldn’t have been a wget for that, since it’s useless without the file name.
Thanks, worked fine for me.
[…] apt-get purge r8168-dkms from Ubuntu 14.04 wired connection keep disconnecting 7) Everything on https://unixblogger.com/2011/10/18/the-pain-of-an-realtek-rtl8111rtl8168-ethernet-card/ 8) Install older version of r8168, […]