Fix NMCLI WiFi Network Not Found Issue

network-managernmcli

I'm running a headless device that I want to connect to wifi(it's currently on ethernet), so I'm using nmcli. I scan for connections with the following:

sudo nmcli dev wifi rescan
sudo nmcli dev wifi list

and the WiFi network I want is at 95% strength. So, I connect with:

sudo nmcli dev wifi connect "SSID" password "wifipassword"

and I get the following error:

Error: Connection activation failed: (53) The Wi-Fi network could not be found.

and I've tried copying and pasting from list to ensure I did not mistype the SSID, and it still does not work. It works fine from other devices that use Ubuntu and network-manager, so I know it's not the router.

How can it not find the network when I connect, but find it just fine when scanning, and how do I fix this?

Best Answer

this one fixed the issue for me - https://unix.stackexchange.com/a/519620/407616
add this

[device]
wifi.scan-rand-mac-address=no

to /etc/NetworkManager/NetworkManager.conf
then run

sudo systemctl restart NetworkManager

then you can connect to the ssid by

sudo nmcli dev wifi connect "SSID" password "wifipassword"
Related Question