1

I have several Pi Zero W all with the latest Rasbian, running headless. After a few hours I lose the ability to contact them via WiFi or SSH, they are however still running as logs show. Basically I have to reboot them at the power plug. I have swapped SD cards around and power adaptors - I'm sure it's a software setting

I have edited /etc/network/interfaces to include the line wireless-power off and iwconfig | grep "Power Management" shows “Power Management:off” but this has no effect

If its any help I am running them on static IP sudo nano /etc/dhcpcd.conf

interface wlan0

static ip_address=192.168.0.xxx/24 static routers=192.168.0.1 static domain_name_servers=192.168.0.1

Any help gratefully received. Thanks

===

Rubberstamp - Thanks for the help: with journalctl I get No journal files were found. I can see results in cat /var/log/auth.log (but i have no idea what to look for) and systemctl status dhcpcd (the unit has not shut off reads

dhcpcd.service - dhcpcd on all interfaces Loaded: loaded (/lib/systemd/system/dhcpcd.service; enabled) Active: active (running) since Sun 2017-11-26 18:57:12 GMT; 1h 38min ago Process: 371 ExecStart=/sbin/dhcpcd -q -b (code=exited, status=0/SUCCESS) Main PID: 382 (dhcpcd) CGroup: /system.slice/dhcpcd.service └─382 /sbin/dhcpcd -q -b**.

I'm afraid this is all a bit above my pay grade, so thanks for bearing with me

2 Answers2

1

I had the same problems.

Here is what I fond out and how I worked around the loss of wifi

  1. Create errors touch /home/pi/errors
  2. Create /home/pi/resetwifi.sh

    #!/bin/sh
    ping -c1 "yourroutersip"
    if [ $? != 0 ]
    then
      sudo ifconfig wlan0 down
      date >> /home/pi/errors  
      sleep 5
      sudo ifconfig wlan0 up
    fi
  3. Add entry to run every 5 min in crontab

    crontab -e 
    5 * * * * /home/pi/resetwifi.sh

The errors file shows that my wlan0 is shutting down every hour. I don't know why

MatsK
  • 2,478
  • 3
  • 12
  • 20
user99367
  • 11
  • 1
0

I was facing the same problem with rpi0w, it was losing wifi every 2 hours or so. I figured out that the problem was DHCP by looking in the /var/log/syslog, I disabled dhcpd and enabled network interfaces in rpi0w and it has never lost wifi since then. I followed the answer here to configure this and basically involves two steps:

  1. Configure a static network adddress on your Pi in /etc/network/interfaces
  2. Disable the DHCP client daemon and switch to standard Debian networking