nmcli)
This procedure configures and validates Wi‑Fi connectivity on a Raspberry Pi 4 running headless Debian Trixie.
The workflow uses NetworkManager and its CLI tool nmcli, which is suitable for
unattended systems and repeatable deployments.
When troubleshooting headless Wi‑Fi, focus on three layers:
rfkill soft/hard blocks must be cleared.nmcli radio must show Wi‑Fi enabled.wlan0 must be managed and have an active connection profile.nmcli -a for interactive prompts or run commands in a root shell with history disabled.
wlan0)nmcliThis guide assumes you have local console access or a working network path via Ethernet to reach the Pi for initial setup. After Wi‑Fi is configured, Ethernet can be removed if desired.
The following output indicates the Wi‑Fi interface exists and is currently connected via NetworkManager.
fred@8channel:~$ nmcli dev status DEVICE TYPE STATE CONNECTION wlan0 wifi connected xxxxxxx lo loopback connected (externally) lo p2p-dev-wlan0 wifi-p2p disconnected -- eth0 ethernet unavailable --
xxx@xxxx:~$ nmcli dev show wlan0 | egrep 'GENERAL.STATE|GENERAL.MANAGED|GENERAL.DRIVER|GENERAL.FIRMWARE' GENERAL.STATE: 100 (connected)
[ 6.086517] brcmfmac: F1 signature read @0x18000000=0x15264345 [ 6.094348] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6 [ 6.353332] brcmfmac: brcmf_c_process_txcap_blob: no txcap_blob available (err=-2) [ 6.354060] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Aug 29 2023 01:47:08 version 7.45.265 (28bca26 CY) FWID 01-b677b91b
brcmfmac is the Broadcom FullMAC driver used on Pi 4.
The log shows firmware was selected and initialized, and the interface is operational.
Install packages and enable NetworkManager:
sudo apt update sudo apt install -y network-manager iw rfkill sudo systemctl enable --now NetworkManager nmcli general status
Clear soft blocks, bring the interface up, and ensure NetworkManager radios are enabled:
rfkill list sudo rfkill unblock wifi sudo ip link set wlan0 up sudo nmcli networking on sudo nmcli radio wifi on nmcli radio all
If Wi‑Fi is still “unavailable”, proceed to the management checks in the next section.
wlan0nmcli dev status nmcli dev show wlan0 | egrep 'GENERAL.STATE|GENERAL.MANAGED'
If you see GENERAL.MANAGED: no, NetworkManager is not controlling the interface (often due to legacy
ifupdown / /etc/network/interfaces configuration).
sudo nano /etc/NetworkManager/NetworkManager.conf
[ifupdown] managed=true
sudo systemctl restart NetworkManager
/etc/network/interfaces contains a stanza for wlan0,
NetworkManager may continue to treat the device as unmanaged. Comment out that stanza or migrate the configuration into NetworkManager.
nmclisudo nmcli dev wifi rescan nmcli dev wifi list --rescan yes
Connect to a network and automatically create a persistent connection profile:
nmcli dev wifi connect "YOUR_SSID" password "YOUR_PASSWORD" ifname wlan0
nmcli -a dev wifi connect "YOUR_SSID" ifname wlan0
sudo nmcli con add type wifi ifname wlan0 con-name "wifi-hidden" ssid "YOUR_SSID" sudo nmcli con modify "wifi-hidden" wifi.hidden yes sudo nmcli con modify "wifi-hidden" wifi-sec.key-mgmt wpa-psk sudo nmcli con modify "wifi-hidden" wifi-sec.psk "YOUR_PASSWORD" sudo nmcli con up "wifi-hidden"
nmcli -p con show --active ip -br addr show wlan0
ping -c 3 1.1.1.1 ping -c 3 debian.org
wlan0 shows an IPv4 address, ping to an IP succeeds, and ping to a hostname succeeds.
nmcli con show nmcli con modify "YOUR_SSID" connection.autoconnect yes nmcli con up "YOUR_SSID"
Higher values win if multiple connections are eligible:
nmcli con modify "YOUR_SSID" connection.autoconnect-priority 50
journalctl -u NetworkManager --no-pager -n 200 nmcli general logging
Some Pi deployments prefer disabling Wi‑Fi power saving to reduce latency spikes or intermittent drops. Your dmesg indicates power save is enabled:
[156349.676507] brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled
If you observe stability issues, mention your usage (interactive touchscreen / kiosk / low‑latency control) and we can select the correct persistent method for your Debian Trixie image.
nmcli dev statusrfkill list sudo rfkill unblock wifi
nmcli radio all sudo nmcli radio wifi on
ip -br link show wlan0 sudo ip link set wlan0 up
sudo iw dev wlan0 scan | head -n 40
dmesg | egrep -i 'brcm|brcmfmac|wlan0|firmware' | tail -n 120
Enable NM management via managed=true and remove conflicting legacy configuration (Section 5.2).
nmcli general status nmcli dev status nmcli dev show wlan0 nmcli -p con show --active rfkill list ip -br addr journalctl -u NetworkManager --no-pager -n 200
sudo nmcli dev wifi rescan nmcli dev wifi list --rescan yes nmcli -a dev wifi connect "YOUR_SSID" ifname wlan0
nmcli con show nmcli con down "YOUR_SSID" nmcli con delete "YOUR_SSID" nmcli -a dev wifi connect "YOUR_SSID" ifname wlan0
Original technical content: Validus Group Inc. This web edition is maintained in the North Rivet Technical Library.
Author: Fred Fisher - President, Validus Group Inc.; Founder & Principal Engineer, North Rivet.
North Rivet develops practical engineering software for real equipment. Validus Group Inc. provides industrial engineering, automation, and precision manufacturing expertise.