Stable Wi-Fi on Raspberry Pi
Disable Wi-Fi power saving to address intermittent connection loss on an NQ2 server.
If NQ2 or SSH becomes unreachable over Wi-Fi after the device has been idle, disable Wi-Fi power saving on the Raspberry Pi. On some hardware/driver combinations it can contribute to intermittent connection loss. The Pi may still be running even though it appears offline: losing Wi-Fi is not the same as the whole device shutting down.
For an NQ2 server connected over Wi-Fi, configure this setting during installation. The current NQ2 installer does this automatically on Linux systems using NetworkManager. For a manual installation or a device installed with an older bundle, use the steps below. A computer writing the card does not need this change; apply it on the Raspberry Pi or Linux server that runs NQ2.
When this applies
- Raspberry Pi OS and Ubuntu installations where NetworkManager manages Wi-Fi.
- Connections over Wi-Fi. Ethernet does not use this Wi-Fi setting; no equivalent change is required just because the device uses a cable.
- This changes radio power saving. It does not disable system suspend, fix weak power supplies, or repair incorrect SSIDs/passwords.
1. Check the network manager and interface
Connect to the device over SSH, for example using PuTTY, with its existing Linux account. These commands run on the device, not on the computer preparing the card:
systemctl is-active NetworkManager
nmcli -t -f DEVICE,TYPE,STATE device status
Continue with this guide when NetworkManager reports active and manages your Wi-Fi device. If it is not installed or another service manages the network, do not install or switch network managers just to copy these steps.
Install the diagnostic tool and list wireless interfaces:
sudo apt-get update
sudo apt-get install -y iw
iw dev
The examples use wlan0. If your interface has another name, such as wlp1s0, substitute it in every command below.
2. Save the persistent setting
Create a NetworkManager configuration snippet:
sudo install -d -m 755 /etc/NetworkManager/conf.d
sudo tee /etc/NetworkManager/conf.d/99-nq2-wifi-powersave.conf > /dev/null <<'EOF'
[connection]
wifi.powersave = 2
EOF
sudo chmod 644 /etc/NetworkManager/conf.d/99-nq2-wifi-powersave.conf
sudo nmcli general reload conf
2 means disable Wi-Fi power saving. The file makes this the default for profiles that use the global setting. A profile explicitly configured to enable power saving can override that default; set the active profile explicitly as shown below. See the NetworkManager Wi-Fi property reference and configuration file documentation.
3. Apply to the current Wi-Fi connection
Use the active connection name and set only its power-saving option:
WIFI_CONNECTION=$(nmcli -g GENERAL.CONNECTION device show wlan0)
sudo nmcli connection modify "$WIFI_CONNECTION" 802-11-wireless.powersave 2
sudo iw dev wlan0 set power_save off
Run this while wlan0 is connected to Wi-Fi. If the connection name is empty or --, check the connection before continuing. The NetworkManager profile preserves the setting for later connections; iw applies it immediately to the current interface. This does not change the SSID, password or IP configuration. Do not restart NetworkManager or disconnect Wi-Fi over SSH for this procedure. Configuration reload and the live radio setting are sufficient. See nmcli and the Linux Wireless iw guide.
4. Verify the result
iw dev wlan0 get power_save
nmcli -f 802-11-wireless.powersave connection show "$WIFI_CONNECTION"
cat /etc/NetworkManager/conf.d/99-nq2-wifi-powersave.conf
For a supported interface, iw should report Power save: off. After the manual profile change, NetworkManager should show 2 (disable). The current installer may leave the profile at 0 (default) and set the global file to 2: that also means the profile uses the disabled global default. An iw command alone does not persist the change across reconnects; keep the NetworkManager configuration.
If the device still disconnects
This removes one possible cause of Wi-Fi dropouts; it does not guarantee every connection problem is solved. Check signal strength, the router and the power supply. If the whole Raspberry Pi actually restarts or powers off, investigate its power supply and system logs rather than assuming the Wi-Fi radio setting is responsible. A driver that rejects the iw command needs separate investigation.
Return to Raspberry Pi installation, existing-system installation or manual Linux installation.