Need to restart NetworkManager when pluging Ethernet cable

Hi fellows

I got a problem with the nic on my laptop.

When i plug in Ethernet cable nothing happens.
I monitor and cannot see anything happening.

I need to restart NetworkManager service for the card to be active and up the connection.

the NIC is :

Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)

Kernel drivers/module :

        Kernel driver in use: r8169                                                                                                                                                           
        Kernel modules: r8169
journalctl -k -r
Jun 20 00:02:25 TP1 kernel: r8169 0000:05:00.0 enp5s0: Link is Up - 1Gbps/Full - flow control off                                                                                             
Jun 20 00:02:25 TP1 kernel: IPv6: ADDRCONF(NETDEV_CHANGE): enp5s0: link becomes ready                                                                                                         
Jun 20 00:02:25 TP1 kernel: r8169 0000:05:00.0 enp5s0: Link is Up - 1Gbps/Full - flow control off                                                                                             
Jun 20 00:02:20 TP1 kernel: r8169 0000:05:00.0 enp5s0: Link is Down                                                                                                                           
Jun 20 00:02:20 TP1 kernel: r8169 0000:02:00.0 enp2s0f0: Link is Down                                                                                                                         
Jun 20 00:00:13 TP1 kernel: device enp5s0 left promiscuous mode                                                                                                                               
Jun 20 00:00:13 TP1 kernel: r8169 0000:02:00.0 enp2s0f0: Link is Down                                                                                                                         
Jun 20 00:00:13 TP1 kernel: r8169 0000:05:00.0 enp5s0: Link is Down                                                                                                                           
Jun 20 00:00:13 TP1 kernel: device enp5s0 entered promiscuous mode 

Anyone having the same issue ?

Thanks for reading.

TLDR; I installed and enabled tlp and the problem doesn’t occur anymore.

sudo dnf install -y tlp && sudo systemcl enable --now tlp

Here is my partial investigation :

After suspend (sleep state S3) or long time unplugged gbe network is down.
Need to restart NetworkManager when plugging back cable.

Jun 20 00:02:20 TP1 kernel: r8169 0000:05:00.0 enp5s0: Link is Down

some diagnosis :

Nov 29 16:21:26 TP1 kernel: r8169 0000:02:00.0: can’t disable ASPM; OS doesn’t have ASPM control 
Nov 29 16:21:26 TP1 kernel: r8169 0000:05:00.0: can’t disable ASPM; OS doesn’t have ASPM control

two “devices” are affected by the ASPM problem

https://askubuntu.com/questions/372363/what-does-r8169-cant-disable-aspm-os-doesnt-have-aspm-control-really-mean

it’s the way acpi mess deal with the system

two devices are concerned

lspci -k

05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
        Subsystem: Lenovo Device 5081
        Kernel driver in use: r8169
        Kernel modules: r8169
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0e)                                                               
        Subsystem: Lenovo Device 5081                                                                                                                                                         
        Kernel driver in use: r8169                                                                                                                                                           
        Kernel modules: r8169

let’s check if our devices are capable of aspm :

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:02:00.0                                                                                                                                                             
       logical name: enp2s0f0
       version: 0e
       serial: XX
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=6.0.9-300.fc37.x86_64 latency=0 link=no multicast=yes port=twisted pair
       resources: irq:63 ioport:4400(size=256) memory:fd814000-fd814fff memory:fd800000-fd803fff

  *-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:05:00.0
       logical name: enp5s0
       version: 15
       serial: XX
       size: 1Gbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix 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=6.0.9-300.fc37.x86_64 duplex=full firmware=rtl8168h-2_0.0.2 02/26/15 ip=192.168.1.221 latency=0 link=yes mul
ticast=yes port=twisted pair speed=1Gbit/s
       resources: irq:70 ioport:2000(size=256) memory:fd504000-fd504fff memory:fd500000-fd503fff

We thought about tweaking the module but there are no kernel parameters for this module :

sudo dnf install -y sysfsutils

systool -vm r8169

https://serverfault.com/questions/62316/how-do-i-list-loaded-linux-module-parameter-values

Before going deeper we try to enable some power manager like tlp :

sudo systemcl enalbe –now tlp

wait it works !

after plugin the cable i have this when i plug back my cable.

Dec 02 10:44:31 TP1 kernel: Generic FE-GE Realtek PHY r8169-0-500:00: attached PHY driver (mii_bus:phy_addr=r8169-0-500:00, irq=MAC) Dec 02 10:44:31 TP1 kernel: r8169 0000:02:00.0 enp2s0f0: Link is Down