Tuesday, June 26, 2012

Realtek Gigabit Ethernet Not Working with Ubuntu 11.10


New Gigabyte Motherboard Using Ubuntu 11.10 can not use Realtek Gigabyte Ethernet Correctly


Well we need to know/make sure you have the Ethernet card we are talking about.
so, type the following

lspci -nnk | grep -iA2 net

You should get something like this:

elsaghir@elsaghir-Main-Ubuntu:~$ lspci -nnk | grep -iA2 net
06:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller [10ec:8168] (rev 06)
    Subsystem: Giga-byte Technology GA-EP45-DS5 Motherboard [1458:e000]
    Kernel driver in use: r8168

So, now we need to install kernel Headers to be able to build and compile the Ethernet driver
Type:

sudo apt-get install --reinstall linux-headers-generic build-essential dkms
wget http://r8168.googlecode.com/files/r8168-8.025.00.tar.bz2
tar xvf r8168-8.025.00.tar.bz2
cd r8168-8.025.00
sudo modprobe -rf r8169
sudo ./autorun.sh
echo 'blacklist r8169' | sudo tee -a /etc/modprobe.d/blacklist.conf
sudo modprobe -v r8168
sudo depmod -a
sudo update-initramfs -u


now you need to build the driver:
Change folder to where the driver source is   cd r8168-8.026.00/
Build the Driver/Library  sudo make
We need to copy the new Library to the lib folder 
sudo cp src/r8168.ko /lib/modules/$(uname -r)/kernel/drivers/net/
Run depmod program to link all modules   sudo depmod -a
Now add the module to the kernel   sudo modprobe -v r8168 
And Update initramfs     sudo update-initramfs -u

if you have your interface in blacklist!  follow these steps:

lspci -nnk | grep -iA2 net
gksu gedit /etc/modprobe.d/blacklist.conf
# blacklist r8169



Update Dec 18, 2011:
At this point I had few update to the kernel, and I noticed every time I have a new one, I lose my network and I have to go through the build again and copy the file to the lib folder,
Of-course that make sense because every time we get a new kernel it is saved in its own folder under
/lib/modules/
so, I created a simple script that will help every time I find my network adapter not functioning correctly after a system update:

cd ~/Downloads/Drivers/r8168-8.026.00/
sudo make
sudo cp src/r8168.ko /lib/modules/$(uname -r)/kernel/drivers/net/
sudo depmod -a
sudo modprobe -v r8168
sudo update-initramfs -u

save these instructions to a file, make sure it is executable. and use it when you need to...

Let me know how these notes work for you,...





Links:
http://ubuntuforums.org/showthread.php?t=1865436

No comments:

Post a Comment