Fix hanging SSH connections to the Raspberry Pi Zero 2 W
A strange choice for a default setting in Raspberry Pi OS can make connecting to a Raspberry Pi Zero 2 W more frustrating than it needs to be.
Although the Raspberry Pi Imager tool allows you to write the OS to an SD card with options to preconfigure Wi-Fi and enable SSH, after booting you may find that SSH connections hang or freeze frequently.
The reason this happens is because Wi-Fi power saving is enabled by default. This mode causes the wireless chip to power down between network requests.
If you want to check if Wi-Fi power saving is enabled or disabled, run:
$ sudo iw wlan0 get power_save
Power save: offYou can modify the above command to set power_save off but it won’t persist when you reboot the device.
To disable Wi-Fi power saving permanently, run:
$ sudo nmcli connection modify preconfigured wifi.powersave disable