HypnoToad
Posts: 57
Joined: Thu Dec 11, 2014 6:00 pm

My Rpi wifi access point stops working after 7 days/1 week.

Thu May 16, 2019 1:14 am

Hi, I've got a bit of an odd issue, I have a RPi2 along with a USB wifi adaptor, and I've got it set up to allow Wifi network access, and the RPi is connected to my LAN with an Ethernet cable.

I used the official guide here: https://www.raspberrypi.org/documentati ... et-sharing

And is all works great, however after exactly 7 days the Wifi devices connected to the RPi simply disconnect from the LAN. I have some Home Automation software that logs devices on the network into a database. When the uptime on the Pi is 7days+2hours, I can see that the wifi devices disconnected 2hours ago.

Once I reboot the devices appear on the network again, it's all very odd. I'm still able to access the Pi on the LAN OK using SSH.

Is there a way I can fix this issue so it does not need a weekly reboot?

epoch1970
Posts: 2758
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: My Rpi wifi access point stops working after 7 days/1 week.

Thu May 16, 2019 11:43 am

Does it happen in the wee hours of day 7?
If so, I would definitely look into /etc/cron.d/weekly (or crontab) on the Pi that runs the AP.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

HypnoToad
Posts: 57
Joined: Thu Dec 11, 2014 6:00 pm

Re: My Rpi wifi access point stops working after 7 days/1 week.

Fri May 17, 2019 3:18 pm

epoch1970 wrote:
Thu May 16, 2019 11:43 am
Does it happen in the wee hours of day 7?
Once the Uptime goes over 7 days, the Wifi devices that are connected to the RPi access point simply disconnect from the LAN, they are no longer accessable. I can still access the RPi over SSH however, the ethernet connection does not fail.

I was thinking it maybe some sort of lease time issue? I'm not a network guru so am guessing at this point. I've also checked the power saving options for my Wifi settings, and I've tried to disable all forms of power saving/sleep.

EDIT: Most of the wifi devices connected are Sonoff IOT switches flashes with Tasmota firmware.

I'm using the same Sonoff swiches on my 'main' wifi network provided by my router, and these stay connected for over 1 week without issue.
epoch1970 wrote:
Thu May 16, 2019 11:43 am
If so, I would definitely look into /etc/cron.d/weekly (or crontab) on the Pi that runs the AP.
Thanks, I've looked at the cron jobs and there are no cron jobs at all.
Last edited by HypnoToad on Fri May 17, 2019 3:25 pm, edited 1 time in total.

epoch1970
Posts: 2758
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: My Rpi wifi access point stops working after 7 days/1 week.

Fri May 17, 2019 3:24 pm

Which OS is that? Raspbian Stretch?
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

HypnoToad
Posts: 57
Joined: Thu Dec 11, 2014 6:00 pm

Re: My Rpi wifi access point stops working after 7 days/1 week.

Fri May 17, 2019 3:29 pm

epoch1970 wrote:
Fri May 17, 2019 3:24 pm
Which OS is that? Raspbian Stretch?
Yep, Raspbian GNU/Linux 9 (stretch), I've kept it up to date.

Here's the kernel version:

Linux 4.14.84-v7+ #1169 SMP Thu Nov 29 16:20:43 GMT 2018 armv7l GNU/Linux

I'm using a good SD card and the official PSU.

The uptime is around 2 days so will have to wait 5 more days before I can expect the devices to disconnect again.

B.Goode
Posts: 7679
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: My Rpi wifi access point stops working after 7 days/1 week.

Fri May 17, 2019 3:42 pm

An expired lease was my first guess, as you suggest.

But if you have used the Raspberry Pi Foundation documentation faithfully, the DHCP lease is for 24 hours:
Type or copy the following information into the dnsmasq configuration file and save it:

interface=wlan0 # Use the require wireless interface - usually wlan0
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
So for wlan0, we are going to provide IP addresses between 192.168.4.2 and 192.168.4.20, with a lease time of 24 hours.


So I don't have anything to contribute to why it fails after a week, not day. But I thought I would point out where it is configured.

epoch1970
Posts: 2758
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: My Rpi wifi access point stops working after 7 days/1 week.

Fri May 17, 2019 5:56 pm

Raspbian/Debian comes with administrative tasks defined in /etc/cron.hourly | .daily | .weekly | .monthly
Most of these tasks run early in the morning.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

User avatar
default_user8
Posts: 644
Joined: Mon Nov 18, 2013 3:11 am

Re: My Rpi wifi access point stops working after 7 days/1 week.

Sun May 19, 2019 11:12 am

HypnoToad wrote:
Thu May 16, 2019 1:14 am
Hi, I've got a bit of an odd issue, I have a RPi2 along with a USB wifi adaptor, and I've got it set up to allow Wifi network access, and the RPi is connected to my LAN with an Ethernet cable.

I used the official guide here: https://www.raspberrypi.org/documentati ... et-sharing

And is all works great, however after exactly 7 days the Wifi devices connected to the RPi simply disconnect from the LAN. I have some Home Automation software that logs devices on the network into a database. When the uptime on the Pi is 7days+2hours, I can see that the wifi devices disconnected 2hours ago.

Once I reboot the devices appear on the network again, it's all very odd. I'm still able to access the Pi on the LAN OK using SSH.

Is there a way I can fix this issue so it does not need a weekly reboot?
Although this isn't an actual fix or explanation it is a work around that should work for you. Just make sure you set the cron job to run before the 7 days + 2 hours you are reporting as your failure rate.
https://www.raspberrypi.org/forums/view ... hp?t=75137
Two heads are better than one, unless one's a goat head.

HypnoToad
Posts: 57
Joined: Thu Dec 11, 2014 6:00 pm

Re: My Rpi wifi access point stops working after 7 days/1 week.

Tue May 21, 2019 10:18 pm

epoch1970 wrote:
Fri May 17, 2019 5:56 pm
Raspbian/Debian comes with administrative tasks defined in /etc/cron.hourly | .daily | .weekly | .monthly
Most of these tasks run early in the morning.
Thanks, I've had a look in these folders and there are quite a few files, mainly related to 'pi-hole' software which is also installed on this Pi; I should have mentioned this in the original post.

However the only weekly job is /etc/cron.weekly/man-db which seems to something to do with the man database, nothing networking related.
default_user8 wrote:
Sun May 19, 2019 11:12 am
Although this isn't an actual fix or explanation it is a work around that should work for you. Just make sure you set the cron job to run before the 7 days + 2 hours you are reporting as your failure rate.
viewtopic.php?t=75137
Thanks I do have something similar to this in where the Pi reports it's uptime over MQTT. I've got another Pi running HomeAssistant software that will send me an alert when the uptime goes over 7 days.
B.Goode wrote:
Fri May 17, 2019 3:42 pm
An expired lease was my first guess, as you suggest.

But if you have used the Raspberry Pi Foundation documentation faithfully, the DHCP lease is for 24 hours:
Type or copy the following information into the dnsmasq configuration file and save it:

interface=wlan0 # Use the require wireless interface - usually wlan0
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
So for wlan0, we are going to provide IP addresses between 192.168.4.2 and 192.168.4.20, with a lease time of 24 hours.


So I don't have anything to contribute to why it fails after a week, not day. But I thought I would point out where it is configured.
Thanks, In fact this does help me quite a bit.

I went back and checked out all the config files from the guide it turns out that the 'Pi-Hole' installer has actually overwritten my '/etc/dnsmasq.conf' file with it's own, so I'm amazed my Wifi devices are connecting at all! I'm now going to remove Pi-Hole, redo all the steps from the guide, reboot and see if it now stays working for more than 1 week. :)

Hopefully it was just Pi-Hole causing this, I didn't realise the installer just wipes over your config files without warning. :shock:

Return to “Networking and servers”