154
@yaml_yeoman ·

Pi Zero 2 W drops off wifi after a few hours until I power cycle it Headless Setup

It runs a camera timelapse script and I only reach it over SSH. It stays reachable for three to six hours, then vanishes: ping fails, the mDNS name is gone, nothing. The script keeps writing image files the entire time, so the Pi itself is clearly alive and happy. Pulling power brings it straight back. Router is a stock ISP box on 2.4GHz and signal at the shelf is around -62dBm.

9 answers Share
Report

Answering anonymously — a moderator will review it first.

  • @headless_hugo · 3mo ago · 3 replies

    Power save on the wifi chip. Check it with iw dev wlan0 get power_save and I would bet money it says on.

    Turning it off with iw dev wlan0 set power_save off will confirm the diagnosis within an evening, but that does not survive a reboot. Make it stick with a tiny systemd unit that runs the same command after the network is up, or if you are on NetworkManager set wifi.powersave = 2 in a file under /etc/NetworkManager/conf.d/.

    The reason it looks like the Pi died is that the chip goes into a deep sleep and then fails to wake for beacons, so the router quietly ages it out of the association table. Nothing on the Pi notices because nothing on the Pi was trying to talk.

    198
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
    • @refresh_rhea · 3mo ago

      This was exactly my problem, with one addition: I put the command in /etc/rc.local and it silently stopped working after a distribution upgrade. The systemd unit version has survived two upgrades since.

      63
      Share
      Reply

      Answering anonymously — a moderator will review it first.

      Report
    • @trace_tilly · 3mo ago

      If it still drops after that, look at roaming. If you have a mesh or an extender using the same SSID, the Zero 2 clings to a weak radio rather than moving, and -62dBm at the shelf could be the far access point.

      21
      Share
      Reply

      Answering anonymously — a moderator will review it first.

      Report
  • @crashloop_cara · 3mo ago · 2 replies

    Second thing to rule out is DHCP. Some ISP routers hand out short leases and the Zero 2 sometimes fails the renewal after a sleep, then sits there with no address while everything else on the board carries on. Give it a static reservation on the router side, not a static IP on the Pi, and see if the pattern changes.

    121
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
    • @little_endian_lu · 3mo ago

      Easy to confirm after the fact: journalctl -u dhcpcd --since "2 hours ago" right after you power cycle it. If you see renewal attempts with no reply at the time it vanished, that is your answer.

      40
      Share
      Reply

      Answering anonymously — a moderator will review it first.

      Report
  • @deadbug_wiring · 3mo ago · 2 replies

    Do not rule out power just because the CPU stays up. Wifi transmit bursts are where the current spikes, and a thin micro USB cable dropping half a volt will crash the wifi firmware while the rest of the board carries on writing files. That matches your symptom better than most software explanations. Try a short thick cable and a supply you trust before you go deeper.

    74
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
    • @logfile_lena · 3mo ago

      Cheap test for this: run dmesg -w in a screen session on the Pi and leave it. If the wifi firmware falls over you will usually see the driver complaining right at the moment it goes silent, and that tells you it is not the router.

      33
      Share
      Reply

      Answering anonymously — a moderator will review it first.

      Report
  • @null_pointer_ok · 3mo ago

    Bandaid while you find the real cause: a cron job every five minutes that pings the gateway three times and, on failure, bounces the interface, then reboots if that fails twice in a row. Not elegant, but a timelapse with a six hour hole in it is worse.

    38
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
  • @rest_day_rita · 3mo ago

    If the shelf is anywhere near a cable run, a USB ethernet adapter on the OTG port is about eight dollars and takes wifi out of the equation entirely. Worth it for anything unattended.

    12
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report