Configuring hostapd with navio2 on the raspberry pi 4

Has anyone successfully gotten hostapd working with the navio RPI4 image (buster OS) to setup the RPI 4 as an access point?

I am following the standard setup configuration using hostapd: https://raspberrypi-guide.github.io/net … cess-point to have the rpi operate as an access point, however I am running into a bunch of issues that result in the access point not being broadcasted.

In the dhcpcd.conf file, I have the following settings:

interface wlan0
    static ip_address=192.168.4.1/24
    nohook wpa_supplicant

In the dnsmasq.conf file I have the following settings:

interface=wlan0
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
domain=wlan
address=/gw.wlan/192.168.4.1

In the hostapd.conf I have the following settings:

country_code=CA
driver=nl80211
interface=wlan0
ssid=dragonflite95
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=MYPASSWRD
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Now it seems even with the nohook wpa_supplicant in the dhcpcd.conf, the wlan0 is still getting caught up on it.

Here are some diagnostic tests:

pi@navio:~ $ hostapd -dd /etc/hostapd/hostapd.conf
random: getrandom() support available
Configuration file: /etc/hostapd/hostapd.conf
nl80211: Using driver-based roaming
nl80211: TDLS supported
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:6
nl80211: Using driver-based off-channel TX
nl80211: Supported vendor command: vendor_id=0x1018 subcmd=1
nl80211: Use separate P2P group interface (driver advertised support)
nl80211: Enable multi-channel concurrent (driver advertised support)
nl80211: use P2P_DEVICE support
nl80211: interface wlan0 in phy phy0
nl80211: Set mode ifindex 3 iftype 3 (AP)
nl80211: Failed to set interface 3 to mode 3: -1 (Operation not permitted)
nl80211: Try mode change after setting interface down
Could not set interface wlan0 flags (DOWN): Operation not permitted
nl80211: Failed to set interface down
Could not set interface wlan0 flags (DOWN): Operation not permitted
nl80211: Failed to set interface down
Could not set interface wlan0 flags (DOWN): Operation not permitted
nl80211: Failed to set interface down
Could not set interface wlan0 flags (DOWN): Operation not permitted
nl80211: Failed to set interface down
Could not set interface wlan0 flags (DOWN): Operation not permitted
nl80211: Failed to set interface down
Could not set interface wlan0 flags (DOWN): Operation not permitted
nl80211: Failed to set interface down
Could not set interface wlan0 flags (DOWN): Operation not permitted
nl80211: Failed to set interface down
Could not set interface wlan0 flags (DOWN): Operation not permitted
nl80211: Failed to set interface down
Could not set interface wlan0 flags (DOWN): Operation not permitted
nl80211: Failed to set interface down
Could not set interface wlan0 flags (DOWN): Operation not permitted
nl80211: Failed to set interface down
nl80211: Interface mode change to 3 from 0 failed
nl80211: Could not configure driver mode
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
nl80211: Remove monitor interface: refcount=0
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: -1 (Operation not permitted)
nl80211 driver initialization failed.
hostapd_interface_deinit_free(0xeeb020)
hostapd_interface_deinit_free: num_bss=1 conf->num_bss=1
hostapd_interface_deinit(0xeeb020)
wlan0: interface state UNINITIALIZED->DISABLED
hostapd_bss_deinit: deinit bss wlan0
wlan0: AP-DISABLED
hostapd_cleanup(hapd=0xeebda0 (wlan0))
wlan0: CTRL-EVENT-TERMINATING
hostapd_free_hapd_data: Interface wlan0 wasn't started
hostapd_interface_deinit_free: driver=(nil) drv_priv=(nil) -> hapd_deinit
hostapd_interface_free(0xeeb020)
hostapd_interface_free: free hapd 0xeebda0
hostapd_cleanup_iface(0xeeb020)
hostapd_cleanup_iface_partial(0xeeb020)
hostapd_cleanup_iface: free iface=0xeeb020
pi@navio:~ $ sudo systemctl status hostapd
● hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Aut
   Loaded: loaded (/lib/systemd/system/hostapd.service; enabled; vendor pres
   Active: active (running) since Fri 2024-06-07 15:45:02 BST; 10min ago
  Process: 596 ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid -B $DAEMON
 Main PID: 636 (hostapd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/hostapd.service
           └─636 /usr/sbin/hostapd -B -P /run/hostapd.pid -B /etc/hostapd/ho

Jun 07 15:45:01 navio systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE
Jun 07 15:45:02 navio hostapd[596]: Configuration file: /etc/hostapd/hostapd
Jun 07 15:45:02 navio hostapd[596]: wlan0: interface state UNINITIALIZED->CO
Jun 07 15:45:02 navio hostapd[596]: wlan0: Could not connect to kernel drive
Jun 07 15:45:02 navio hostapd[596]: Using interface wlan0 with hwaddr d8:3a:
Jun 07 15:45:02 navio hostapd[596]: wlan0: interface state COUNTRY_UPDATE->E
Jun 07 15:45:02 navio hostapd[596]: wlan0: AP-ENABLED
Jun 07 15:45:02 navio systemd[1]: Started Advanced IEEE 802.11 AP and IEEE 8
lines 1-17/17 (END)
● hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator
   Loaded: loaded (/lib/systemd/system/hostapd.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2024-06-07 15:45:02 BST; 10min ago
  Process: 596 ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF} (code=exited, status=0/SUCCESS)
 Main PID: 636 (hostapd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/hostapd.service
           └─636 /usr/sbin/hostapd -B -P /run/hostapd.pid -B /etc/hostapd/hostapd.conf

Jun 07 15:45:01 navio systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator...
Jun 07 15:45:02 navio hostapd[596]: Configuration file: /etc/hostapd/hostapd.conf
Jun 07 15:45:02 navio hostapd[596]: wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
Jun 07 15:45:02 navio hostapd[596]: wlan0: Could not connect to kernel driver
Jun 07 15:45:02 navio hostapd[596]: Using interface wlan0 with hwaddr d8:3a:dd:fd:14:a1 and ssid "dragonflite95"
Jun 07 15:45:02 navio hostapd[596]: wlan0: interface state COUNTRY_UPDATE->ENABLED
Jun 07 15:45:02 navio hostapd[596]: wlan0: AP-ENABLED
Jun 07 15:45:02 navio systemd[1]: Started Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.

As you can see, wlan0 is still on an external network in “ACM Lab”:

pi@navio:~ $ sudo iwconfig wlan0
wlan0     IEEE 802.11  ESSID:"ACM Lab"
          Mode:Managed  Frequency:2.442 GHz  Access Point: 00:1E:58:25:AC:F3
          Bit Rate=65 Mb/s   Tx-Power=31 dBm
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on
          Link Quality=61/70  Signal level=-49 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

I tried adding “denyinterfaces wlan0” to dhcpcd.conf but that does nothing. I seem to be just guessing at this point. Any suggestions? Thanks

I was able to find the solution. There was conflicting settings in the network interface file on wlan0. Once I adjusted this, everything works as expected.

1 Like

Hi Sean,

Welcome to the forum! I’m glad to hear you were able to resolve your issue. Thank you for sharing the solution, as it can be beneficial for other forum users.

1 Like