Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
17
votes
1
answers
2588
views
wpa_supplicant end process if wrong password detected
Normally when I run `wpa_supplicant` I'll get some output like this: Successfully initialized wpa_supplicant ioctl[SIOCSIWAP]: Operation not permitted ioctl[SIOCSIWENCODEEXT]: Invalid argument ioctl[SIOCSIWENCODEEXT]: Invalid argument wlan3: Trying to associate with 9c:3d:cf:fb:95:96 (SSID='Bell420'...
Normally when I run
wpa_supplicant
I'll get some output like this:
Successfully initialized wpa_supplicant
ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
wlan3: Trying to associate with 9c:3d:cf:fb:95:96 (SSID='Bell420' freq=2462 MHz)
wlan3: Association request to the driver failed
wlan3: Associated with 9c:3d:cf:fb:95:96
wlan3: Authentication with 9c:3d:cf:fb:95:96 timed out.
ioctl[SIOCSIWAP]: Operation not permitted
wlan3: CTRL-EVENT-DISCONNECTED bssid=9c:3d:cf:fb:95:96 reason=3 locally_generated=1
wlan3: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
The problem is it just keeps trying over and over.
Is there a way I can tell wpa_supplicant
to quit as soon as it gets an obvious error like wrong key?
*I'm on an older embedded device with wpa_supplicant v2.1
.*
----------
I wrote a workaround for monitoring wpa_supplicant
for incorrect keys. Using grep
on wpa_supplicant
(with stdbuf
based on Stéphane Chazelas' comment here ):
# Create conf file with ssid and password
wpa_passphrase "$ssid" "$password" > /etc/wpa_supplicant/wpa_supplicant.conf
# If wifi key is wrong kill subshell
subshell=$BASHPID
(sudo stdbuf -o0 wpa_supplicant -Dwext -iwlan1 -c/etc/wpa_supplicant/wpa_supplicant.conf 2>&1 \
| grep -m 1 "pre-shared key may be incorrect" \
&& kill -s PIPE "$subshell") &
*Note: the above block is inside a subshell in a script.*
It seemed to work initially but over time I found sometimes it would cause the whole script to fail when the password was fine. Other times it would work as expected.
There must be a better way to do this.
----------
*Edit: Maybe I should be using wpa_cli
here instead?*
Philip Kirkbride
(10746 rep)
Nov 26, 2017, 09:50 PM
• Last activity: Aug 4, 2025, 12:04 PM
0
votes
0
answers
27
views
wpa_cli saves network configurations in an invalid format when attempting to write to the configuration file
I’m trying to manage my wireless LAN interface using wpa_supplicant on my i.MX8 running Yocto Scarthgap. I can scan for available networks and connect successfully using the wpa_cli utility. However, when I try to save the current network configuration to the .conf file to persist it, wpa_supplicant...
I’m trying to manage my wireless LAN interface using wpa_supplicant on my i.MX8 running Yocto Scarthgap. I can scan for available networks and connect successfully using the wpa_cli utility. However, when I try to save the current network configuration to the .conf file to persist it, wpa_supplicant fails to start on reboot due to an incorrect file format.
Steps I followed before reboot to connect to an AP
> add_network
0
CTRL-EVENT-NETWORK-ADDED 0
> > set_network 0 ssid "MyNetwork"
OK
> set_network 0 psk "MyPassPhrase"
OK
> enable_network 0
OK
CTRL-EVENT-SCAN-STARTED
CTRL-EVENT-SCAN-RESULTS
Trying to associate with SSID 'MyNetwork'
.....
CTRL-EVENT-CONNECTED - Connection to xxxxxx completed [id=0 id_str=]
> > save_config
OK
> quit
This is what my .conf file in /etc/wpa_supplicant/wpa_supplicant-wlan0.conf looks like after I run save_config
.
ctrl_interface=/run/wpa_supplicant
ctrl_interface_group=wheel
update_config=1
filter_ssids=1
ignore_old_scan_res=1
network={
ssid="MyNetwork"
psk=*
}
On reboot systemd failed to start wpa_supplicant service
root@imx8qxp:~# journalctl -xe -u wpa_supplicant@wlan0.service
Jul 09 16:03:46 imx8qxp systemd: Started WPA supplicant daemon (interface-specific version).
-- Subject: A start job for unit wpa_supplicant@wlan0.service has finished successfully
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- A start job for unit wpa_supplicant@wlan0.service has finished successfully.
--
-- The job identifier is 100.
Jul 09 16:03:46 imx8qxp systemd: wpa_supplicant@wlan0.service: Main process exited, code=exited, status=255/EXCEPTION
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- An ExecStart= process belonging to unit wpa_supplicant@wlan0.service has exited. -- -- The process' exit code is 'exited' and its exit status is 255.
Jul 09 16:03:46 imx8qxp systemd: wpa_supplicant@wlan0.service: Failed with result 'exit-code'. -- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The unit wpa_supplicant@wlan0.service has entered the 'failed' state with result 'exit-code'.
On further investigation by trying to start wpa_supplicant manually
root@imx8qxp:~# wpa_supplicant -B -dd -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
Line 9: Invalid PSK '*'.
Line 9: failed to parse psk '*'.
Line 10: failed to parse network block.
Failed to read or parse configuration '/etc/wpa_supplicant/wpa_supplicant-wlan0.conf'.
I did try to manually generate the passphrase using the command wpa_passphrase SSID PASSWORD > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
and there were no issues with it after reboot. I get this error only when trying to save network config from wpa_cli. I also tried recreating it on an ubuntu 24 machine but could not successfully reproduce the issue.
While the obvious solution is to use wpa_passphrase
directly, I'm interested in understanding why this issue occurs in the first place. Despite searching online, I haven’t come across anyone experiencing this exact problem. Could it be that I’m missing a step when saving the network configuration using wpa_cli
? What causes this behaviour, and is there a correct way to persist network settings without manually trying to write to the file? I don't prefer using the wpa_passphrase
command because I ultimately want to use wpa_ctrl C APIs and would not prefer messing with the .conf files in the application layer.
Meghana
(1 rep)
Aug 1, 2025, 09:11 AM
• Last activity: Aug 1, 2025, 09:22 AM
0
votes
0
answers
24
views
The "dbus_connection_read_write_dispatch" is better to be invoked from timer or thread?
Not sure how wpa_supplicant is using the "dbus_connection_read_write_dispatch" API while it communicate with NetworkManager? Should I use "dbus_connection_read_write_dispatch" API driven from timer or the thread for my RPI system which would be better option in terms of overall performance point of...
Not sure how wpa_supplicant is using the "dbus_connection_read_write_dispatch" API while it communicate with NetworkManager?
Should I use "dbus_connection_read_write_dispatch" API driven from timer or the thread for my RPI system which would be better option in terms of overall performance point of view? Please guide.
Thanks,
Vikas
VikHere
(3 rep)
Jan 14, 2025, 07:25 PM
0
votes
0
answers
170
views
Unstable WI-FI on Intel Alder Lake network card
For some weeks now, I have a Dell XPS 13 2022 with the following network card : `Intel Alder Lake-P PCH CNVi WiFi` ``` $ lshw -C network *-network description: Interface réseau sans fil produit: Alder Lake-P PCH CNVi WiFi fabriquant: Intel Corporation identifiant matériel: 14.3 information...
For some weeks now, I have a Dell XPS 13 2022 with the following network card :
Intel Alder Lake-P PCH CNVi WiFi
$ lshw -C network
*-network
description: Interface réseau sans fil
produit: Alder Lake-P PCH CNVi WiFi
fabriquant: Intel Corporation
identifiant matériel: 14.3
information bus: pci@0000:00:14.3
nom logique: wlp0s20f3
version: 01
numéro de série: a0:02:a5:9e:9d:41
bits: 64 bits
horloge: 33MHz
fonctionnalités: pm msi pciexpress msix bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=iwlwifi driverversion=6.6.59_1 firmware=83.e8f84e98.0 so-a0-gf-a0-83.uc ip=192.168.1.47 latency=0 link=yes
multicast=yes wireless=IEEE 802.11
ressources: mémoireE/S:600-5ff irq:16 mémoire:607a294000-607a297fff
And since the beginning, I have a very unstable connectivity. I use the same SSID/router/software to connect to WI-FI (actually wpa_cli
) than my previous laptop, on the same GNU/Linux distrib (void linux
) and in the previous one I had no issues like this. It disconnects randomly, and take a long time of trials and errors before catching a connection again.
Here is a sample of the wpa_cli
output :
CTRL-EVENT-NETWORK-NOT-FOUND
CTRL-EVENT-SCAN-STARTED
CTRL-EVENT-SCAN-RESULTS
WPS-AP-AVAILABLE
CTRL-EVENT-NETWORK-NOT-FOUND
CTRL-EVENT-SCAN-STARTED
CTRL-EVENT-SCAN-RESULTS
WPS-AP-AVAILABLE
CTRL-EVENT-NETWORK-NOT-FOUND
CTRL-EVENT-SCAN-RESULTS
WPS-AP-AVAILABLE
CTRL-EVENT-NETWORK-NOT-FOUND
CTRL-EVENT-SCAN-RESULTS
WPS-AP-AVAILABLE
CTRL-EVENT-SSID-REENABLED id=2 ssid="Pretty Fly for A WI-FI"
Added BSSID f4:ca:e5:e6:01:a0 into ignore list, ignoring for 10 seconds
SME: Trying to authenticate with f4:ca:e5:e6:01:a0 (SSID='Pretty Fly for A WI-FI' freq=2462 MHz)
Trying to associate with f4:ca:e5:e6:01:a0 (SSID='Pretty Fly for A WI-FI' freq=2462 MHz)
Associated with f4:ca:e5:e6:01:a0
CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
CTRL-EVENT-DISCONNECTED bssid=f4:ca:e5:e6:01:a0 reason=7
BSSID f4:ca:e5:e6:01:a0 ignore list count incremented to 2, ignoring for 10 seconds
CTRL-EVENT-SSID-TEMP-DISABLED id=2 ssid="Pretty Fly for A WI-FI" auth_failures=3 duration=49 reason=CONN_FAILED
CTRL-EVENT-SCAN-STARTED
CTRL-EVENT-SCAN-RESULTS
WPS-AP-AVAILABLE
Removed BSSID f4:ca:e5:e6:01:a0 from ignore list (clear)
CTRL-EVENT-NETWORK-NOT-FOUND
CTRL-EVENT-SCAN-STARTED
CTRL-EVENT-SCAN-RESULTS
WPS-AP-AVAILABLE
CTRL-EVENT-NETWORK-NOT-FOUND
CTRL-EVENT-SCAN-STARTED
CTRL-EVENT-SCAN-RESULTS
WPS-AP-AVAILABLE
CTRL-EVENT-NETWORK-NOT-FOUND
CTRL-EVENT-SCAN-RESULTS
WPS-AP-AVAILABLE
CTRL-EVENT-NETWORK-NOT-FOUND
CTRL-EVENT-SCAN-RESULTS
WPS-AP-AVAILABLE
CTRL-EVENT-NETWORK-NOT-FOUND
CTRL-EVENT-SCAN-RESULTS
WPS-AP-AVAILABLE
CTRL-EVENT-SSID-REENABLED id=2 ssid="Pretty Fly for A WI-FI"
Added BSSID f4:ca:e5:e6:01:a0 into ignore list, ignoring for 10 seconds
SME: Trying to authenticate with f4:ca:e5:e6:01:a0 (SSID='Pretty Fly for A WI-FI' freq=2462 MHz)
Trying to associate with f4:ca:e5:e6:01:a0 (SSID='Pretty Fly for A WI-FI' freq=2462 MHz)
Associated with f4:ca:e5:e6:01:a0
CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
WPA: Key negotiation completed with f4:ca:e5:e6:01:a0 [PTK=CCMP GTK=CCMP]
Removed BSSID f4:ca:e5:e6:01:a0 from ignore list
CTRL-EVENT-CONNECTED - Connection to f4:ca:e5:e6:01:a0 completed [id=2 id_str=]
It's a short one, because it sometimes takes more than 30 minutes to reconnect...
Does anyone have an idea ?
sh_k_
(1 rep)
Nov 12, 2024, 02:04 PM
1
votes
2
answers
1432
views
Wifi P2P - Same Commands Different Results
I'm trying to get Wifi P2P (also known as "Wifi Direct") working on some devices. My goal is for them to be a "Group Owner" (i.e., acting like an access point). However, I'm getting very different results on different systems. Note that I'm talking about different hardware devices, but I *think* my...
I'm trying to get Wifi P2P (also known as "Wifi Direct") working on some devices. My goal is for them to be a "Group Owner" (i.e., acting like an access point). However, I'm getting very different results on different systems. Note that I'm talking about different hardware devices, but I *think* my issue is Linux-based.
I have gotten success with Raspberry Pi OS on a Pi 4B. However, when I try the same commands on a Banana Pi running Arabian I get very different results. However, I think the ultimate issue is system-level, which is why I'm asking here.
So, here's what works on the RPi OS (device_name is set in /etc/wpa_supplicant/wpa_supplicant.conf):
wpa_cli p2p_group_add
ifconfig p2p-wlan0-0 192.168.0.34 metmask 255.255.0.0
dnsmasq -i p2p-wlan0-0 -F192.168.0.40,192.168.0.250 -p0 -z
wpa_cli set p2p_go_intent 15
ifconfig wlan0 down
wpa_cli wps_pbc
From here, if I connect from my Android device, it works, and receives a DHCP response. Unfortunately, there's not much logging, so I can't compare well with other things. Additionally, from trial-and-error, I have determined that this DOESN'T work if my netmask is 255.255.255.0!?!? Weird, but whatever.
If I try the same sequence of commands on my Banana Pi (with a variety of operating systems - Raspbian, Ubuntu, and Armbian), there are several differences. First, if I take down wlan0, nothing after that works. So, leaving it in, it doesn't start advertising unless I issue a "wpa_cli p2p_find". or "wpa_cli p2p_listen". I found that strange, but whatever. However, here, the Android device finds the network, initiates, but the negotiation is never completed and a DHCP lease is never given. The log (which is better on Armbian than on RPiOS) gives the sequence: "P2P-DEVICE-FOUND, P2P-PROV-DISC-PBC-REQ", and "P2P-GO-NEG-REQUEST", but nothing after that.
In any case, I've tried lots of variations, different kernels, different versions of operating systems, etc. It's *possibly* a hardware issue with my Banana Pi, but I'm not sure why that would be - it's doing Wifi generally just fine, and P2P I think is just a new frame type, which the driver says it supports (uses brcmfmac).
It's possible it's a weird interaction with NetworkManager as well, but I have been unable to turn NetworkManager off and still have wpa_cli still work. Earlier in the syslog, when I enable the P2P group, I get some messages in my syslog which state:
wpa_supplicant: p2p-wlan0-0: interface state UNINITIALIZED->ENABLED
wpa_supplicant: p2p-wlan0-0: AP-ENABLED
wpa_supplicant: p2p-wlan0-0: CTRL-EVENT_CONNECTED
wpa_supplicant: P2P-GROUP-STARTED p2p-wlan0-0 GO .....
wpa_supplicant: bus: Register group object....
NetworkManager: device (p2p-dev-wlan0): P2P: WPA supplicant notified a group start but we are not trying to connect! Ignoring the event
wpa_supplicant: p2p-wlan0-0: interface state ENABLED->DISABLED
wpa_supplicant: p2p-wlan0-0: AP-DISABLED
wpa_supplicant: p2p-wlan0-0: CTRL-EVENT-DISCONNECTED
I don't know if these are normal (since the RPi 4 isn't logging at this level), but it seems that after enabled AP mode, it then disables it. However, I thought that it should probably stay in AP mode since it is a group owner. I didn't know if NetworkManager ignoring the event was causing anything weird. I'm really unsure how these interactions are supposed to go.
I've also tried a lot of variations on these, like setting the default route, but to no avail. If anyone has suggestions on where to go, I would greatly appreciate it. Sadly, right now my only Linux machines are my Pis, so I can't try this out on a regular PC either.
I also didn't know if there was something I could try at a lower level (using iw or something), because I'm really not familiar with how all of the layers work together, and there isn't great documentation on it either, especially regarding Wifi P2P. Any advice is appreciated.
Also, I've tried turning off NetworkManager, but, anytime I do that, wpa_cli seems to fail entirely.
johnnyb
(101 rep)
Feb 24, 2023, 04:22 PM
• Last activity: Jul 23, 2024, 08:35 AM
7
votes
2
answers
3000
views
Can I connect to a hidden wifi without knowing the ESSID?
**Is it theorically possible to connect to a hidden wifi without giving the ESSID?** The way I connect to a hidden wifi requires to give an SSID (`nmcli` refuses to have a blank `802-11-wireless.ssid` field). nmcli con add type wifi con-name ifname wlan0 ssid nmcli con modify wifi-sec.key-mgmt wpa-p...
**Is it theorically possible to connect to a hidden wifi without giving the ESSID?**
The way I connect to a hidden wifi requires to give an SSID (
nmcli
refuses to have a blank 802-11-wireless.ssid
field).
nmcli con add type wifi con-name ifname wlan0 ssid
nmcli con modify wifi-sec.key-mgmt wpa-psk
nmcli con modify wifi-sec.psk
user123456
(5258 rep)
Jan 4, 2017, 07:41 PM
• Last activity: May 27, 2024, 01:48 PM
8
votes
2
answers
9188
views
wpa_cli connection to hidden ssid
I have a raspberrypi ZeroW that I am trying to connect to a network with a hidden ssid. I know that I could add this line "scan_ssid=1" to my wpa_supplicant.conf file for setup that way, however I would like to do all of the network configuration through wpa_cli. The man page does not seem to have a...
I have a raspberrypi ZeroW that I am trying to connect to a network with a hidden ssid. I know that I could add this line "scan_ssid=1" to my wpa_supplicant.conf file for setup that way, however I would like to do all of the network configuration through wpa_cli.
The man page does not seem to have anything on hidden ssid's and when I run the set command it does not provide the output of all the variable options as stated in the man page I just get: "Invalid SET command - at least 2 arguments are required."
tldr: connect to hidden ssid through wpa_cli only
mechpilotace
(133 rep)
Dec 3, 2019, 03:55 PM
• Last activity: Dec 3, 2023, 03:16 PM
1
votes
1
answers
11200
views
Command for wpa_cli to scan a particular network SSID
Is there a command supported by `wpa_cli` to make `wpa_supplicant` scan and yield the results of my desired network using the SSID instead of making supplicant scan all the nearby networks?
Is there a command supported by
wpa_cli
to make wpa_supplicant
scan and yield the results of my desired network using the SSID instead of making supplicant scan all the nearby networks?
AKR
(71 rep)
Feb 9, 2018, 06:52 AM
• Last activity: Dec 5, 2022, 08:56 PM
2
votes
2
answers
3323
views
wpa_supplicant: How to switch between different networks without disabling all others
I'd like to know if it's possible -- I hope and guess it is -- to switch between different networks in wpa_cli without using `select_network`, as this disables all other networks. Thing is, say I have n networks to connect to and stored in my wpa_supplicant.conf. For whatever reason, I want to switc...
I'd like to know if it's possible -- I hope and guess it is -- to switch between different networks in wpa_cli without using
select_network
, as this disables all other networks.
Thing is, say I have n networks to connect to and stored in my wpa_supplicant.conf. For whatever reason, I want to switch from network 1 to 2. Right now I'm using select_network
, which disables all the other networks 1, 3, ..., n. This means that if network 2 crashes for some reason, wpa_supplicant won't automatically connect to a different available network. I'd like to avoid that by finding a method to switch between networks without using select_network
. Any idea how to do that?
plazmakeks
(191 rep)
May 6, 2019, 04:17 PM
• Last activity: Sep 19, 2022, 07:19 AM
0
votes
1
answers
1282
views
wlan0 interface disabled at startup on raspberry / debian
At boot of my Raspbian (Debian 10) I have this: ``` $ sudo wpa_cli wpa_cli v2.8-devel Copyright (c) 2004-2019, Jouni Malinen and contributors This software may be distributed under the terms of the BSD license. See README for more details. Selected interface 'p2p-dev-wlan0' Interactive mode > status...
At boot of my Raspbian (Debian 10) I have this:
$ sudo wpa_cli
wpa_cli v2.8-devel
Copyright (c) 2004-2019, Jouni Malinen and contributors
This software may be distributed under the terms of the BSD license.
See README for more details.
Selected interface 'p2p-dev-wlan0'
Interactive mode
> status
wpa_state=INTERFACE_DISABLED
p2p_device_address=de:a6:32:32:e9:32
address=de:a6:32:32:e9:32
uuid=622a44c0-abb5-576f-93be-bd05478ea3b2
> scan
FAIL
I can activate the wifi only with the desktop interface / mouse.
Everytime I reboot I have to activate it manually.
Any hint about how to activate it on boot?
Thx
Alessandro
(3 rep)
Apr 29, 2022, 08:28 AM
• Last activity: Apr 29, 2022, 03:54 PM
0
votes
1
answers
233
views
Deactivate wpa_cli notifications
Is it possible to deactivate `wpa_cli` notifications/messages like ` WPS_AP_AVAILABLE`? Because it spams it, and in a VT where you have to slowly type MACs@ and bssIDs, it's really hard with those bothering messages
Is it possible to deactivate
wpa_cli
notifications/messages like WPS_AP_AVAILABLE
? Because it spams it, and in a VT where you have to slowly type MACs@ and bssIDs, it's really hard with those bothering messages
aaa
(177 rep)
Jul 16, 2021, 07:53 PM
• Last activity: Aug 24, 2021, 01:29 PM
1
votes
1
answers
18688
views
How to connect to open wifi networks using wpa_cli?
I am failing to connect to open wifi networks using wpa_cli. I am trying to connect to the open wifi networks in the following way: ``` $ sudo wpa_cli -i wlp3s0 > add_network 0 > set_network 0 ssid "Guest" > enable_network 0 ``` When I try to enable the network sometimes it just replies OK and then...
I am failing to connect to open wifi networks using wpa_cli. I am trying to connect to the open wifi networks in the following way:
$ sudo wpa_cli -i wlp3s0
> add_network
0
> set_network 0 ssid "Guest"
> enable_network 0
When I try to enable the network sometimes it just replies OK and then nothing. Few times, I have seen it to reply following:
CTRL-EVENT-SCAN-STARTED
CTRL-EVENT-SCAN-RESULTS
WPS-AP-AVAILABLE
CTRL-EVENT-NETWORK-NOT-FOUND
wpa_cli is working without any issue for password protected networks.
Ashfaqur Rahaman
(382 rep)
Aug 17, 2021, 08:47 PM
• Last activity: Aug 18, 2021, 09:40 PM
1
votes
1
answers
811
views
wpa_cli: interactive shell works, single commands fail?
I'm trying to connect to wifi using the wpa_cli. I've run `$ wpa_cli add_network`, got 0 back, ran `$ wpa_cli set_network 0 ssid "my ssid"`. But this failed. Then I tried the interactive shell, ran `set_network 0 ssid "my ssid"` and got an OK? Shouldn't both either fail or run just fine? Why is only...
I'm trying to connect to wifi using the wpa_cli. I've run
$ wpa_cli add_network
, got 0 back, ran $ wpa_cli set_network 0 ssid "my ssid"
. But this failed. Then I tried the interactive shell, ran set_network 0 ssid "my ssid"
and got an OK? Shouldn't both either fail or run just fine? Why is only one failing?
Legatio
(185 rep)
May 11, 2021, 08:47 AM
• Last activity: May 14, 2021, 10:56 AM
7
votes
2
answers
41679
views
I am trying to connect to wifi using wpa_cli set_network command,but it always returns FAIL
krishna@krishna-PC:~/Downloads/wificonnect1$ sudo wpa_cli scan [sudo] password for krishna: Selected interface 'wlan0' OK krishna@krishna-PC:~/Downloads/wificonnect1$ sudo wpa_cli scan_results Selected interface 'wlan0' bssid / frequency / signal level / flags / ssid fc:0a:81:1d:6d:80 2412 -43 [WPA2...
krishna@krishna-PC:~/Downloads/wificonnect1$ sudo wpa_cli scan
[sudo] password for krishna:
Selected interface 'wlan0'
OK
krishna@krishna-PC:~/Downloads/wificonnect1$ sudo wpa_cli scan_results
Selected interface 'wlan0'
bssid / frequency / signal level / flags / ssid
fc:0a:81:1d:6d:80 2412 -43 [WPA2-PSK-CCMP][ESS] econsys
00:24:01:ba:b4:65 2437 -72 [WPA-PSK-TKIP][WPA2-PSK-TKIP][WPS][ESS] Test
6c:72:20:f2:1a:6b 2412 -60 [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS] Hari
c0:ee:fb:31:ec:4a 2447 -76 [WPA2-PSK-CCMP][ESS] Vishal's hotspot
fc:0a:81:1c:6d:f0 2412 -61 [WPA2-PSK-CCMP][ESS] econsys
c4:12:f5:08:10:70 2427 -63 [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS] GoGreen
f4:f2:6d:6d:23:44 2462 -62 [WPS][ESS] joyglobal
krishna@krishna-PC:~/Downloads/wificonnect1$ sudo wpa_cli add_network
Selected interface 'wlan0'
1
krishna@krishna-PC:~/Downloads/wificonnect1$ sudo wpa_cli set_network 1 ssid "econsys"
Selected interface 'wlan0'
FAIL
How should I connect?
vik
(79 rep)
Jan 9, 2018, 12:59 PM
• Last activity: Dec 16, 2020, 02:27 PM
-1
votes
1
answers
1149
views
wpa_cli action script example
I have been googling since morning about any wpa_cli actionscript example and the commands but can't any decent one. can someone help me with some info or link please? Thanks
I have been googling since morning about any wpa_cli actionscript example and the commands but can't any decent one. can someone help me with some info or link please?
Thanks
ASI
(3 rep)
Jun 28, 2020, 07:41 PM
• Last activity: Jun 28, 2020, 07:51 PM
3
votes
3
answers
4493
views
WiFi scans show SSID of a powered off network for several scans afterwards
I first came across this when I was trying to make a python program that used programs to scan for wireless networks. I've used the following tools: iwlist, iw, wpa_cli, nmcli, and iwconfig I run into the same behavior on all of them. Suppose you're sitting by your computer and wireless access point...
I first came across this when I was trying to make a python program that used programs to scan for wireless networks. I've used the following tools:
iwlist, iw, wpa_cli, nmcli, and iwconfig
I run into the same behavior on all of them. Suppose you're sitting by your computer and wireless access point/router. Type out one of the following commands, assuming your wifi adapter is named wlan0, turn of the router, then press enter in the terminal window.
iw wlan0 scan | grep SSID
iwlist wlan0 scan | grep SSID
wpa_cli -i wlan0 scan && wpa_cli -i wlan0 scan_results
nmcli device wifi rescan && nmcli device wifi list
All of the commands still show the SSID for quite some time. I imagine longer than it would take for the E&M standing wave to disappear. Does anyone have any fix for this problem?
user45878
(51 rep)
Sep 8, 2017, 11:57 PM
• Last activity: May 29, 2020, 06:24 PM
1
votes
0
answers
391
views
wpa_cli store hash password
Using wpa_passphrase I can get a config with the password stored as a hash but when saving a new network with wpa_cli it gets saved as plain text. Is there a way to save passwords as a hash from wpa_cli or would I actually need to manually change it each time?
Using wpa_passphrase I can get a config with the password stored as a hash but when saving a new network with wpa_cli it gets saved as plain text. Is there a way to save passwords as a hash from wpa_cli or would I actually need to manually change it each time?
Keltek
(143 rep)
May 25, 2020, 08:59 PM
0
votes
1
answers
192
views
bash script environment/result ambiguity
I'm running Arch Linux with i3wm. $ uname -a Linux lappie 5.3.1-arch1-1-ARCH #1 SMP PREEMPT Sat Sep 21 11:33:49 UTC 2019 x86_64 GNU/Linux $ i3 --version i3 version 4.17.1 (2019-08-30) © 2009 Michael Stapelberg and contributors I have this scriptfile `function.sh` that scans the wifi with `wpa_c...
I'm running Arch Linux with i3wm.
$ uname -a
Linux lappie 5.3.1-arch1-1-ARCH #1 SMP PREEMPT Sat Sep 21 11:33:49 UTC 2019 x86_64 GNU/Linux
$ i3 --version
i3 version 4.17.1 (2019-08-30) © 2009 Michael Stapelberg and contributors
I have this scriptfile
function.sh
that scans the wifi with wpa_cli
. It checks the return of > scan
and returns the results if the scan was successful.
#!/bin/bash
logfile=/$HOME/.logfile
echo "function" >> $logfile
echo "" >> $logfile
interface="wlp2s0"
function scan_wifi {
scan=$(sudo wpa_cli -i $interface scan)
echo "scan: $scan" >> $logfile
case "$scan" in
"OK")
echo "Scanning wifi" >> $logfile
scan_res=$(sudo wpa_cli -i $interface scan_results | awk 'NR>1 {OFS="\n>>"; print $NF}')
echo "results: $scan_res" >> $logfile
echo $scan_res
;;
"FAIL")
echo "FAILED TO SCAN" >> $logfile
echo "FAILED TO SCAN"
;;
*)
echo "ERROR: empty or undefined event for $interface" >> $logfile
exit 1
;;
esac
}
echo "return: $(scan_wifi)" >> $logfile
echo "" >> $logfile
echo "" >> $logfile
function.sh
locates in my $HOME
directory. I also have a file /usr/local/bin/networkmenu
containing the following:
#!/bin/sh
bash /home/speklap/function.sh
Until now everything is ok. I've added the /user/local/bin/networkmenu
to the sudoers file to execute without password.
speklap ALL=(ALL) NOPASSWD: /usr/local/bin/networkmenu
In the terminal as user:
$ networkmenu
.logfile
:
function
scan: OK
Scanning wifi
results: thuis
return: thuis
But when executing with a shortcut through i3, it doesn't work.
.config/i3/config
:
bindsym $mod+n exec networkmenu
Results in a .logfile
:
function
scan:
ERROR: empty or undefined event for wlp2s0
return:
Why is that, why can't i3 invoke the script like I can in the terminal? What am I doing wrong?
EDIT: if someone can come up with a better title, feel free to change. I had no clue on how to google this and my results were poorly and a lot of false positives
EDIT: outputting to /tmp/nm.log
as per comment of @cas
+ logfile=//home/speklap/.logfile
+ echo functions
+ echo ''
+ interface=wlp2s0
++ scan_wifi
+++ sudo wpa_cli -i wlp2s0 scan
sudo: no tty present and no askpass program specified
++ scan=
++ echo 'scan: '
++ case "$scan" in
++ echo 'ERROR: empty or undefined event for wlp2s0'
++ exit 1
+ echo 'return: '
+ echo ''
+ echo ''
So now we know what the problem is, sudo: no tty present and no askpass program specified
I can fix this by adding wpa_cli
to the sudoers file? Or is there a better solution. As in changing networkmenu
to sudo bash /$HOME/function.sh
?
Swedgin
(113 rep)
Oct 4, 2019, 08:09 PM
• Last activity: Oct 5, 2019, 01:24 PM
1
votes
1
answers
3577
views
How to format the output of "wpa_cli scan result" command in a well aligned column?
How would you suggest to align all SSID in one single column in the `wpa_cli scan_result` command? To be clear, I want to transform this output # wpa_cli scan_results d8:fb:5e:a5:38:20 [WPA2-PSK-CCMP][WPS][ESS] zdn-11878 08:96:d7:7e:d8:12 [WPA-PSK-TKIP][WPA2-PSK-CCMP][WPS][ESS] Ubeda 5 6c:3b:e5:4b:e...
How would you suggest to align all SSID in one single column in the
wpa_cli scan_result
command?
To be clear, I want to transform this output
# wpa_cli scan_results
d8:fb:5e:a5:38:20 [WPA2-PSK-CCMP][WPS][ESS] zdn-11878
08:96:d7:7e:d8:12 [WPA-PSK-TKIP][WPA2-PSK-CCMP][WPS][ESS] Ubeda 5
6c:3b:e5:4b:ea:00 [WPA2-PSK-CCMP][ESS] HP-Print-
Into this one
# wpa_cli scan_results
d8:fb:5e:a5:38:20 [WPA2-PSK-CCMP][WPS][ESS] zdn-11878
08:96:d7:7e:d8:12 [WPA-PSK-TKIP][WPA2-PSK-CCMP][WPS][ESS] Ubeda 5
6c:3b:e5:4b:ea:00 [WPA2-PSK-CCMP][ESS] HP-Print-00-Photosmart 5520
user123456
(5258 rep)
Mar 22, 2017, 07:10 PM
• Last activity: Sep 23, 2019, 12:01 PM
3
votes
0
answers
112
views
Getting Debian style wpa_supplicant in Buildroot
Currently it seems like the Buildroot package for `wpa_supplicant` does not include the Roaming Mode functionality that is available in the Debian package. How would I manually include this in my Buildroot OS?
Currently it seems like the Buildroot package for
wpa_supplicant
does not include the Roaming Mode functionality that is available in the Debian package. How would I manually include this in my Buildroot OS?
Jeremiah Rose
(253 rep)
Jun 30, 2019, 03:38 PM
Showing page 1 of 20 total questions