Page 1 of 1

Disabling wpa_supplicant

Posted: Wed May 02, 2018 2:32 pm
by cristianoparis
Hi,

I'm trying to disable wpa_supplicant from starting. I tried different systemctl commands (disable, mask) but none of them work. The only solution I have found was to remove wpasupplicant package but I find this not ideal. I really want to understand what is happening.

Can you give me some direction?

Thanks.

Re: Disabling wpa_supplicant

Posted: Wed May 02, 2018 3:21 pm
by mattmiller
What is the end goal/reason for wanting to do this?

Re: Disabling wpa_supplicant

Posted: Wed May 02, 2018 5:16 pm
by cristianoparis
I want to create an Access Point using hostapd.

Re: Disabling wpa_supplicant

Posted: Wed May 02, 2018 5:22 pm
by B.Goode
Have you seen the documentation from the Raspberry Pi Foundation on creating an AP?

https://www.raspberrypi.org/documentati ... s-point.md

Re: Disabling wpa_supplicant

Posted: Wed May 02, 2018 5:38 pm
by davesteele
cristianoparis wrote:
Wed May 02, 2018 5:16 pm
I want to create an Access Point using hostapd.
Comitup does this out-of-the-box.

Except the hostapd part. It uses NetworkManager.

Re: Disabling wpa_supplicant

Posted: Thu May 03, 2018 6:09 am
by cristianoparis
B.Goode wrote:
Wed May 02, 2018 5:22 pm
Have you seen the documentation from the Raspberry Pi Foundation on creating an AP?

https://www.raspberrypi.org/documentati ... s-point.md
I did, hostapd refuses to start unless I kill wpa_supplicant.

Re: Disabling wpa_supplicant

Posted: Thu May 03, 2018 6:11 am
by cristianoparis
davesteele wrote:
Wed May 02, 2018 5:38 pm
cristianoparis wrote:
Wed May 02, 2018 5:16 pm
I want to create an Access Point using hostapd.
Comitup does this out-of-the-box.

Except the hostapd part. It uses NetworkManager.
Well, ok, but I do want to have some clues on why wpa_supplicant gets spawned even if I disable/mask it.

Re: Disabling wpa_supplicant

Posted: Thu May 03, 2018 6:50 am
by Ernst
cristianoparis wrote:
Thu May 03, 2018 6:09 am
B.Goode wrote:
Wed May 02, 2018 5:22 pm
Have you seen the documentation from the Raspberry Pi Foundation on creating an AP?

https://www.raspberrypi.org/documentati ... s-point.md
I did, hostapd refuses to start unless I kill wpa_supplicant.
Please post the output of

Code: Select all

 sudo cat /etc/wpa_supplicant/wpa_supplicant.conf

Re: Disabling wpa_supplicant

Posted: Thu May 03, 2018 7:37 pm
by cristianoparis
Ernst wrote:
Thu May 03, 2018 6:50 am
Please post the output of

Code: Select all

 sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
It's actually untouched:

Code: Select all

pi@raspberrypi:~ $ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

Re: Disabling wpa_supplicant

Posted: Thu May 03, 2018 8:07 pm
by Ernst
Very strange.

I followed the instructions and I have no problems running hostapd (bridged) on a Pi3 on 4.14.34.

Re: Disabling wpa_supplicant

Posted: Sun Jun 10, 2018 5:59 am
by chrisotherwise
I get the same issue when using a USB WIFI adaptor. When using the internal WIFI, hostapd and wpa_supplicant coexist fine, but with the external adaptor (Ralink RT5370) they don't.

Here's the output from hostapd if wpa_supplicant is running:

Code: Select all

root@raspberrypi:/home/pi# hostapd -d /etc/hostapd/hostapd.conf 
random: Trying to read entropy from /dev/random
Configuration file: /etc/hostapd/hostapd.conf
rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0
rfkill: initial event: idx=1 type=1 op=0 soft=0 hard=0
rfkill: initial event: idx=2 type=2 op=0 soft=0 hard=0
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Supported cipher 00-0f-ac:10
nl80211: Supported cipher 00-0f-ac:8
nl80211: Supported cipher 00-0f-ac:9
nl80211: Using driver-based off-channel TX
nl80211: interface wlan0 in phy phy0
nl80211: Set mode ifindex 3 iftype 3 (AP)
nl80211: Failed to set interface 3 to mode 3: -16 (Device or resource busy)
nl80211: Try mode change after setting interface down
nl80211: Set mode ifindex 3 iftype 3 (AP)
nl80211: Mode change succeeded while interface is down
nl80211: Setup AP(wlan0) - device_ap_sme=0 use_monitor=0
nl80211: Subscribe to mgmt frames with AP handle 0x1f08038
nl80211: Register frame type=0xb0 (WLAN_FC_STYPE_AUTH) nl_handle=0x1f08038 match=
nl80211: Register frame type=0x0 (WLAN_FC_STYPE_ASSOC_REQ) nl_handle=0x1f08038 match=
nl80211: Register frame type=0x20 (WLAN_FC_STYPE_REASSOC_REQ) nl_handle=0x1f08038 match=
nl80211: Register frame type=0xa0 (WLAN_FC_STYPE_DISASSOC) nl_handle=0x1f08038 match=
nl80211: Register frame type=0xc0 (WLAN_FC_STYPE_DEAUTH) nl_handle=0x1f08038 match=
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1f08038 match=
nl80211: Register frame command failed (type=208): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=0): [NULL]
nl80211: Could not configure driver mode
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
nl80211: Remove monitor interface: refcount=0
nl80211: Remove beacon (ifindex=3)
netlink: Operstate: ifindex=3 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
nl80211: Set mode ifindex 3 iftype 2 (STATION)
nl80211: Failed to set interface 3 to mode 2: -16 (Device or resource busy)
nl80211: Try mode change after setting interface down
nl80211: Set mode ifindex 3 iftype 2 (STATION)
nl80211: Mode change succeeded while interface is down
nl80211: Teardown AP(wlan0) - device_ap_sme=0 use_monitor=0
nl80211 driver initialization failed.
hostapd_interface_deinit_free(0x1f06cd8)
hostapd_interface_deinit_free: num_bss=1 conf->num_bss=1
hostapd_interface_deinit(0x1f06cd8)
wlan0: interface state UNINITIALIZED->DISABLED
hostapd_bss_deinit: deinit bss wlan0
wlan0: AP-DISABLED 
hostapd_cleanup(hapd=0x1f079a0 (wlan0))
hostapd_free_hapd_data: Interface wlan0 wasn't started
hostapd_interface_deinit_free: driver=(nil) drv_priv=(nil) -> hapd_deinit
hostapd_interface_free(0x1f06cd8)
hostapd_interface_free: free hapd 0x1f079a0
hostapd_cleanup_iface(0x1f06cd8)
hostapd_cleanup_iface_partial(0x1f06cd8)
hostapd_cleanup_iface: free iface=0x1f06cd8
root@raspberrypi:/home/pi# 
... And here's the output if it isn't:

Code: Select all

root@raspberrypi:/home/pi# hostapd -d /etc/hostapd/hostapd.conf 
random: Trying to read entropy from /dev/random
Configuration file: /etc/hostapd/hostapd.conf
rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0
rfkill: initial event: idx=1 type=1 op=0 soft=0 hard=0
rfkill: initial event: idx=2 type=2 op=0 soft=0 hard=0
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Supported cipher 00-0f-ac:10
nl80211: Supported cipher 00-0f-ac:8
nl80211: Supported cipher 00-0f-ac:9
nl80211: Using driver-based off-channel TX
nl80211: interface wlan0 in phy phy0
nl80211: Set mode ifindex 3 iftype 3 (AP)
nl80211: Failed to set interface 3 to mode 3: -16 (Device or resource busy)
nl80211: Try mode change after setting interface down
nl80211: Set mode ifindex 3 iftype 3 (AP)
nl80211: Mode change succeeded while interface is down
nl80211: Setup AP(wlan0) - device_ap_sme=0 use_monitor=0
nl80211: Subscribe to mgmt frames with AP handle 0x74a038
nl80211: Register frame type=0xb0 (WLAN_FC_STYPE_AUTH) nl_handle=0x74a038 match=
nl80211: Register frame type=0x0 (WLAN_FC_STYPE_ASSOC_REQ) nl_handle=0x74a038 match=
nl80211: Register frame type=0x20 (WLAN_FC_STYPE_REASSOC_REQ) nl_handle=0x74a038 match=
nl80211: Register frame type=0xa0 (WLAN_FC_STYPE_DISASSOC) nl_handle=0x74a038 match=
nl80211: Register frame type=0xc0 (WLAN_FC_STYPE_DEAUTH) nl_handle=0x74a038 match=
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x74a038 match=
nl80211: Register frame type=0x40 (WLAN_FC_STYPE_PROBE_REQ) nl_handle=0x74a038 match=
nl80211: Add own interface ifindex 3
nl80211: if_indices[16]: 3
phy: phy0
BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)
nl80211: Regulatory information - country=00
nl80211: 2402-2472 @ 40 MHz 20 mBm
nl80211: 2457-2482 @ 20 MHz 20 mBm (no IR)
nl80211: 2474-2494 @ 20 MHz 20 mBm (no OFDM) (no IR)
nl80211: 5170-5250 @ 80 MHz 20 mBm (no IR)
nl80211: 5250-5330 @ 80 MHz 20 mBm (DFS) (no IR)
nl80211: 5490-5730 @ 160 MHz 20 mBm (DFS) (no IR)
nl80211: 5735-5835 @ 80 MHz 20 mBm (no IR)
nl80211: 57240-63720 @ 2160 MHz 0 mBm
nl80211: Added 802.11b mode based on 802.11g information
hw vht capab: 0x0, conf vht capab: 0x0
Completing interface initialization
Mode: IEEE 802.11g  Channel: 6  Frequency: 2437 MHz
DFS 0 channels required radar detection
nl80211: Set freq 2437 (ht_enabled=1, vht_enabled=0, bandwidth=20 MHz, cf1=2437 MHz, cf2=0 MHz)
  * freq=2437
  * vht_enabled=0
  * ht_enabled=1
  * sec_channel_offset=0
  * channel_type=1
RATE[0] rate=10 flags=0x1
RATE[1] rate=20 flags=0x1
RATE[2] rate=55 flags=0x1
RATE[3] rate=110 flags=0x1
RATE[4] rate=60 flags=0x0
RATE[5] rate=90 flags=0x0
RATE[6] rate=120 flags=0x0
RATE[7] rate=180 flags=0x0
RATE[8] rate=240 flags=0x0
RATE[9] rate=360 flags=0x0
RATE[10] rate=480 flags=0x0
RATE[11] rate=540 flags=0x0
hostapd_setup_bss(hapd=0x7499a0 (wlan0), first=1)
wlan0: Flushing old station entries
nl80211: flush -> DEL_STATION wlan0 (all)
wlan0: Deauthenticate all stations
nl80211: send_mlme - da= ff:ff:ff:ff:ff:ff noack=0 freq=0 no_cck=0 offchanok=0 wait_time=0 fc=0xc0 (WLAN_FC_STYPE_DEAUTH) nlmode=3
nl80211: send_mlme -> send_frame
nl80211: send_frame - Use bss->freq=2437
nl80211: send_frame -> send_frame_cmd
nl80211: Frame command failed: ret=-16 (Device or resource busy) (freq=2437 wait=0)
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0
Using interface wlan0 with hwaddr 00:0f:00:5d:01:1c and ssid "Join me"
Deriving WPA PSK based on passphrase
SSID - hexdump_ascii(len=7):
     4a 6f 69 6e 20 6d 65                              Join me         
PSK (ASCII passphrase) - hexdump_ascii(len=9): [REMOVED]
PSK (from passphrase) - hexdump(len=32): [REMOVED]
random: Got 20/20 bytes from /dev/random
GMK - hexdump(len=32): [REMOVED]
Key Counter - hexdump(len=32): [REMOVED]
WPA: Delay group state machine start until Beacon frames have been configured
nl80211: Set beacon (beacon_set=0)
nl80211: Beacon head - hexdump(len=58): 80 00 00 00 ff ff ff ff ff ff 00 0f 00 5d 01 1c 00 0f 00 5d 01 1c 00 00 00 00 00 00 00 00 00 00 64 00 11 04 00 07 4a 6f 69 6e 20 6d 65 01 08 82 84 8b 96 0c 12 18 24 03 01 06
nl80211: Beacon tail - hexdump(len=93): 2a 01 04 32 04 30 48 60 6c 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00 2d 1a 0c 00 12 ff 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 3d 16 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7f 08 00 00 00 02 00 00 00 40
nl80211: ifindex=3
nl80211: beacon_int=100
nl80211: dtim_period=2
nl80211: ssid - hexdump_ascii(len=7):
     4a 6f 69 6e 20 6d 65                              Join me         
  * beacon_int=100
nl80211: hidden SSID not in use
nl80211: privacy=1
nl80211: auth_algs=0x1
nl80211: wpa_version=0x2
nl80211: key_mgmt_suites=0x2
nl80211: pairwise_ciphers=0x18
nl80211: group_cipher=0x10
nl80211: SMPS mode - off
nl80211: beacon_ies - hexdump(len=10): 7f 08 00 00 00 02 00 00 00 40
nl80211: proberesp_ies - hexdump(len=10): 7f 08 00 00 00 02 00 00 00 40
nl80211: assocresp_ies - hexdump(len=10): 7f 08 00 00 00 02 00 00 00 40
WPA: Start group state machine to set initial keys
WPA: group state machine entering state GTK_INIT (VLAN-ID 0)
GTK - hexdump(len=16): [REMOVED]
WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=3 addr=0xc7868 key_idx=1 set_tx=1 seq_len=0 key_len=16
nl80211: KEY_DATA - hexdump(len=16): [REMOVED]
   broadcast key
nl80211: Set wlan0 operstate 0->1 (UP)
netlink: Operstate: ifindex=3 linkmode=-1 (no change), operstate=6 (IF_OPER_UP)
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED 
wlan0: Setup of interface done.
ctrl_iface not configured!
RTM_NEWLINK: ifi_index=3 ifname=wlan0 operstate=2 linkmode=0 ifi_family=0 ifi_flags=0x1002 ()
nl80211: Ignore interface down event since interface wlan0 is up
RTM_NEWLINK: ifi_index=3 ifname=wlan0 operstate=2 linkmode=0 ifi_family=0 ifi_flags=0x1003 ([UP])
RTM_NEWLINK: ifi_index=3 ifname=wlan0 operstate=6 linkmode=0 ifi_family=0 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])
RTM_NEWLINK: ifi_index=3 ifname=wlan0 operstate=6 linkmode=0 ifi_family=0 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])
VLAN: RTM_NEWLINK: ifi_index=3 ifname=wlan0 ifi_family=0 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])
VLAN: vlan_newlink(wlan0)
VLAN: RTM_NEWLINK: ifi_index=3 ifname=wlan0 ifi_family=0 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])
VLAN: vlan_newlink(wlan0)

This is my wpa_supplicant.conf:

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
And this is my hostapd.conf (note that the ht_capab line also breaks hostapd for the external wifi but not the internal):

Code: Select all

interface=wlan0
driver=nl80211
ssid=piwifi
hw_mode=g
channel=6
ieee80211n=1
wmm_enabled=0
#ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_passphrase=raspberry
rsn_pairwise=CCMP

I'd be really interested to hear any insight into what's going on here. I'm still struggling to understand the relationship between all the parts that fire when you use WIFI - not helped by the huge numbers of different online guides, many of which are written for different versions of the pi and don't work with the latest versions.

Re: Disabling wpa_supplicant

Posted: Tue Jan 15, 2019 4:20 pm
by SynAckFin
wpa_supplicant is run by dhcpcd. To disable it on an interface edit /etc/dhcpcd.conf and add the line:

Code: Select all

denyinterfaces wlan0
Replace wlan0 with the name of your interface.

Re: Disabling wpa_supplicant

Posted: Tue May 28, 2019 12:16 pm
by javalatte
I had exactly the same problem- my hostapd only worked if I killed wpa_supplicant. I put the denyinterfaces line in dhcpcd.conf, but it still started up and grabbed wlan0. I eventually found that in /etc/network/id-up.d and /etc/if-pre-up.d there are links to wpa-supplicant. When I unlinked these, my hostapd was able to start normally.

Re: Disabling wpa_supplicant

Posted: Tue May 28, 2019 12:37 pm
by epoch1970
This thread is obsolete.
The only part that is still valid is « read the official howto ».