Network link cannot be brought up if connection gets lost once

Creating a bug report/issue

I have searched the existing open and closed issues

Required Information

  • DietPi version
    G_DIETPI_VERSION_CORE=9
    G_DIETPI_VERSION_SUB=11
    G_DIETPI_VERSION_RC=2
    G_GITBRANCH=‘master’
    G_GITOWNER=‘MichaIng’
  • Distro version: bullseye 0
  • Kernel version: Linux raspberry-pi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
  • Architecture: arm64
  • SBC model: RPi 4 Model B (aarch64)
  • Power supply used: official raspberry-pi power adapter
  • SD card used: official raspberry-pi SD card

Steps to reproduce

  1. Start raspberry-pi
  2. Check that it connected to internet
  3. Restart router
  4. Notice that internet is not reconnected when router is fully restarted

Expected behaviour

  • network reconnects when router is up and running

Actual behaviour

  • no internet, running ifup eth0 or ip link set eth0 up doesn’t help

The issue can also be reproduced by running: ifdown eth0. Internet will not bet back afterwards. Only reboot fixes the issue.

Extra details

I think this issue is similar to this and this issue.
Unfortunately no suggestions posted there helped, especially sudo ethtool --set-eee eth0 eee off.
But here’s my outputs from commands posted there:
sudo ethtool eth0:

Settings for eth0:
	Supported ports: [ TP	 MII ]
	Supported link modes:   10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Half 1000baseT/Full
	Supported pause frame use: Symmetric Receive-only
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Half 1000baseT/Full
	Advertised pause frame use: Symmetric Receive-only
	Advertised auto-negotiation: No
	Advertised FEC modes: Not reported
	Speed: 1000Mb/s
	Duplex: Full
	Auto-negotiation: off
	master-slave cfg: preferred slave
	master-slave status: unknown
	Port: Twisted Pair
	PHYAD: 1
	Transceiver: external
	MDI-X: Unknown
	Supports Wake-on: d
	Wake-on: d
        Current message level: 0x00000007 (7)
                               drv probe link
	Link detected: no

ip l

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
    link/ether e4:5f:01:bb:5c:f9 brd ff:ff:ff:ff:ff:ff
3: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 500
    link/none

ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether e4:5f:01:bb:5c:f9 brd ff:ff:ff:ff:ff:ff
    inet 192.168.55.201/24 brd 192.168.55.255 scope global eth0
       valid_lft forever preferred_lft forever
3: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 500
    link/none
    inet 10.8.0.5/24 scope global tun0
       valid_lft forever preferred_lft forever

ip r

default via 192.168.55.1 dev eth0 onlink linkdown
10.8.0.0/24 dev tun0 proto kernel scope link src 10.8.0.5
10.8.0.0/16 via 10.8.0.1 dev tun0
192.168.55.0/24 dev eth0 proto kernel scope link src 192.168.55.201 linkdown

The led light indicating that network link is working is turned off when internet stops working.
I’ve had static IP settings previously setup but due to some comments I’ve changed them to DHCP but it didn’t help so I’ve changed them back to static IP.
But now I have a problem that if I run ifdown for test and then restart I cannot get the network to work on startup. It immediately breaks at the startup, which is worse then previously.
It works after several restarts but not after a single one.
I’ve had this issue for quite long time but I’ve first was doing manual restarts of the PI and then I’ve setup network-repair script but it only was “fixing” the issue when I enabled reboots as running ifdown/ifup didn’t help. I haven’t got the time to investigate this better but now I’d like to finally figure this out so the restarts are not necessary.

Please help :).

There is also this issue that I think is related.

First problem is that the link is not detected.
Second problem I see is that your auto-negotiation is off.
Maybe there is some cabling issue or some problem from the switch that RPi connects?
If the link cannot operate at 1000FD, it will fail.

I also think that the issue is that RPi doesn’t see that the link is connected. But it only happens when I disable it via ifdown. It works after reboot.

If the link cannot operate at 1000FD, it will fail

Again: shouldn’t that happen also after reboot?

Where should I look to confirm/test this theory?

hmm I did some testing on my demo RPi4B running Bookworm, DietPiv9.11.2, kernel 6.1.21-v8+

I was not able to reproduce the problems. It worked to shut down the adapter with ifdown eth0 and bring it back online with ifup eth0.

DHCP set to offline

Mar 19 11:27:10 DietPi4 dhclient[2379]: Killed old client process
Mar 19 11:27:11 DietPi4 dhclient[2379]: Internet Systems Consortium DHCP Client 4.4.3-P1
Mar 19 11:27:11 DietPi4 dhclient[2379]: Copyright 2004-2022 Internet Systems Consortium.
Mar 19 11:27:11 DietPi4 dhclient[2379]: All rights reserved.
Mar 19 11:27:11 DietPi4 dhclient[2379]: For info, please visit https://www.isc.org/software/dhcp/
Mar 19 11:27:11 DietPi4 dhclient[2379]:
Mar 19 11:27:11 DietPi4 dhclient[2379]: Listening on LPF/eth0/dc:a6:32:e2:10:cd
Mar 19 11:27:11 DietPi4 dhclient[2379]: Sending on   LPF/eth0/dc:a6:32:e2:10:cd
Mar 19 11:27:11 DietPi4 dhclient[2379]: Sending on   Socket/fallback
Mar 19 11:27:11 DietPi4 dhclient[2379]: DHCPRELEASE of 192.168.0.17 on eth0 to 192.168.0.11 port 67
Mar 19 11:27:11 DietPi4 kernel: bcmgenet fd580000.ethernet eth0: Link is Down

DHCP set to online

Mar 19 11:27:33 DietPi4 dhclient[2410]: Internet Systems Consortium DHCP Client 4.4.3-P1
Mar 19 11:27:33 DietPi4 dhclient[2410]: Copyright 2004-2022 Internet Systems Consortium.
Mar 19 11:27:33 DietPi4 dhclient[2410]: All rights reserved.
Mar 19 11:27:33 DietPi4 dhclient[2410]: For info, please visit https://www.isc.org/software/dhcp/
Mar 19 11:27:33 DietPi4 dhclient[2410]:
Mar 19 11:27:33 DietPi4 kernel: bcmgenet fd580000.ethernet: configuring instance for external RGMII (RX delay)
Mar 19 11:27:33 DietPi4 kernel: bcmgenet fd580000.ethernet eth0: Link is Down
Mar 19 11:27:33 DietPi4 dhclient[2410]: Listening on LPF/eth0/dc:a6:32:e2:10:cd
Mar 19 11:27:33 DietPi4 dhclient[2410]: Sending on   LPF/eth0/dc:a6:32:e2:10:cd
Mar 19 11:27:33 DietPi4 dhclient[2410]: Sending on   Socket/fallback
Mar 19 11:27:33 DietPi4 dhclient[2410]: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4
Mar 19 11:27:36 DietPi4 kernel: bcmgenet fd580000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
Mar 19 11:27:36 DietPi4 kernel: IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Mar 19 11:27:37 DietPi4 dhclient[2410]: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8
Mar 19 11:27:37 DietPi4 dhclient[2410]: DHCPOFFER of 192.168.0.17 from 192.168.0.11
Mar 19 11:27:37 DietPi4 dhclient[2410]: DHCPREQUEST for 192.168.0.17 on eth0 to 255.255.255.255 port 67
Mar 19 11:27:37 DietPi4 dhclient[2410]: DHCPACK of 192.168.0.17 from 192.168.0.11
Mar 19 11:27:37 DietPi4 dhclient[2410]: bound to 192.168.0.17 -- renewal in 40689 seconds.

STATIC set to offline

Mar 19 11:28:53 DietPi4 kernel: bcmgenet fd580000.ethernet eth0: Link is Down

STATIC set to online

Mar 19 11:29:08 DietPi4 kernel: bcmgenet fd580000.ethernet: configuring instance for external RGMII (RX delay)
Mar 19 11:29:08 DietPi4 kernel: bcmgenet fd580000.ethernet eth0: Link is Down
Mar 19 11:29:11 DietPi4 kernel: bcmgenet fd580000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
Mar 19 11:29:11 DietPi4 kernel: IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

I also have 3 RPi4 running with dietpi and never had this issue.
However I compared the output of your ethtool eth0 with mine and found the difference.
It is anyway not a huge deal to set the port to autonegotiate and test.

1 Like

@trendy it looks to fix the problem! Thank you very much.
I’ve enabled it via sudo ethtool -s eth0 autoneg on but after test reboot it went back to being disabled.
I’ve then went to enable it via sudo dietpi-config => Network Options: Adapters => Ethernet => Link Speed and changed it to default: 0 : Auto-negotiation.
I don’t remember why I’ve setup it to be 1000MB. It was some time ago.

Thank you again!

1 Like