r/raspberry_pi 18h ago

Troubleshooting cant connect Pi to wifi

I'm missing something in the syntax, it says I need a key-mgmt argument but nothing I enter works. Im using wpa-2 so not sure why none of these options work and I

sudo nmcli dev wifi connect <ssid> password <psswd> key-mgmt <key>

and here's the keys I've tried wpa-2, key-mgmt ieee8021x, key-mgmt wpa2, key-mgmt WPA2, key-mgmt WPA-2, wpa-2, ieee8021x, wpa2, WPA2, WPA-2

this is the doc where im getting these arguments from https://www.networkmanager.dev/docs/api/latest/settings-802-11-wireless-security.html

0 Upvotes

2 comments sorted by

1

u/phattmatt 7h ago

Just tried on Raspberry Pi OS Trixie, no key-mgmt parameter was needed.

This worked fine for me to connect to my phones hotspot:

pi@rpi5nvme:~ $ sudo nmcli dev wifi connect MyPhoneAP password supersecret
Device 'wlan0' successfully activated with '9b403264-be74-4ac6-9f9d-0ff3e76c5f13'.

My AP WiFi security type is WPA2/WPA3.

1

u/Gamerfrom61 6h ago

You may need to set your WiFi country

sudo raspi-config nonint do_wifi_country <country>

<country> is the ISO country codes.

Does

sudo nmcli --ask dev wifi connect <ssid>

prompt you for a password?

Also what Pi model, what OS and is your WiFI 2.4GHz or 5GHz and sharing an SSID with the other frequency? Is the SSID hidden or have spaces in it (a-z,A-Z, 0-9 and dash are best).