I had the same exact problem with the same error code wlan0: CTRL-EVENT-DISCONNECTED bssid=<redacted> reason=4 locally_generated=1 and after days of research I found out that Rpi does not send ACK acknowledge reply back to the router for empty beacons. After some interval the router tries to see if RPi is online and sends an empty beacon and RPi should supposed to reply back, which it does not do and when happens (Every few minutes) the router disconnects the RPi which is why you see the error code.
Even disabling the power management does not work (/sbin/iwconfig wlan0 power off) as you saw, I tried it too and did not work.
The only solution that worked for me was to ping the router every 5 minutes.
Edit cronPaste the following for new cron job (Change the router IP 192.1688.1.1 if yours is different)Save and exit.
Since I did that my Raspberry pi zero 2W has not disconnected in a week now, not even a single time.
Raspberry Pi needs to fix the issue by replying to router requests.
Let me know if it works.
Even disabling the power management does not work (/sbin/iwconfig wlan0 power off) as you saw, I tried it too and did not work.
The only solution that worked for me was to ping the router every 5 minutes.
Edit cron
Code:
crontab -eCode:
*/5 * * * * ping -q -c 1 -W 1 -I wlan0 192.168.1.1 2>&1 > /dev/nullSince I did that my Raspberry pi zero 2W has not disconnected in a week now, not even a single time.
Raspberry Pi needs to fix the issue by replying to router requests.
Let me know if it works.
Statistics: Posted by saud — Sun Nov 30, 2025 3:30 am