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 listand 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?
15 Answers
this one fixed the issue for me -
add this
[device]
wifi.scan-rand-mac-address=noto /etc/NetworkManager/NetworkManager.conf
then run
sudo systemctl restart NetworkManagerthen you can connect to the ssid by
sudo nmcli dev wifi connect "SSID" password "wifipassword" 2 I never found a fix for the issue, but I believe I found the problem. I was using a virtual interface made with
sudo iw dev wlan0 interface add ap0 type __apto host a WiFi network, but ap0 and wlan0 had the same MAC address. Due to a problem with the RPi3 drivers, I couldn't change the MAC address(I tried macchanged -e ap0), but if I figured out how to, I'm pretty sure the issue would have been resolved.
Try this without password
sudo nmcli dev wifi connect "SSID" 1 When I tried to connect a rather old a/b/g WiFi client to a mixed WPA 2 + WPA 3 WiFi network, I stumbled upon this problem, too. I guessed that maybe NM was not able to figure out the right settings for such an environment, so I ran nmcli connection edit <BSSID> and then configured the following settings:
- set connection.metered no
- set 802-11-wireless.band bg
- set 802-11-wireless-security.key-mgmt wpa-psk
(Do not forget to save, before you exit)
Pretty sure the first setting can be ignored, however the connection is stable for several days now and even when I reboot the router or the device, the connection is being reestablished right away.
2I face this issue in the past and tried lost of tips. But this solution worked for me on my Ubuntu 20.04:
Improve WiFi connection by disabling power management for the wireless card
sudo sed -i 's/3/2/' /etc/NetworkManager/conf.d/default-wifi-powersave-on.confThen restart the computer
NB: The Wi-Fi power-saving mode is a built-in mode that allows devices to save power by analyzing the data usage pattern with time and then making sure that the Wi-Fi doesn’t drain too much battery of the device in question. But there is a need to be cautious, too, since this can affect your browsing experience.