Wired Ethernet on Connecting at Power-Up on Raspberry Pi 3

I recently upgrade to DietPi v7.0.2 on my Raspberry Pi 3. When I power-up the unit before my router is up and running, the wired Ethernet does not connect. The green lights on the RJ45 connector of the Raspberry Pi are not ON. If I cycle power after the router is up and running, I have not issues. I did not have this problem with the older version of DietPi. Since the DietPi boots faster than my router, I have this problem every time I powering up my system. Any suggestions on how to enable the wired Ethernet even if the router is not up and running?

Hi,

how long do you wait before you power cycle?

I wait about a minute or two to power cycle my Raspberry Pi. I power cycle it when my router is up and running normally.

do you have a screen attached to see where it stuck??

No I do not. If the Raspberry Pi is powered up and running before the router has fully booted up, the rooter does not detect the Raspberry PI. The green lights on the Raspberry PI RJ45 connector are OFF. I can not ping the Raspberry PI IP address from my computer. When I power cycle the Raspberry PI after the router is up and running, the router detects it and I can ping it. The green lights on the RJ45 Ethernet connector are also ON.

It is as if the Raspberry PI disables the wired Ethernet connection if it does not detect that it is on a network during the 1st power-up cycle when the router has not yet come up.

hmm, I did a test on my RPi3B+. I booted the device without network cable connected. The system finished boot in around 80 seconds as it was hanging for 60 sec on network time sync. But this is as expected. :wink: As soon as I connect the Ethernet cable, my RPi got available on my local network. Means network was detected and correctly started.

Did you tried to unplug/plug Ethernet cable once your router started? could it be an issue of the Router not detecting the Ethernet connection?

I tried unplugging and plugging the cable. It did not work. What is odd is that I did not have problems with the previous version of DietPi. It started when I upgrade DietPi on my Raspberry Pi.

can you try removing this folder an check again

rm -r /etc/systemd/system/ifup@.service.d

I tried what you said, but it did not work. It still has the same behavior.

I did notice that the lights on the RJ45 Ethernet connect flash ON at boot-up, but then turn OFF and do not come back ON if the router is not up and running.

The dietpi.conf file in the directory you indicated is as follows:

# Override service type to give network(-online).target more meaning and remove obsolete ifquery call: https://github.com/MichaIng/DietPi/issues/4121#issuecomment-782057374
[Service]
Type=oneshot
ExecStart=ifup --allow=hotplug %I

would be helpful if you would have a screen attached to see what happen during boot and if it stuck somewhere

As I told above, my RPi is booting even without Ethernet cable connected and it get available on network level as soon as I plug the cable

Can you test to boot the RPi without Ethernet cable and plug it in after a couple of minutes.

I tried booting up with the Ethernet cable connector disconnected, but the router up and running. The Ethernet would not work.

I took photos of the boot-up sequence without and with Ethernet connected.

Boot-up with no Ethernet
https://photos.app.goo.gl/FSgAXnWXVS3oYZPG9

https://photos.app.goo.gl/FSgAXnWXVS3oYZPG9

Example of a Good Boot-Up with Ethernet
https://photos.app.goo.gl/ES1hpxSHanUZmjHt9

I was able to fix it once I could see the boot-up session.

I read this post: https://dietpi.com/forum/t/ntp-systemd-timesyncd-issue/2742/1

I modified the time sync mode to custom.
dietpi-config > Advanced Options and choose “custom” as time sync mode.

I am not sure why this was preventing the system from booting up.

well usually time sync should time out after 60 sec. This is as well shown on your picture > last line 10/60

Does it stuck at 10/60 or does it continue?

The unit tried 60/60 times and “Exited with error”. See the picture in the link below.

https://photos.app.goo.gl/QV9421oYA7ZYrKHV6

It seemed to have booted up all the way, but the Ethernet connection was not established.

this looks as expected. So I don’t know how deactivating the time sync should influence this. :thinking:

Are you able to have a keyboard connected and could check status? ip a

as well can you share network config cat /etc/network/interfaces

Below is a the response of ip a.

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group defaul
t 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 pfifo_fast state DOW
N group default qlen 1000
    link/ether b8:27:eb:33:47:ac brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.10/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever

This is the output from cat /etc/networks/interfaces.

# Location: /etc/network/interfaces
# Please modify network settings via: dietpi-config
# Or create your own drop-ins in: /etc/network/interfaces.d/

# Drop-in configs
source interfaces.d/*

# Local
auto lo
iface lo inet loopback

# Ethernet
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 9.9.9.9 149.112.112.112

# WiFi
#allow-hotplug wlan0
iface wlan0 inet dhcp
address 0.0.0.0
netmask 0.0.0.0
gateway 0.0.0.0
#dns-nameservers 0.0.0.0
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

So the only issue is that with a later plugged Ethernet cable, no network connection is established, while it works when the cable is connected on boot, right?

With a static IP address it should actually work. That also has been applied correctly, based on your ip a output. Has the default route been created? ip r

MichaIng

It’s a little bit different. The issue is, that it is not working if RPi is booted up together with the router. Means, RPi is online before the Router. Looks like that Ethernet connection is not correctly detected. But yeah, usually it should work to connect the cable once the router is online :thinking:

It seems to be only working if the RPi is booted after the router is online

Strange think, eth0 has a NO-CARRIER flag. Indeed cable is not detected. Probably a behaviour of the router?

Ah, and I’ve overseen state DOWN (related to NO-CARRIER, I bet). So indeed then the cable connection state itself seems to not be updated somehow, probably when the router link becomes ready after the RPi link. I’m not sure how this is usually working, but in my case when restarting the router or such, I can see in the logs on the RPi how the link goes down and up, immediately, whether it’s a udev event and/or triggered by the router, I’m not sure currently.

ethtool is installed (as it is by default), right? Would be interesting if running ethtool eth0 triggers the state shown by ip -br a s dev eth0 to be updated or if it still shows DOWN regardless of router connection.

What should definitely work is to reconfigure the interface:

ifdown eth0
ifup eth0

If everything else does not lead to a satisfying solution, a little boot or login script that checks the interface state and in case re-configures it could be a workaround.

The following is the response from typing ethtool eth0 when the Raspberry boots up before the router is up.

Settings for eth0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/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
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Speed: Unknown!
        Duplex: Unknown! (255)
        Port: MII
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: pumbag
        Wake-on: d
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: no

The response from ip -br a s dev eth0 is as follows:

eth0             DOWN           192.168.0.10/24

I tried running the following:

ifdown eth0
ifup eth0

This will work if the router is up and running when I run the script. If the router is not up or the Ethernet cable is not connected when the script is run, the connection will not be made. The problem is my unit is unattended and the power to the Raspberry Pi and router is cycled everyday. The Raspberry Pi comes up before the router and does not automatically establish an Ethernet connection. I did not have this problem with the pervious version of DietPi.