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

Okay, when this is new with this DietPi version, I’m petty sure it’s due to the new kernel.

Just in case it got solved in master branch, please try first up upgrade it:

apt install rpi-update
rpi-update

If this does not help, try to downgrade it to latest v5.4:

rpi-update 453e49bdd87325369b462b40e809d5f3187df21d

If this helps, we should report it to the Raspberry Pi Linux repository: https://github.com/raspberrypi/linux/issues

Hi , I am new here. I am using Raspberry Pi 3A and it also does not connect to the Ethernet eth0. When I boot using Raspberry OS Legacy it works fine. I initiated wi-fi wlan0 using an USB dongle and it works. I tried ifdown eth0 and ifup eth0 and it does not get a DHCP response after trying several times. My router is on during this tests. Also, I noted that dietpi thinks it is a Raspberry Pi3B instead. Would you check bugreport dd16c031-9746-4bda-9aea-3ff9e4534fda ? Many thanks in advance.

can you check if the Ethernet cable is connected correctly?

There you have following message on the log

[  234.382545] smsc95xx 1-1.1:1.0 eth0: Link is Down

and

2: eth0: <NO-CARRIER

I’ve the exact same issue as OP on my RPi 4B+ running DietPi v8.18.2 with kernel 6.1.21-v8+.

If both modem and RPi powers ON together, RPi boots within 10s and modem takes around 2 mins. In this scenario, RJ45 connector lights are OFF and eth0 link is down with NO-CARRIER. If doesn’t matter if I disconnect and reconnect the LAN cable, the lights never go ON. However, once the router is up, if I power cycle RPi, it works like a charm. Lights blink and everything works as expected.

What I tried

  1. rm -r /etc/systemd/system/ifup@.service.d as @Joulinar suggested to no avail
  2. Toggled Network Options: MiscBoot wait for network without success.
    • When booting RPi if the cable is plugged and router is still booting, it doesn’t matter if this setting is set to wait or not, the link never goes up and the light always stay OFF.
  3. Previously suggested solution was to rpi-update but I think DietPi gives firmware updates through rpi-eeprom-update.service; its log as follows
Jun 28 12:34:10 DietPi rpi-eeprom-update[327]: BOOTLOADER: up to date
Jun 28 12:34:10 DietPi rpi-eeprom-update[327]:    CURRENT: Wednesday 11 January 2023 05:40:52 PM UTC (1673458852)
Jun 28 12:34:10 DietPi rpi-eeprom-update[327]:     LATEST: Wednesday 11 January 2023 05:40:52 PM UTC (1673458852)
Jun 28 12:34:10 DietPi rpi-eeprom-update[327]:    RELEASE: default (/lib/firmware/raspberrypi/bootloader/default)
Jun 28 12:34:10 DietPi rpi-eeprom-update[327]:             Use raspi-config to change the release.
Jun 28 12:34:10 DietPi rpi-eeprom-update[327]:   VL805_FW: Using bootloader EEPROM
Jun 28 12:34:10 DietPi rpi-eeprom-update[327]:      VL805: up to date
Jun 28 12:34:10 DietPi rpi-eeprom-update[327]:    CURRENT: 000138c0
Jun 28 12:34:10 DietPi rpi-eeprom-update[327]:     LATEST: 000138c0

My network settings from /boot/dietpi.txt:

AUTO_SETUP_NET_ETHERNET_ENABLED=1
AUTO_SETUP_NET_WIFI_ENABLED=0

# Enter your static network details below, if applicable.
AUTO_SETUP_NET_USESTATIC=1
AUTO_SETUP_NET_STATIC_IP=192.168.1.10
AUTO_SETUP_NET_STATIC_MASK=255.255.255.0
AUTO_SETUP_NET_STATIC_GATEWAY=192.168.1.1
AUTO_SETUP_NET_STATIC_DNS=1.1.1.1 1.0.0.1

# Set to "1" to convert DHCP leased network settings into static settings automatically on first boot.
AUTO_SETUP_DHCP_TO_STATIC=0

What are my options to fix this? I live in a country where power-cuts are at least thrice a day and every time I’ve to manually cold reboot my headless RPi to get network connectivity.

Out of curiosity and for testing, how does it behave if you just use RPI OS (same architecture, kernel version)? Does it work? Or are there the same problems?

@Joulinar

how does it behave if you just use RPI OS (same architecture, kernel version)? Does it work? Or are there the same problems?

Never tried RPI OS; in fact DietPi is the only OS I’ve used and RPi 4B+ is my first SBC. I’ll try with another microSD card and let you know in a day.

take your time.

@Joulinar Clean installation of latest Raspberry Pi OS works without this issue; it has the exact same kernel as DietPi 8.18.2.

Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64

I tested by powering on both modem and RPi 4B+ together. Link was down initially (as expected), once the modem was fully up, the Pi’s RJ45 lights started blinking and network was up on eth0 (static IP setup like my DietPi setup).

RPi OS uses /etc/dhcpcd.conf while DietPi uses /etc/network/interfaces. I use my RPi as my LAN’s DNS, so I’ve commented out # dns-nameservers in interfaces. I hope this isn’t the issue; tried setting it to both dns-nameservers 1.1.1.1 and dns-nameservers 127.0.0.1 without luck.

Please let me know if I can collect any logs to help identify the issue.

Issue fixed! @Joulinar Your tip helped! To validate if it’s a DietPi issue, I did a fresh DietPi installation which didn’t have aforementioned issue! My /etc/network/interfaces had

# Commenting just this one line fixes the issue
auto eth0
auto eth0:0

# Ethernet
allow-hotplug eth0
iface eth0 inet static
  address 192.168.1.10
  netmask 255.255.255.0
  gateway 192.168.1.1
  # dns-nameservers 1.1.1.1 1.0.0.1
  
iface eth0:0 inet static
  address 192.168.1.11
  netmask 255.255.255.0
  gateway 192.168.1.1

The second iface stanza is for a virtual interface (eth0:0) needing auto eth0:0. However eth0, which is manually set to static IP, doesn’t need auto eth0; this was the culprit. Commenting it fixes the issue. Intuitively this makes sense but I’d like to know why dropping auto eth0 fixes the issue.

Honestly, I don’t know. Maybe @MichaIng has an idea

I have the same issue. but I couldn’t find the line auto eth0 in the /etc/network/interfaces file. Any idea what is the issue?

RPi 4B
DietPi v8.21.1

Can you share your /etc/network/interfaces

# Drop-in configs
source interfaces.d/*

# Ethernet
allow-hotplug eth0
iface eth0 inet dhcp
address 192.168.0.197
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 192.168.0.197 192.168.0.1

# WiFi
allow-hotplug wlan0
iface wlan0 inet dhcp
address 192.168.0.197
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 192.168.0.197 192.168.0.1
pre-up iw dev wlan0 set power_save off
post-down iw dev wlan0 set power_save on
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

your RPI is connected directly to your router? And if both starting same time, your RPI is not getting a network connection?

yes, that is the issue.

we had a couple of similar reports but never found a real cause. What could bypass the issue, would be using a switch between RPI and router device. This would keep the LAN connection up even if the router is rebooting.

Maybe @MichaIng has another idea.

Does it help if you disable the Ethernet Energy Efficiency mode?

sudo ethtool --set-eee eth0 eee off

Respectively doing this automatically once the interface is brought up:

sudo sed -i '/iface eth0/a\post-up /sbin/ethtool --set-eee eth0 eee off' /etc/network/interfaces

Btw, having WiFi and Ethernet enabled on just the same network can cause issues. Does the issue happen as well when you disable WiFi? The way network is currently configured, it is more an either or, actually like it is common with Laptops etc. If you need WiFi as fallback for Ethernet or the other way round, better to use ifplugd for an automatic switch. We have a guide for this somewhere here on the forum.