Page 1 of 4 123 ... LastLast
Results 1 to 10 of 34

Thread: RTL8111/8168B fix script for ubuntu

  1. #1
    Join Date
    Mar 2012
    Beans
    23

    RTL8111/8168B fix script for ubuntu

    Using the Network Interface Card on my motherboard the RTL8111/8168B.

    I found I had network issues dropping packets often 100% and being disconnected all the time I found that this problem has been ongoing for awhile and the kernels from 2.6 to even 3.2 load the wrong module for some reason it loads the 8169 driver module.

    I have written a script to fix it for me and for you after each upgrade. Please spread the good word

    How to tell if you are effected by this bug:

    If the command

    Code:
    lspci|grep r8168


    returns the result -

    05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)


    AND
    If the command

    Code:
    lsmod|egrep "r8168|r8169"
    ALSO returns only the the 8169 and not the r8168 kernel module.


    Below is the stable version 0.1.1 [Release Date April 1st 2012] and it is tested for upgrades and new installs on ubuntu 11.10 and 12.04 BETA.

    Instructions.

    Copy the script to a new text file
    Save the file as 81681fixer.sh
    go in a terminal to where you saved the file
    run the file with this command:

    Code:
     chmod+x 81681fixer.sh; sudo sh ./81681fixer.sh
    Code:
    #!/bin/bash
    is8168=$(lspci|grep 8168|wc -l);
    isusing8169=$(lsmod|grep 8169|wc -l);
    isroot=$(whoami|grep root|wc -l);
    isblacklisted=$(grep r1868 /etc/modprobe.d/blacklist.conf|wc -l);
    
    if [ $isroot -ne 1 ];
    then
    echo "You are not root please run 'sudo su -' or su before running this script";echo "script must be run as root";
    exit 1;
    fi
    echo "Checking that you are root user";
    if [ $is8168 -lt 1 ];
    then
    echo "Your NIC is not RealTek 8168 this fix does not apply to you";
    exit 1;
    fi
    echo "Checking that your Nic is an 8168";
    
    
    #####################################
    ##All error checks are good lets run the script
    #####################################
    sudo apt-get install --reinstall linux-headers-$(uname -r) build-essential dkms &&
    cd /usr/src/ && sudo rm -fr r8168-8.028.00.tar.bz2; sudo wget http://r8168.googlecode.com/files/r8168-8.028.00.tar.bz2; 
    sudo tar -xjf r8168-8.028.00.tar.bz2;
    cd r8168-8.028.00/;
    sudo make clean modules && sudo make install;
    if [ $isblacklisted -lt 1 ];
    then
    echo blacklist r8169 >> /etc/modprobe.d/blacklist.conf;
    fi
    sudo rmmod r8169;
    sudo depmod;
    sudo modprobe r8168;
    sudo update-initramfs -u;
    echo "fix installed successfully hopefully! :)";
    Last edited by jaybutts; April 1st, 2012 at 06:12 PM.

  2. #2
    Join Date
    Mar 2012
    Beans
    23

    Re: RTL8111/8168B fix script for ubuntu

    I will test this soon as I have to upgrade my kernel already and make any fixes plus add some things like ping tests and uninstall option. There could actually be syntax error as I haven't even run it once.

  3. #3
    Join Date
    Jun 2009
    Location
    Alabama
    Beans
    2,232

    Thumbs up Re: RTL8111/8168B fix script for ubuntu

    Great job, I hope it works!

    I also hope it will soon become moot, because my ethernet connection has been doing just fine with r8169 in the kernels used by Precise.

    Tim
    Cyberpower PC, Core i5 2500 3.3 gHz, 8GB DDR3, ATI 6770 1GB, Samsung BX 2440 LED 1080p, 1 TB SATA III, 2 TB SATA III, Siduction Linux 64-bit

  4. #4
    Join Date
    Mar 2012
    Beans
    23

    Re: RTL8111/8168B fix script for ubuntu

    Quote Originally Posted by ratcheer View Post
    Great job, I hope it works!

    I also hope it will soon become moot, because my ethernet connection has been doing just fine with r8169 in the kernels used by Precise.

    Tim
    Well that is good to hear

  5. #5
    Join Date
    Aug 2008
    Location
    @home
    Beans
    15
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: RTL8111/8168B fix script for ubuntu

    Quote Originally Posted by jaybutts View Post
    Any suggestions or modifications are welcome.

    isblacklisted=$(grep r1868 /etc/modprobe.d/blacklist|wc -l);
    This line should be:

    Code:
    isblacklisted=$(grep r1868 /etc/modprobe.d/blacklist.conf|wc -l);
    Am I right?

  6. #6
    Join Date
    Mar 2012
    Beans
    23

    Re: RTL8111/8168B fix script for ubuntu

    Quote Originally Posted by ahendriks View Post
    This line should be:

    Code:
    isblacklisted=$(grep r1868 /etc/modprobe.d/blacklist.conf|wc -l);
    Am I right?
    Yep, thank you, fixed that.

  7. #7
    Join Date
    Aug 2008
    Location
    @home
    Beans
    15
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: RTL8111/8168B fix script for ubuntu

    Okay, furthermore:

    if [ $is8168 -ne 1 ];
    then
    echo "Your NIC is not RealTek 8168 this fix does not apply to you";
    exit 1;
    fi
    if [ $isusing8169 -ne 1 ];
    then
    echo "Your nic is an 8168 but its not using 8169 driver, this fix doesn't apply to you";
    exit 1;
    fi
    You mixed up is8168 and isusing8169? You should have an 8169 card and using a 8169 to apply the fix, am I right? You check if it is a 8168(!) card and using a 8169 driver. You should have a 8169 card and a 8169 driver... ?

  8. #8
    Join Date
    Aug 2008
    Location
    @home
    Beans
    15
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: RTL8111/8168B fix script for ubuntu

    Shoudn't the blacklist be done earlier in the proces... I believe so... dunno for sure...

    Oh yeah, very, very, very good thread! Many thx if this works!
    Last edited by ahendriks; March 27th, 2012 at 10:04 PM. Reason: add thanking...

  9. #9
    Join Date
    Mar 2012
    Beans
    23

    Re: RTL8111/8168B fix script for ubuntu

    Quote Originally Posted by ahendriks View Post
    Okay, furthermore:


    You mixed up is8168 and isusing8169? You should have an 8169 card and using a 8169 to apply the fix, am I right? You check if it is a 8168(!) card and using a 8169 driver. You should have a 8169 card and a 8169 driver... ?
    Yes your right, I changed the 1's to 0's, this is how I originally had it but for some reason I changed it.

  10. #10
    Join Date
    Mar 2012
    Beans
    23

    Re: RTL8111/8168B fix script for ubuntu

    Quote Originally Posted by ahendriks View Post
    Shoudn't the blacklist be done earlier in the proces... I believe so... dunno for sure...

    Oh yeah, very, very, very good thread! Many thx if this works!
    hmm why do you think that? If we do it early then it will have blacklisted on a failed install.

Page 1 of 4 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •