2

After updating the CentOS 7.7 kernel from 3.10.0-957.27.2 to 3.10.0-1062.9.1, the Ethernet stopped working. The LEDs on the Ethernet port wouldn't light up and any attempt to ping anything resulted in a "host not reachable".

Everything looked ok with the files in /etc/sysconfig/network-scripts, and the output in /var/log/messages seemed to indicate that the interface was coming up correctly. Finally I booted the older 3.10.0-957.27.2 kernel and the Ethernet port immediately began working again.

When I run lspci -nnk it lists the Ethernet controller as:

07:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 03)
    Subsystem: Realtek Semiconductor Co., Ltd. RTL8111/8168 PCI Express Gigabit Ethernet controller [10ec:8168]
    Kernel driver in use: r8169
    Kernel modules: r8169

The output from lspci is identical under both kernels, including the "r8169" driver in use.

It looks like the Realtek drivers are included with the kernel because I see a lot of Realtek files under directories like:

/usr/lib/modules/3.10.0-1062.9.1.el7.x86_64/kernel/drivers/net/ethernet/realtek

But I see that although the Realtek driver filenames are the same, the sizes and dates have been updated for the newer kernel.

What's the best way to get the Ethernet controller working with the latest kernel?

3
  • What does ip link show outputs on the new kernel?
    – VL-80
    Jan 26, 2020 at 14:57
  • 1
    Possible regression. bugs.centos.org/view.php?id=16413
    – Kate
    Jan 26, 2020 at 16:36
  • This also happens with the 5.6 mainline branch as well. I can confirm the 4.4 long term branch is unaffected as of kernel-lt-4.4.224-1 May 29, 2020 at 10:08

3 Answers 3

3

I found an easy solution thanks to Anonymous who commented above with a link to a CentOS bug report. Apparently this is a known issue in the 1062 kernel and the driver is somehow not being loaded in the right order.

A quick fix to immediately activate the Ethernet port is to unload the r8169 driver and then reload it, but this doesn't survive a reboot:

# rmmod r8169
# modprobe r8169

You can skip that entirely though and fix the whole problem with one line that loads the Realtek module at the correct time using a config file. I can confirm that this does survive multiple reboots:

# echo realtek > /etc/modules-load.d/realtek.conf
(then reboot)

One thing that's curious is that when I booted from the old 957 kernel and did an lsmod I found that the realtek module wasn't being loaded then either, even though the Ethernet port worked fine. And the r8169 module was being loaded by both the old 957 kernel and the new 1062 kernel. But anyway, something's not being loaded in the right order by the 1062 kernel and this fixes it, so I'm all good now. Thanks again to Anonymous!

2
  • I was looking for a solution since hours. Thanks for posting this.
    – cekar
    Jan 16, 2021 at 3:28
  • On CentOS Linux release 7.9.2009 (Core) using kernel-ml-5.11.0-1.el7.elrepo.x86_64 your rmmod, modprobe commands worked, but the realtek.conf file didn't. To survive reboots I had to use the load-realtek-driver.service solution.
    – Jim
    Feb 17, 2021 at 2:14
2

The only solution that I came across is this:

cat <<EOF| sudo tee /etc/systemd/system/load-realtek-driver.service
[Unit]
Description=Load Realtek drivers.
Before=network-online.target
    
[Service]
Type=simple
ExecStartPre=/usr/sbin/rmmod r8169
ExecStart=/usr/sbin/modprobe r8169
  
[Install]
WantedBy=multi-user.target
EOF
    
sudo systemctl enable load-realtek-driver.service

Or your an also just open up the service file like this using Nano or any other text editor:

sudo nano /etc/systemd/system/load-realtek-driver.service

And then adding this to that file:

[Unit]
Description=Load Realtek drivers.
Before=network-online.target

[Service]
Type=simple
ExecStartPre=/usr/sbin/rmmod r8169
ExecStart=/usr/sbin/modprobe r8169

[Install]
WantedBy=multi-user.target

Then start the service like this:

sudo systemctl start load-realtek-driver.service

And enable it so it can start on reboot like this:

sudo systemctl enable load-realtek-driver.service

Hope that helps someone!

7
  • That cat <<EOF| sudo tee is kinda crazy. Just open up /etc/systemd/system/load-realtek-driver.service with a text editor and then add that text afterwards and up to EOF to it. Dec 16, 2020 at 16:47
  • It does the job at once, instead of step by step!
    – iceman
    Dec 16, 2020 at 17:26
  • Many systems don’t have tee installed. Opening up an editor and adding text and then saving it is not hard. Better clearly state what is being done instead of making it just one complex command. Dec 16, 2020 at 17:47
  • Yeah great explaintation, many systems don't have nano, wget etc aswell which we install them, however, newer versions of linux they do have tee installed by default. At least in centos 7/8 which i am using.
    – iceman
    Dec 16, 2020 at 18:10
  • 1
    Actually the one here won't work which i tried them: # echo realtek > /etc/modules-load.d/realtek.conf (then reboot) actually it worked in kernel-ml 5.8 but not in higher versions of kernel-ml.
    – iceman
    Dec 16, 2020 at 18:19
0

also use crontab -e add this command

@reboot sleep 20  && /usr/sbin/rmmod  r8169 && /usr/sbin/modprobe r8169
2
  • 2
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jun 16, 2022 at 9:28
  • Please expand upon your answer to make it clearer what you think that the solution is. Jun 30, 2022 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.