Guide Installation r8168-Treiber/en

Aus EUserv Wiki

Wechseln zu: Navigation, Suche

Installation of the r8168 driver for Realtek network chips

Inhaltsverzeichnis

Installation of the r8168 driver for Realtek network chips

General

The r8169 driver for Realtek network chips works not correctly even on newly installed systems.


  • Background:
    • The included driver in the Linux kernel is faulty and may cause problems on certain Realtek network cards.


  • Affected systems / hardware:
    • all servers with Realtek network chips
    • all kernel versions (Effective: 02/2014)


  • Symptoms
    • timeouts of the network connection
    • constant change of network states (Flapping between link states "up / down")
    • system crashes (rather rare)


The following log entries in /var/log/messages are symptoms for an older driver:

[    8.843743] r8169 0000:02:00.0 eth0: link down
[   10.394656] r8169 0000:02:00.0 eth0: link up
[   97.126563] r8169 0000:02:00.0 eth0: link down
[   98.681824] r8169 0000:02:00.0 eth0: link up
[  100.806543] r8169 0000:02:00.0 eth0: link down
[  102.763810] r8169 0000:02:00.0 eth0: link up 


  • Problem solving
    • deletion of the inbulit kernel driver r8169
    • installation of the official r8168 driver from Realtek


With the installation of the official r8168 driver from Realtek instead of the r8169 driver from the Linux kernel the problem can be resolved. The official driver is not included in the most distributions. Under CentOS the driver can be reinstalled from the repositories. Under Debian and Ubuntu the driver has to be compiled from the sources and activated later on.

This article describes how to setup the network driver.


Installation

Installation under Debian/Ubuntu

Installation from source

Prerequisites

Installation of the necessary packages for compiling with the following command:

aptitude install build-essential linux-headers-`uname -r` screen


Installing the driver

For installation, please follow these steps:

  • Downloading and extracting the sources:
cd /tmp
wget http://mirror.euserv.net/misc/r8168-8.038.00.tar.bz2
tar xjf r8168-8.038.00.tar.bz2
  • Check if kernel module can be compiled without errors with the command 'make modules':
cd r8168-8.038.00 && make modules
# optional: 
cd r8168-8.038.00 && make all
  • Compile the driver by running the script autorun.sh. The existing r8169 driver will be replaced:
screen
cd r8168-8.038.00
./autorun.sh

The network connectivity will be lost and the r8169 driver will be permanently deactivated. Instead, you can activate the new driver. By activating the new driver the network connection will not get lost and the driver will be just temporarily deactivated.

Activating the driver

Activate the driver, if you don't want to lose your current network connection. Please follow these steps to activate the driver:


  • Updating module dependencies:
depmod -a
  • Preventing automatical loading of the r8169 driver from the kernel:
echo "blacklist r8169" >> /etc/modprobe.d/blacklist.conf
  • Integrating the new driver in initrd:
echo "r8168" >> /etc/initramfs-tools/modules
  • Updating the initrd:
update-initramfs -v -t -u
  • Rebooting the server


The driver possibly has to be re-compiled after kernel updates in the future.


Installation under CentOS

Installation from repository

The installation under CentOS can be done from the repositories:

To install the r8168 driver from the repository, proceed as follows:

  • Integrate the necessary repository in the system by importing the public GPG key with the following command:
rpm --import http://elrepo.org/RPM-GPG-KEY-elrepo.org

For RHEL-6 or CentOS-6 the GPG key will be imported with the following command:

rpm -Uhv http://elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm
  • Installation of the package with the new kernel module:
yum --enablerepo=elrepo install kmod-r8168


The changed driver will be used after a reboot and will also be used after an update of the kernel.


Installation from source

Prerequisites

Before the installation the following prerequisites have to be given:

  • Installation of the latest kernel via yum or apt-get
  • Booting of the kernel
  • Installation of the header packages 'kernel-devel', 'kernel-headers' of the kernel and the compiler for compiling the driver:
yum install gcc gcc-c++ kernel-devel kernel-headers

Installing the driver

To install the driver proceed as follows:

  • Downloading and extracting the sources:
cd /tmp
wget http://mirror.euserv.net/misc/r8168-8.038.00.tar.bz2
tar xjf r8168-8.038.00.tar.bz2
  • Check if the kernel module can be compiled without errors with the command 'make modules':
cd r8168-8.038.00 && make modules
# optional: 
cd r8168-8.038.00 && make all
  • Compile the driver by running the script autorun.sh. The existing r8169 driver will be replaced:
screen
cd r8168-8.038.00
./autorun.sh

The network connectivity will be lost and the r8169 driver will be permanently deactivated. Instead, you can activate the new driver. By activating the new driver the network connection will not be lost and the driver will be just temporarily deactivated.


Activating the driver

Activate the driver, if you don't want to lose your current network connection. Please follow these steps to activate the driver:

  • Open the file /etc/modprobe.conf and change the responsible driver for network interface eth0 by renaming the following entry:
old: alias eth0 r8169
new: alias eth0 r8168
  • Create a shell script with the necessary commands to activate the driver (since the network connection will be lost):
  
echo "rmmod r8169" > /tmp/r8168
echo "depmod -a" >> /tmp/r8168
echo "modprobe r8168" >> /tmp/r8168
echo "service network restart" >> /tmp/r8168
echo "service ipaliases restart" >> /tmp/r8168
  • Run the created script:
sh /tmp/r8168
  • Delete the working directory after your server is reachable with the new network driver:
rm -rf /root/r8168

Installation under OpenSUSE

Installation from repository

To install the r8169 driver from the repository, please proceed as follows:

  • Add the necessary repository with zypper and install the corresponding module package:
cd /etc/zypp/repos.d
wget http://download.opensuse.org/repositories/drivers:/nic/openSUSE_Tumbleweed/drivers:nic.repo
zypper refresh
zypper install r8168-kmp-default
  • Prevent auto-loading of the r8169 driver before the reboot:
echo "blacklist r8169" >> /etc/modprobe.d/99-local.conf
  • Reboot the server.

After the reboot the driver should be permanently active.