A fix for Raspberry Pi intermittent networking issues

I have a Raspberry Pi 4 that I use as a PiHole server for my home network (which I can’t recommend enough doing). It has been running for a while now, but after the last updates it was not booting anymore. I checked the (arguably pretty cheap) MicroSD card that I used and it was dead. So, I decided to get a new one and set up the PiHole server again - since I was pretty sure that I did not need to configure a lot. However, after installing Raspbian Lite via the Raspberry Pi Imager and booting the Pi, I noticed that the network LEDs on the Pi turned off periodically. Like, they were blinking (indicating activity) for 1-2 seconds and then turn off for 1-2 seconds. I also got a host of networking issues inside the Pi, like ping not working, apt-get not working, DNS resolution failures, etc.. After tons of research, trial-and-error and frustration, multiple re-imaging-procedures and different cables, I found a solution that worked for me - so I need to note it down for my future self 😄 This post on the Raspberry Pi forums was the key to my solution. I ran the suggested command journalctl -b to look through the system logs and found a lot of occurrences of messages indicating eth0 being connected and then down again 2 lines afterwards. Then I used sudo nano /boot/firmware/config.txt (the path mentioned on the forums has changed to this one) and added the following line near the beginning of the file:...

May 31, 2024 · 2 min · Me