Jump to content

OPI zero and hostapd


cippo

Recommended Posts

Hello,
I have a OPI zero, I want to use it as access point, but when I start hostapd appears this message:

root@orangepizero:~# hostapd /etc/hostapd/hostapd.conf -dd
random: Trying to read entropy from /dev/random
Configuration file: /etc/hostapd/hostapd.conf
nl80211: Could not add multicast membership for vendor events: -2 (No such file or directory)
rfkill: initial event: idx=0 type=1 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: Using driver-based off-channel TX
nl80211: Supports Probe Response offload in AP mode
nl80211: Use separate P2P group interface (driver advertised support)
nl80211: interface wlan0 in phy phy1
nl80211: Set mode ifindex 4 iftype 3 (AP)
nl80211: Setup AP(wlan0) - device_ap_sme=0 use_monitor=0
nl80211: Subscribe to mgmt frames with AP handle 0xb7ba98d8
nl80211: Register frame type=0xb0 (WLAN_FC_STYPE_AUTH) nl_handle=0xb7ba98d8 match=
nl80211: Register frame type=0x0 (WLAN_FC_STYPE_ASSOC_REQ) nl_handle=0xb7ba98d8 match=
nl80211: Register frame type=0x20 (WLAN_FC_STYPE_REASSOC_REQ) nl_handle=0xb7ba98d8 match=
nl80211: Register frame type=0xa0 (WLAN_FC_STYPE_DISASSOC) nl_handle=0xb7ba98d8 match=
nl80211: Register frame type=0xc0 (WLAN_FC_STYPE_DEAUTH) nl_handle=0xb7ba98d8 match=
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xb7ba98d8 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=4)
netlink: Operstate: ifindex=4 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
nl80211: Set mode ifindex 4 iftype 2 (STATION)
nl80211: Teardown AP(wlan0) - device_ap_sme=0 use_monitor=0
nl80211 driver initialization failed.
hostapd_interface_deinit_free(0xb7ba82d8)
hostapd_interface_deinit_free: num_bss=1 conf->num_bss=1
hostapd_interface_deinit(0xb7ba82d8)
wlan0: interface state UNINITIALIZED->DISABLED
hostapd_bss_deinit: deinit bss wlan0
wlan0: AP-DISABLED 
hostapd_cleanup(hapd=0xb7ba8e60 (wlan0))
hostapd_free_hapd_data: Interface wlan0 wasn't started
hostapd_interface_deinit_free: driver=(nil) drv_priv=(nil) -> hapd_deinit
hostapd_interface_free(0xb7ba82d8)
hostapd_interface_free: free hapd 0xb7ba8e60
hostapd_cleanup_iface(0xb7ba82d8)
hostapd_cleanup_iface_partial(0xb7ba82d8)
hostapd_cleanup_iface: free iface=0xb7ba82d8

I use a simple config file like this:

root@orangepizero:~# cat /etc/hostapd/hostapd.conf 
# Wireless interface                                                                                                                                       
interface=wlan0
driver=nl80211
ssid=test
channel=1

I use: Armbian_5.24_Orangepizero_Debian_jessie_3.4.113 with hostapd v2.5

Link to comment
Share on other sites

With a distro downloaded from orangepi.org (originary for opiplus) hostapd work fine..

It use an older kernel version without "new" module mac80211

root@orangepiplus:~# uname -a
Linux orangepiplus 3.4.39 #29 SMP PREEMPT Mon Nov 7 11:15:11 CST 2016 armv7l GNU/Linux
root@orangepiplus:~# lsmod
Module                  Size  Used by
xradio_wlan           230792  0 
root@orangepiplus:~# modinfo /lib/modules/3.4.39/xradio_wlan.ko
filename:       /lib/modules/3.4.39/xradio_wlan.ko
alias:          xradio_core
license:        GPL
description:    XRadioTech WLAN driver core
author:         XRadioTech
srcversion:     EE504CDAD99C9B5CF34A68C
depends:        
intree:         Y
vermagic:       3.4.39 SMP preempt mod_unload modversions ARMv7 p2v8 
parm:           macaddr:First MAC address (charp)
root@orangepiplus:~# hostapd /etc/hostapd/hostapd.conf 
Configuration file: /etc/hostapd/hostapd.conf
Using interface wlan1 with hwaddr 48:eb:26:65:8f:47 and ssid "test"
wlan1: interface state UNINITIALIZED->ENABLED
wlan1: AP-ENABLED 
^Croot@orangepiplus:~# 
root@orangepiplus:~# hostapd /etc/hostapd/hostapd.conf &
[1] 2017
root@orangepiplus:~# Configuration file: /etc/hostapd/hostapd.conf
Using interface wlan1 with hwaddr 48:eb:26:65:8f:47 and ssid "test"
wlan1: interface state UNINITIALIZED->ENABLED
wlan1: AP-ENABLED 

root@orangepiplus:~# iwconfig
gre0      no wireless extensions.

lo        no wireless extensions.

tunl0     no wireless extensions.

wlan1     IEEE 802.11bgn  Mode:Master  Frequency:2.412 GHz  Tx-Power=20 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          
sit0      no wireless extensions.

eth0      no wireless extensions.

ip6tnl0   no wireless extensions.

p2p0      IEEE 802.11bgn  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on

This orangepi.org distros are full of problems and board become very hot..

I want to try to use armbian, but I don't understand what is the problem with hostapd, any ideas?

Link to comment
Share on other sites

This orangepi.org distros are full of problems and board become very hot..

I want to try to use armbian, but I don't understand what is the problem with hostapd, any ideas?

 

Well, we need to figure this out and that usually takes some time. I wasn't even aware that hostapd was not working, now I am.

Link to comment
Share on other sites

1. read https://wiki.archlinux.org/index.php/Software_access_point

2. create hostapd.conf

3. stop wpa_supplicant service 'service wpa_supplicant stop' =)

4. start hostapd as 'hostapd /etc/hostapd/hostapd.conf'

 

Hi 100p00,

 

I read through the step #1 and created the following hostapd.conf file:

ssid=OrangePiWAN
wpa_passphrase=********************
interface=wlan0
bridge=br0
auth_algs=3
channel=7
driver=nl80211
hw_mode=g
logger_stdout=-1
logger_stdout_level=2
max_num_sta=5
rsn_pairwise=CCMP
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
utf8_ssid=1

Then I stopped the wpa-supplicant service: 'service wpa_supplicant stop' and started up the hostapd with:  'hostapd /etc/hostapd/hostapd.conf' like you suggested.  However I'm getting the following error:

 

root@orangepizero:/etc/hostapd# hostapd /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
nl80211: Could not re-add multicast membership for vendor events: -2 (No such file or directory)
Using interface wlan0 with hwaddr 16:e4:f9:dc:5a:f7 and ssid "OrangePiWAN"
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED
wlan0: STA 50:9e:a7:69:a7:20 IEEE 802.11: associated
wlan0: STA 50:9e:a7:69:a7:20 IEEE 802.11: deauthenticated due to local deauth request
wlan0: STA 50:9e:a7:69:a7:20 IEEE 802.11: disassociated
wlan0: STA 50:9e:a7:69:a7:20 IEEE 802.11: associated
wlan0: STA 50:9e:a7:69:a7:20 IEEE 802.11: disassociated
wlan0: STA 50:9e:a7:69:a7:20 IEEE 802.11: associated
wlan0: STA 50:9e:a7:69:a7:20 IEEE 802.11: deauthenticated due to local deauth request
wlan0: STA 50:9e:a7:69:a7:20 IEEE 802.11: disassociated
^Cwlan0: interface state ENABLED->DISABLED
wlan0: AP-DISABLED

My tablet can see the new AP point but it won't connect to it using the password specified.  I'm guessing that the driver error above is the problem:

 

nl80211: Could not re-add multicast membership for vendor events: -2 (No such file or directory)

 

 

What should the correct driver be for the Zero?

 

Thanks

 

 

Link to comment
Share on other sites

Hi everyone,

 

Then I stopped the wpa-supplicant service: 'service wpa_supplicant stop' and started up the hostapd with:  'hostapd /etc/hostapd/hostapd.conf' like you suggested.  However I'm getting the following error:

[...]

 

I had exactly the same problem. It seems a simple "service wpa_supplicant stop" is not enough to actually stop all wpa_supplicant processes. It still keeps running.

 

As a short workaround I just killed the process and after that hostapd worked fine :-) Now I just need to find out where and how to configure the networking, so that the wpa_supplicant is not started at all...

 

Regards,

 

Motlib

Link to comment
Share on other sites

All above is correct, but there is still a problem:

 

In order for hostapd to create a usable accesspoint network on wlan0,

 

a necessary precondition is that the wlan0 interface has had a previous connection as a client to another wireless network.

 

If the wlan0 interface has not been connected as a client to another wireless since booting, then although a network created by hostapd will be visible to potential clients, still they cannot successfully authenticate or associate with the new network.

 

This feels like a driver problem.

Link to comment
Share on other sites

I had exactly the same problem. It seems a simple "service wpa_supplicant stop" is not enough to actually stop all wpa_supplicant processes. It still keeps running.

 

 

 

I'm not seeing that on my end.  Running the STOP does indeed seem to stop it:

root@connectboxpi:/# service wpa_supplicant start
root@connectboxpi:/# service wpa_supplicant status
â— wpa_supplicant.service - WPA supplicant
   Loaded: loaded (/lib/systemd/system/wpa_supplicant.service; disabled; vendor preset: enabled)
   Active: active (running) since Thu 2016-12-22 16:12:33 UTC; 7s ago
 Main PID: 2878 (wpa_supplicant)
   CGroup: /system.slice/wpa_supplicant.service
           └─2878 /sbin/wpa_supplicant -u -s -O /run/wpa_supplicant

Dec 22 16:12:33 connectboxpi systemd[1]: Starting WPA supplicant...
Dec 22 16:12:33 connectboxpi systemd[1]: Started WPA supplicant.
Dec 22 16:12:33 connectboxpi wpa_supplicant[2878]: Successfully initialized wpa_supplicant


root@connectboxpi:/# service wpa_supplicant stop
root@connectboxpi:/# service wpa_supplicant status
â— wpa_supplicant.service - WPA supplicant
   Loaded: loaded (/lib/systemd/system/wpa_supplicant.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

Dec 22 16:11:14 connectboxpi systemd[1]: Starting WPA supplicant...
Dec 22 16:11:14 connectboxpi systemd[1]: Started WPA supplicant.
Dec 22 16:11:14 connectboxpi wpa_supplicant[2797]: Successfully initialized wpa_supplicant
Dec 22 16:11:33 connectboxpi systemd[1]: Stopping WPA supplicant...
Dec 22 16:11:33 connectboxpi systemd[1]: Stopped WPA supplicant.
Dec 22 16:12:33 connectboxpi systemd[1]: Starting WPA supplicant...
Dec 22 16:12:33 connectboxpi systemd[1]: Started WPA supplicant.
Dec 22 16:12:33 connectboxpi wpa_supplicant[2878]: Successfully initialized wpa_supplicant
Dec 22 16:12:49 connectboxpi systemd[1]: Stopping WPA supplicant...
Dec 22 16:12:49 connectboxpi systemd[1]: Stopped WPA supplicant.
root@connectboxpi:/#

pgrep -f "wpa_supplicant"  also shows up empty after the STOP command

 

Link to comment
Share on other sites

a necessary precondition is that the wlan0 interface has had a previous connection as a client to another wireless network.

 

 

How did you create your initial client?  Using the nmtui command?  Maybe the network manager needs to initialize and create a config file somewhere to get things going?

Link to comment
Share on other sites

How did you create your initial client?  Using the nmtui command?  Maybe the network manager needs to initialize and create a config file somewhere to get things going?

Yes with nmtui. No it's not a config file thing: This is recurring on every reboot.

 

Here is the complete description of getting a working Access Point on Orange Pi Zero, starting right after you changed the root password on first login. I wrote this down while I installed a second Orange Pi Zero and enabled it as a wireless access point. Armbian image used is Armbian_5.24_Orangepizero_Debian_jessie_3.4.113

 

Note: This is a very basic Access Point. No DHCP, no encryption/authentication, no DNS, no Internet access is configured. Enough documentation for this exists, and you can extend this Access Point as needed once it is working. These steps just show how to circumvent the Orange-Pi-Zero specific problem to establish a working access point at all.

 

  1. Create file /etc/hostapd.conf with content

    interface=wlan0
    ssid=ShelobsLair
    channel=1

    Note: No encryption yet, add this later on your own.

  2. chmod 600 /etc/hostapd.conf

  3. Detour: Try it out. This detour currently leads to a dead end, it is testing if the underlying problem is fixed. You can continue to step 4 if you do not want to perform this test.

    1. systemctl stop network-manager

    2. systemctl stop wpa_supplicant

    3. ifconfig wlan0 10.14.225.7 # arbitrary IP address in private range

    4. hostapd -dd /etc/hostapd.conf

    5. On another device, try to connect to the new network with a suitable static IP address and ping the Orange Pi's wlan0 IP 10.14.225.7. It does not succeed. It will succeed here in future when the underlying problem is fixed. It works like this when using other devices as software APs (e.g. Raspberry Pi 3, NextThing CHIP).

    6. Backtrack from dead end: Terminate hostapd with Ctrl-C. Restart network-manager. End of Detour

  4. Prepare hostapd for automatic startup: edit file /etc/default/hostapd, uncomment the DAEMON_CONF line, make sure it points to your hostapd.conf.

  5. Prevent automatic startup of hostapd on boot through normal systemd mechanism: systemctl disable hostapd

  6. Connect to an existing wireless network in range with nmtui.

  7. Find out the UUID that network manager uses to store this connection with

    nmcli connection show --active. For me, it's 3eb41ffb-82c9-44f7-a7f3-a277feb5b215

  8. Edit /etc/rc.local, add the following lines before "exit 0":

    # setup network: First connect as client to network in range
    for i in $(/usr/bin/seq 10)
    do /bin/sleep 4
       if /usr/bin/nmcli connection up 3eb41ffb-82c9-44f7-a7f3-a277feb5b215
       then break
       fi
    done
    
    # then disconnect and create an independent access point
    /usr/bin/nmcli connection down 3eb41ffb-82c9-44f7-a7f3-a277feb5b215
    /bin/systemctl stop network-manager
    /bin/systemctl stop wpa_supplicant
    /sbin/ifconfig wlan0 10.14.225.7
    /bin/systemctl start hostapd

    Replace both occurrences of my UUID with your UUID. Change IP address if desired. Notes:

    1. The loop is necessary because rc.local may run before network-manager has started. This retries up to 10 times before it gives up.

    2. The "nmcli connection up" may not strictly be necessary, because network-manager will automatically try to connect to the configured wireless network as a client. However, it does not hurt, and when it succeeds I can be reasonably sure that the temporary connection has been established.

    3. It is necessary to stop network-manager before stopping wpa_supplicant, otherwise network-manager will restart wpa_supplicant immediately.

  9. Reboot, try it out as in step 3.5, it works now.

You can now extend your network setup as desired.

Link to comment
Share on other sites

Here is the complete description of getting a working Access Point on Orange Pi Zero, starting right after you changed the root password on first login. I wrote this down while I installed a second Orange Pi Zero and enabled it as a wireless access point.

 

 

Wow!  Very detailed instructions...thanks!  I'll give it a go after the holidays.

Link to comment
Share on other sites

If the wlan0 interface has not been connected as a client to another wireless since booting, then although a network created by hostapd will be visible to potential clients, still they cannot successfully authenticate or associate with the new network.

 

This feels like a driver problem.

 

Does it work if you disable WPA in hostapd? I'm working on fixing hostapd with WPA for my mainline version of the xradio driver and what I can see is that clients authenticate and associate but the handshake for WPA never happens and the client disconnects.

 

There seems to be some disconnection between hostapd and the driver because the driver doesn't get anything to transmit between the association completing and the client sending it's deauth on disconnect. It might be hostapd expecting the chip to offload (do it itself) that part. :/

Link to comment
Share on other sites

I am soory  . I am not good at English .

 

 

I  can connect this hot port(access point)  with isc-dhcp-server and hostapd .

 

 

but when I connected to the hot port(access point) a minute later

 

the hotp post (access point) will disappear .

 

 

 

Also I can not connect to internet. I have run 

echo 1| sudo tee /proc/sys/net/ipv4/ip_forward
Link to comment
Share on other sites

Does it work if you disable WPA in hostapd?

No. See my post https://forum.armbian.com/index.php/topic/3046-opi-zero-and-hostapd/#entry21921. No WPA in there.

 

what I can see is that clients authenticate and associate but the handshake for WPA never happens

 

Exactly. Hostapd accepts the client device, but then does not receive the client's acknowledgement. But with my workaround client connection on every bootup in place (again, see my post https://forum.armbian.com/index.php/topic/3046-opi-zero-and-hostapd/#entry21921), this handshake will succeed and hostapd will function with or without encryption. Therefore I do not think that hostapd is the culprit here, but the wlan kernel driver is.

 

(Btw. I know next to nothing about the inner workings of wireless networks. Forgive me if my above terms "accept" and "acknowledgement", and previously, "associate" and "authenticate" are incorrect. This is just what I understood from the hostapd debug messages.)

 

The reason for the association failures in "cold" state (i.e. without initiating a connection where opi0 is the client) after bootup may be that either the "acceptance" message is not transmitted by the wlan0 driver to the client, or that the wlan0 driver does not forward a received "acknowledgement" event to hostapd.

Link to comment
Share on other sites

 

Interesting. Anyhow I have hostapd (wpa_supplicant in ap mode) working with WPA etc in dual role (station and ap) now in my version of the mainline driver so once the mainline version of the armbian image integrates it you shouldn't need to do tricks to get it working.

Link to comment
Share on other sites

No. See my post https://forum.armbian.com/index.php/topic/3046-opi-zero-and-hostapd/#entry21921. No WPA in there.

 

 

Exactly. Hostapd accepts the client device, but then does not receive the client's acknowledgement. But with my workaround client connection on every bootup in place (again, see my post https://forum.armbian.com/index.php/topic/3046-opi-zero-and-hostapd/#entry21921), this handshake will succeed and hostapd will function with or without encryption. Therefore I do not think that hostapd is the culprit here, but the wlan kernel driver is.

 

(Btw. I know next to nothing about the inner workings of wireless networks. Forgive me if my above terms "accept" and "acknowledgement", and previously, "associate" and "authenticate" are incorrect. This is just what I understood from the hostapd debug messages.)

 

The reason for the association failures in "cold" state (i.e. without initiating a connection where opi0 is the client) after bootup may be that either the "acceptance" message is not transmitted by the wlan0 driver to the client, or that the wlan0 driver does not forward a received "acknowledgement" event to hostapd.

 

It appears to me that your system does not have enough entropy generated to establish a secure connection for the access point. The reason your "workaround" seems to work is because it helps create entropy.

Link to comment
Share on other sites

Interesting. Anyhow I have hostapd (wpa_supplicant in ap mode) working with WPA etc in dual role (station and ap) now in my version of the mainline driver so once the mainline version of the armbian image integrates it you shouldn't need to do tricks to get it working.

I'm trying to set my OPI Zero in dual mode. Could you please share your steps?

Link to comment
Share on other sites

Interesting. Anyhow I have hostapd (wpa_supplicant in ap mode) working with WPA etc in dual role (station and ap) now in my version of the mainline driver so once the mainline version of the armbian image integrates it you shouldn't need to do tricks to get it working.

 

I would also like to know how you did it.

 

https://forum.armbian.com/index.php/topic/3355-orange-pi-zero-wifi-apmanaged/

Link to comment
Share on other sites

If you just want to setup an access point, you can use nmcli, like this:

sudo nmcli connection add type wifi ifname * con-name my-connection-name autoconnect yes ssid MySSID mode ap
sudo nmcli connection modify my-connection-name 802-11-wireless.mode ap 802-11-wireless-security.key-mgmt wpa-psk ipv4.method shared 802-11-wireless-security.psk 'MyPassword123456'
sudo nmcli connection up my-connection-name
Link to comment
Share on other sites

That link says "an encrypted wireless network requires entropy". That's understood. No questions about that.

 

You have suggested that also my unencrypted example network from post 13 requires entropy. Could you please explain why?

 

Actually I see a rise in available entropy from the start of hostapd. That alone does not contradict your suggestion, as there might be an entropy valley during the start that I do not detect with my before and after measurements.

Link to comment
Share on other sites

On 2/2/2017 at 2:17 AM, SomeArmbianForumUser said:

That link says "an encrypted wireless network requires entropy". That's understood. No questions about that.

 

You have suggested that also my unencrypted example network from post 13 requires entropy. Could you please explain why?

 

Actually I see a rise in available entropy from the start of hostapd. That alone does not contradict your suggestion, as there might be an entropy valley during the start that I do not detect with my before and after measurements.

 

As I understand it, hostapd uses entropy for cryptographic functions, so even though you have an open network (i.e, no password required to connect to it), you would still need entropy to establish a secured, encrypted connection between server and client (kind of like https on a website that does not require authentication). Of course, I could be mistaken about the cause of the issues discussed here and about how hostapd actually works, so it is just an educated guess on my part. At any rate, the source code is available here for inspection: https://w1.fi/cgit/hostap/tree/

Link to comment
Share on other sites

Hi! I apologize for the literacy, I'm writing with an interpreter. I have a problem whit  armbian and hostapd. I set up a standard access point without any frills. I also use the USB-LTE modem. Everything works well, until  connect a new wi-fi client. Next, my orange pi zero can work no more than 5 minutes and freeze. helps only reboot. I thought that there was not enough power, but increasing the power supply to 2A did not change anything. What do you think is the problem?

In a couple of minutes I'll try to use an external usb-wifi and add the results.

 

P.S.: External Wi-FI ALFA AWUS036HN works fine. whit 2 clients. 

Edited by Ulis_Paxton
Link to comment
Share on other sites

3 hours ago, Ulis_Paxton said:

External Wi-FI ALFA AWUS036HN works fine. whit 2 clients. 


Unfortunately, Orangepi Zero wireless (check our frustration with forum search) is half broken and there is nothing to do about. We lost hope that this crappy chip will ever be fully usable. Stay away from wireless chip labeled XR819.

 

Use some external USB or any other board but beware none is capable of handling many clients.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines