12

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?

user8292439
  • 3,808
  • Are you still having problems with this? What version of Ubuntu are you using? What happens if you try connecting to a tether on your phone? – xiota May 13 '18 at 23:04

7 Answers7

5

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"
lisrael1
  • 151
  • This is what worked for me using a j5create ralink usb wifi connector - https://www.staples.com/J-5-Create-Wireless-11N-USB-Mini-Adapter/product_2495870. lsusb shows this - Bus 001 Device 005: ID 148f:7601 Ralink Technology, Corp. MT7601U Wireless Adapter. – slm Jul 27 '20 at 05:15
  • This worked for me using nokia n900 + postmarketos – rapto Nov 30 '21 at 07:39
1

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 __ap

to 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.

user8292439
  • 3,808
0

Try this without password

sudo nmcli dev wifi connect "SSID"
SkruDJ
  • 1
0

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.

dirdi
  • 105
  • Hello. You answer implies this only works for a few days? – David Mar 31 '22 at 10:13
  • The connection is stable since I set it up. However, this was only a few days ago, so I got no long-time experience, yet. Feel free to edit my answer. – dirdi Mar 31 '22 at 14:48
0

I 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.conf

Then 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.

0

I solved my problem by just turn your system in sleep mode then again turn it on this solve my problem without restart

0

I was unexpectedly getting this issue which was strange. I was adding a wifi network programmatically with python e.g

os.system("nmcli r wifi on")
os.system("nmcli dev wifi rescan")
os.system("nmcli d wifi connect myssid password mypass") 

It was a race condition where I needed to put some wait time between each command. Works just fine now. Hope this helps someone.

bsautner
  • 169