2

The problem

Hello, I recently ran my Ubuntu computer after longer time, get updates, reboot and wired network stopped working. Previous version was some 20.04 too. Don't know exact version.

I have no connection and popup informing about failed connection update is appearing periodically.

Update 2021-06-14
I found that connection works after cool start (Shutdown -> Start), but not after reboot.

As @heynnema pointed out this is problem with integrated RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller on my motherboard B85-G41 PC Mate(MS-7850). See the solution,

Logs and stuff

$ inxi -Fx
System:    Host: ****** Kernel: 5.8.0-53-generic x86_64 bits: 64 compiler: N/A Desktop: Gnome 3.36.7 
Machine:   Type: Desktop System: MSI product: MS-7850 v: 1.0 serial: <superuser/root required> 
           Mobo: MSI model: B85-G41 PC Mate(MS-7850) v: 1.0 serial: <superuser/root required> UEFI: American Megatrends v: 2.9
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Micro-Star MSI driver: r8169 v: kernel 
           port: d000 bus ID: 03:00.0 
           IF: enp3s0 state: up speed: 1000 Mbps duplex: full mac: d8:cb:8a:c6:f6:d8 
$ lshw -C network
*-network                 
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:03:00.0
       logical name: enp3s0
       version: 0c
       serial: d8:cb:8a:c6:f6:d8
       size: 1Gbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=5.8.0-53-generic duplex=full firmware=rtl8168g-2_0.0.1 02/06/13 latency=0 link=yes multicast=yes port=MII speed=1Gbit/s
       resources: irq:17 ioport:d000(size=256) memory:f7100000-f7100fff memory:f2100000-f2103fff

It's trying to connect, but the popup mentioned on beginning is shown (can't write exact message it flashes quickly).

$ tail -f  /var/log/syslog (edited)
NetworkManager[1052]: <info>  [1622575610.6830] device (enp3s0): Activation: starting connection 'Wired connection 1' (baec95cb-6dc1-4f0e-9f03-449a60f01d9e)
NetworkManager[1052]: <info>  [1622575610.6831] audit: op="connection-activate" uuid="baec95cb-6dc1-4f0e-9f03-449a60f01d9e" name="Wired connection 1" pid=1585 uid=1000 result="success"
NetworkManager[1052]: <info>  [1622575610.6833] device (enp3s0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
NetworkManager[1052]: <info>  [1622575610.6848] device (enp3s0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
NetworkManager[1052]: <info>  [1622575610.6854] device (enp3s0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
NetworkManager[1052]: <info>  [1622575610.6860] dhcp4 (enp3s0): activation: beginning transaction (timeout in 45 seconds)
avahi-daemon[1047]: Joining mDNS multicast group on interface enp3s0.IPv6 with address fe80::c201:e5e1:9239:f63.
avahi-daemon[1047]: New relevant interface enp3s0.IPv6 for mDNS.
avahi-daemon[1047]: Registering new address record for fe80::c201:e5e1:9239:f63 on enp3s0.*.
NetworkManager[1052]: <info>  [1622575611.9842] dhcp6 (enp3s0): activation: beginning transaction (timeout in 45 seconds)
kernel: [ 1859.560671] r8169 0000:03:00.0 enp3s0: rtl_rxtx_empty_cond == 0 (loop: 42, delay: 100).
kernel: [ 1885.671779] r8169 0000:03:00.0 enp3s0: rtl_rxtx_empty_cond == 0 (loop: 42, delay: 100).
NetworkManager[1052]: <warn>  [1622575656.0903] dhcp4 (enp3s0): request timed out
NetworkManager[1052]: <info>  [1622575656.0903] dhcp4 (enp3s0): state changed unknown -> timeout
NetworkManager[1052]: <warn>  [1622575657.0859] dhcp6 (enp3s0): request timed out
NetworkManager[1052]: <info>  [1622575657.0860] dhcp6 (enp3s0): state changed unknown -> timeout
NetworkManager[1052]: <info>  [1622575657.0861] device (enp3s0): state change: ip-config -> failed (reason 'ip-config-unavailable', sys-iface-state: 'managed')
NetworkManager[1052]: <warn>  [1622575657.0883] device (enp3s0): Activation: failed for connection 'Wired connection 1'
NetworkManager[1052]: <info>  [1622575657.0888] device (enp3s0): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
avahi-daemon[1047]: Withdrawing address record for fe80::c201:e5e1:9239:f63 on enp3s0.
avahi-daemon[1047]: Leaving mDNS multicast group on interface enp3s0.IPv6 with address fe80::c201:e5e1:9239:f63.
avahi-daemon[1047]: Interface enp3s0.IPv6 no longer relevant for mDNS.
NetworkManager[1052]: <info>  [1622575657.1070] dhcp4 (enp3s0): canceled DHCP transaction
NetworkManager[1052]: <info>  [1622575657.1071] dhcp4 (enp3s0): state changed timeout -> done
NetworkManager[1052]: <info>  [1622575657.1073] dhcp6 (enp3s0): canceled DHCP transaction
NetworkManager[1052]: <info>  [1622575657.1073] dhcp6 (enp3s0): state changed timeout -> done
NetworkManager[1052]: <info>  [1622575657.1121] policy: auto-activating connection 'Wired connection 1' (baec95cb-6dc1-4f0e-9f03-449a60f01d9e)

I tried

(The PC is connected via USB Wifi dongle now)

$ sudo rmmod r8169
$ sudo modprobe r8169

$ sudo apt install r8168-dkms
(reboot - doesn't work - so removed)
$ sudo apt purge r8168-dkms

Also I removed the original Wired connection profile and replaced it by a new one with following settings:

enter image description here enter image description here enter image description here enter image description here enter image description here

Lluser
  • 123
  • Show me sudo dmidecode -s bios-version and confirm that your motherboard is MSI model: B85-G41 PC Mate(MS-7850) v: 1.0. – heynnema Jun 02 '21 at 02:50
  • @heynnema $ sudo dmidecode -s bios-version V2.9 (Latest). Don't know how to check version, but yes it's B85-G41 PC Mate – Lluser Jun 02 '21 at 08:17
  • Wait a second... I wrote the comment from the Ubuntu PC without USB Wifi dongle! It's working again. Only thing what happened from original post till now is shutdown and cold start. (I did many restarts before.) – Lluser Jun 02 '21 at 08:23

1 Answers1

2

$ lspci -nn | grep -i ethernet

03:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 0c)

You probably have a problem with MSI/MSIX interrupts from the r8168 ethernet board. Install the following patch to fix it... follow the embedded instructions closely...

#!/bin/sh

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1779817

Attached is a work-around for the in-kernel driver that is as unhacky as I can make it.

filename: r8169_disable_msi

Drop it in /etc/initramfs-tools/scripts/init-top and chmod a+x it. Add 'r8169_disable_msi'

to your kernel command line (/etc/default/grub, GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

usually.)

Remember to update-initramfs and update-grub as necessary.

sudo update-initramfs -c -k $(uname -r)

sudo update-grub

reboot

For the moment it disables MSI on everything with the ID 0x10ec:0x8168, as there seems to

be no way to get the MAC version from userspace - and certainly not before the driver is

loaded. Other PCI IDs may need adding..

Still hoping we can cherry pick the in-driver workaround for bionic...?

PREREQ="" prereqs() { echo "$PREREQ" } case $1 in

get pre-requisites

prereqs) prereqs exit 0 ;; esac

disable_msi () { for i in /sys/bus/pci/devices/*; do if [ $(cat $i/vendor) = "0x10ec" -a $(cat $i/device) = "0x8168" ]; then echo 0 >$i/msi_bus fi done }

for x in $(cat /proc/cmdline); do case ${x} in r8169_disable_msi) disable_msi break ;; esac done

heynnema
  • 70,711
  • Thank you! Now it's working again, so It seems to be pointless to apply your patch - moreover I can't decide what impact will have. So, I'll wait if problem occurs again and then I try your patch. Or if somebody solve this problem with this patch, write comment and I mark this Answer as the solution. – Lluser Jun 03 '21 at 17:53
  • @Lluser See https://askubuntu.com/questions/1325854/activation-of-network-connection-failed-fixes-when-reboot-from-windows and https://askubuntu.com/questions/1308988/wired-connection-occasionally-disconnects-ubuntu-20-04-1/1309053#1309053 as just two examples. – heynnema Jun 03 '21 at 18:25
  • @Lluser In 20.xx, developers enabled MSI/MSIX interrupts for the r8168/r8169 ethernet boards. The patch disables those interrupts for just that one ethernet card. Zero impact, other than the card doesn't have connection issues any more. – heynnema Jun 03 '21 at 18:38
  • @Lluser Show me lspci -nn | grep -i ethernet and I'll confirm this patch will work on your board. – heynnema Jun 03 '21 at 18:46
  • @Lluser Status please... – heynnema Jun 04 '21 at 14:18
  • @Lluser Status please... – heynnema Jun 07 '21 at 03:05
  • $ lspci -nn | grep -i ethernet 03:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 0c) Sorry for late reply, I have not been able to reach my Ubuntu PC until now. – Lluser Jun 07 '21 at 20:00
  • @Lluser Yes, my code will work with your ethernet card. – heynnema Jun 07 '21 at 20:51
  • You are absolutely right. This workaroud solved my problem! Thank you! I'm lame, and was not sure how to performs some steps, so I wrote this commented approach, please add it to you reply to help other lame users with solving this problem. – Lluser Jun 14 '21 at 19:46
  • I have the 10ec:8168 device but wasn't seeing this problem until yesterday, when I got the 1.22.10-1ubuntu2.2 and 1.22.10-1ubuntu2.3 updates to network-manager, after which my wired internet disappeared and has not returned. Power cycling does not help, and neither does the script from above :( – Jeff Trull Feb 02 '22 at 21:08
  • @JeffTrull Please start a new question and I can try to help. In your question, show me sudo lshw -C network and cat /etc/netplan/*.yaml and cat /etc/network/interfaces. – heynnema Feb 02 '22 at 21:17
  • Great thank you @heynnema https://askubuntu.com/questions/1390757/network-manager-no-longer-shows-wired-ethernet-realtek-8168 – Jeff Trull Feb 02 '22 at 21:37