WiFi disappears after a day?

I’ve got three RPis here running DietPi and Roon Bridge. Two of them work fine, and they are connected via Ethernet cabling. The third RPi uses WiFi, and it seems that after 24 hours or so, the WiFi connection disappears. I need to power cycle the RPi, and then it’s up and running again.

I say “after 24 hours or so” because I’ll be using the RPi one day (it drives my headphones in Roon), but when I come to use it again the next day, the RPi will have disappeared from Roon because the WiFi has gone (I can’t ping the RPi or PuTTY into it). So I have to power cycle the RPi to get it back again.

This behaviour has existed for at least the last few upgrades of DietPi (Roon shows I’m currently on Linux 4.9.27-v7+).

Is anyone else seeing this? It’s certainly not a showstopper, just a minor irritant, but I would like to get to the bottom of it. If no-one else is seeing it, I’ll try switching to the IQaudIO Roon Ready image (the RPi has an IQaudIO DAC+) to see if that makes a difference.

DHCP? Lease expiry perhaps? Just thinking out loud really.

1 Like

Good thought. It might well be that. The DHCP server I have running in the home network does indeed have a lease expiry time of 24 hours. All the other devices in the network seem to be able to renew their leases without a problem, but this RPi perhaps has an issue?

Hi Geoff,

To see if the DHCP lease is the cause:

  • Try setting a static IP for the RPi in dietpi-config > Networking > WiFi.

Thanks Dan. I’ve changed it to static, and will report back in a day or two.

1 Like

I’ve had my RPi 3 configured for a static IP for months (dietPi, IQaudIO HAT), and it seems to drop WiFi less than once per week (maybe much less). Overall, it seems more stable than even having the router assign a reserved fixed DHCP IP address to the Pi. For good measure, my RPi2 (dietPi, HifiBerry HAT) on Ethernet is also configured for static IP.

1 Like

Well, with a static IP, the RPi 3 has not yet fallen off its WiFi perch, so I tentatively assume that indeed there may be some issue caused by renewing an expired DHCP lease.

1 Like

Ah well, spoke too soon - it took more than a day, but the RPi 3 did finally fall off its perch. It needed a power reboot to get it back again. Not sure what’s going on here…

Are the logs of the OS showing anything? This is an issue ether at the OS or Hardware, ether way most likely can be shown at the logs :slight_smile:

Um, this is Linux, and I’m a Linux novice - no idea where to find the logs or what I should be looking for…

They are under /var/log
To my understanding DietPi does not log files like a normal system does… for issues like this it can be hard to catch… I can tell you for sure that there is other users using DietPi on a Pi 3 with no wifi issues (That I know of)


By the way I think the best person to help u with this is @Dan_Knight :smiley:

Could be related to router, possibly its flushing WiFi/active connections every 24h. If you are able, check the web interface for router and its logs, also the uptime.

On the DietPi system, after the WiFi is dropped, we can check a few items, however, you will need terminal access to the system (eg: keyboard + HDMI):

dmesg | grep wlan
dmesg | grep brcm
ifconfig -a

OK, thanks Dan. I’ll wait until it happens again, and then connect a keyboard/monitor to poke around.

The internal home network (and DHCP service) is provided by a Sophos UTM 9 setup running in a Windows VM. I have UTM 9 running because I have two internet connections (to two ISPs) running; one a slow ADSL connection, supplemented by a 4G connection. I expect that the UTM 9 will indeed be flushing connections upon lease expiry.

Mine won’t reconnect after a power flash/outage. I think it comes un before the router and then won’t connect. Rebooting solves the problem.

Change to use a different WiFi channel in the router. Normally people recommend using either 1, 6, or 11, but for experiment purpose look at any free WiFi analyzer app result on a smartphone, and try any channel between 1-11.

If you have a region setting in the router WiFi setup, make sure it is USA.

That’s not the issue.
a) I already use a channel that has no other traffic on it.
b) I’m living in the Dutch countryside, with no other strong WiFi signals in the neighbourhood.
c) None of the other WiFi devices in our household have this issue.

Unless there’s an issue with the charger (and this may be a possibility) there have been no brownouts or outages that I’m aware of.

Yeah. I’m thinking that if the wifi signal drops from the router other devices can pick it back up, but if the DIetPi looks for it and can’t find it, it’s toast.

@Dan_Knight - The RPi fell off its perch again, and I ran the commands you listed via a directly attached keyboard. Wasn’t sure how to capture the output, so I took a photo of the monitor…

Does this tell you anything? Thanks

Yep, looks like the WiFi adapter has lost its IP address. Most likely the WiFi router dropped the connection at some point.

I’ve been running a RPi Zero W for a week on WiFi, hasn’t dropped yet on my network.

What make/model of router are you using? And, are you able to post its web interface logs for the last few days? May provide us with some answers :slight_smile:

I’ve made a script that will monitor WiFi connection every 20 seconds. If no ping is received, adapter is dropped and reinitialized.

  • Save script to /etc/dietpi/dietpi-wifi-monitor.sh

URL_PING='www.google.com' #Ideally, change this to your routers IP address

while true

	/DietPi/dietpi/func/dietpi-notify 2 "Checking connnection for: $ADAPTER"
		ping -I $ADAPTER -c 1 $URL_PING
		if (( $? != 0 )); then

			/DietPi/dietpi/func/dietpi-notify 2 "Detected connection loss: $ADAPTER. Reconnecting"
			ifdown "$ADAPTER"
			sleep 1
			ifup "$ADAPTER"
			/DietPi/dietpi/func/dietpi-notify 0 'Completed'


			/DietPi/dietpi/func/dietpi-notify 0 "Connection $ADAPTER"


		sleep $TICKRATE


	exit 0

  • Enable execute:
chmod +x  /etc/dietpi/dietpi-wifi-monitor.sh
  • Install/Start service (copy + paste all):
cat << _EOF_ > /etc/systemd/system/dietpi-wifi-monitor.service
Description=Monitors loss of WiFi connection and automatically reconnects
After=network.target network-online.target


ExecStart=/bin/bash -c /etc/dietpi/dietpi-wifi-monitor.sh

systemctl daemon-reload
systemctl enable dietpi-wifi-monitor.service
systemctl start dietpi-wifi-monitor.service
  • You can check status with:
systemctl status dietpi-wifi-monitor.service -l

I’ve tested the above with RPi Zero W, works a treat.