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.
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
rm -r /etc/systemd/system/ifup@.service.d as @Joulinar suggested to no avail
Toggled Network Options: Misc → Boot 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.
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?
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.
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.
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.