Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Hostapd - Raspberry PI 3 - gentoo-on-rpi3-64bit [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
janbielanski
n00b
n00b


Joined: 06 Jul 2019
Posts: 32
Location: Krakow

PostPosted: Mon Jul 22, 2019 3:29 pm    Post subject: Hostapd - Raspberry PI 3 - gentoo-on-rpi3-64bit [SOLVED] Reply with quote

Hello, I am using ARM64 Gentoo on Raspberry PI 3B+ from this project: https://github.com/sakaki-/gentoo-on-rpi3-64bit .
My system do not use graphics interface and also I removed networkmanager (I don not start this service) and IPv6.
Code:

equery uses dev-embedded/rpi3-64bit-meta
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for dev-embedded/rpi3-64bit-meta-1.4.2:
 U I
 - - apps         : Pull in baseline desktop apps (libreoffice etc.). Requires xfce.
 + + boot-fw      : Pull in the /boot firmware, configs and bootloader.
 + + core         : Pull in core system packages for image (sudo etc.).
 - - kernel-bin   : Pull in the binary kernel package.
 - - pitop        : Pull in Pi-Top support packages (NB most users will NOT want this). Requires xfce.
 - - porthash     : Pull in repo signature checker, for isshoni.org rsync.
 + + weekly-genup : Pull in cron.weekly script, to run genup automatically.
 - - xfce         : Pull in packages for baseline Xfce4 system. Requires core.

Code:

rc-update
            alsasound | boot                                   
               binfmt | boot                                   
            bluetooth |      default                           
             bootmisc | boot                                   
              cgroups |                                 sysinit
              chronyd |      default                           
           consolekit |      default                           
               cronie |      default                           
                cupsd |      default                           
                 dbus |      default                           
                devfs |                                 sysinit
                dmesg |                                 sysinit
              dnsmasq |      default                           
                 fsck | boot                                   
                 gpsd |      default                           
             hostname | boot                                   
              hwclock | boot                                   
              keymaps | boot                                   
            killprocs |                        shutdown       
    kmod-static-nodes |                                 sysinit
                local |      default nonetwork                 
           localmount | boot                                   
             loopback | boot                                   
              modules | boot                                   
             mount-ro |                        shutdown       
                 mtab | boot                                   
             net.eth0 |      default                           
             netmount |      default                           
     opentmpfiles-dev |                                 sysinit
   opentmpfiles-setup | boot                                   
               procfs | boot                                   
                 rngd | boot                                   
                 root | boot                                   
       rpi3-bluetooth |      default                           
          rpi3-ethfix |      default                           
     rpi3-expand-swap |      default                           
          rpi3-i2cdev | boot                                   
        rpi3-ondemand |                                 sysinit
           rpi3-zswap |      default                           
         save-keymaps | boot                                   
    save-termencoding | boot                                   
            savecache |                        shutdown       
                 sshd |      default                           
                 swap | boot                                   
               sysctl | boot                                   
                sysfs |                                 sysinit
            syslog-ng |      default                           
         termencoding | boot                                   
                 udev |                                 sysinit
         udev-trigger |                                 sysinit
              urandom | boot

But for RPI3 system I needed Wi-Fi in access-point mode. So I was following this manual: https://wiki.gentoo.org/wiki/Hostapd
My current configuration for hostapd and net are:
/etc/hostapd/hostapd.conf:
Code:

interface=wlan0
ssid=Astro-PI64
country_code=PL
ieee80211d=1
hw_mode=g
channel=10
auth_algs=1
wmm_enabled=1
ieee80211n=1
ieee80211ac=1
eap_server=0
wpa=2
wpa_psk=***
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP

/etc/conf.d/net:
Code:

# DNS Domain
dns_domain_lo="astro-pi64.org"

# CONFIG eth0 [network access]
config_eth0="dhcp"

# WIFI ACCESS POINT

# Loaded modules:
# ip6to4 ip6rd dhcpcd udhcpc dhclient vlan system pppd iproute2 ifconfig
# ssidnet wpa_supplicant iw iwconfig ipppd ifplugd netplugd macnet macchanger
# macvlan hsr dummy ethtool ccwgroup bridge tuntap l2tp br2684ctl bonding arping apipa

# ** network connection
#modules_wlan0="wpa_supplicant"
#config_wlan0="dhcp"

# ** access point
modules_wlan0="!iwconfig !wpa_supplicant"
#modules_wlan0="!wpa_supplicant"
config_wlan0="192.168.66.3/24 brd 192.168.66.0"
routes_wlan0="default via 192.168.66.1"
rc_net_wlan0_provide="!net"

Unfortunately when I tried to start hostapd service the I received following outputs:
Code:

rc-service hostapd start
 * Bringing up interface wlan0
 *   Configuring wireless network for wlan0
 *   Scanning for access points
 *     Found "UPC Wi-Free" at C6:27:95:BC:2A:50,
 *     Found "RheaUPC" at C4:27:95:BC:2A:5E, , encrypted
 *     Found "UPC Wi-Free" at 56:67:11:50:2D:D4,
 *     Found "UPC7891EB2" at 54:67:51:50:2D:D4, , encrypted
 *     Found "UPC7891EB2" at 54:67:51:50:2D:9E, , encrypted
 *     Found "UPC0830682" at 8C:04:FF:F4:C8:F0, , encrypted
 *     Found "UPC Wi-Free" at 3A:43:1D:EF:10:40,
 *     Found "UPC6612246" at 38:43:7D:EF:10:40, , encrypted
 *     Found "NETIASPOT-C060B0" at 00:12:2A:C0:60:B8, , encrypted
 *     Found "UPC Wi-Free" at AE:22:15:1D:8C:33,
 *   Connecting to "UPC Wi-Free" in managed mode (WEP Disabled) ...                                                                                                                                                                      [ !! ]
 *   "RheaUPC" uses WPA, please use wpa_supplicant for this SSID
 *   Connecting to "UPC Wi-Free" in managed mode (WEP Disabled) ...                                                                                                                                                                      [ !! ]
 *   "UPC7891EB2" uses WPA, please use wpa_supplicant for this SSID
 *   "UPC7891EB2" uses WPA, please use wpa_supplicant for this SSID
 *   "UPC0830682" uses WPA, please use wpa_supplicant for this SSID
 *   Connecting to "UPC Wi-Free" in managed mode (WEP Disabled) ...                                                                                                                                                                      [ !! ]
 *   "UPC6612246" uses WPA, please use wpa_supplicant for this SSID
 *   "NETIASPOT-C060B0" uses WPA, please use wpa_supplicant for this SSID
 *   Connecting to "UPC Wi-Free" in managed mode (WEP Disabled) ...                                                                                                                                                                      [ !! ]
 *   Couldn't find any access points on wlan0
 *   Failed to configure wireless for wlan0
 * ERROR: net.wlan0 failed to start
 * ERROR: cannot start hostapd as net.wlan0 would not start

I don know why the wlan0 mode not switch into AP mode and it is still trying looking for access points.
When I run hostapd manually i received following debug message (hostapd /etc/hostapd/hostapd.conf -d):
Code:

random: Trying to read entropy from /dev/random
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: Setup AP(wlan0) - device_ap_sme=1 use_monitor=0
nl80211: Subscribe to mgmt frames with AP handle 0x55ab803500 (device SME)
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x55ab803500 match=04
nl80211: Register frame command failed (type=208): ret=-22 (Invalid argument)
nl80211: Register frame match - hexdump(len=1): 04
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x55ab803500 match=0501
nl80211: Register frame command failed (type=208): ret=-22 (Invalid argument)
nl80211: Register frame match - hexdump(len=2): 05 01
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x55ab803500 match=0503
nl80211: Register frame command failed (type=208): ret=-22 (Invalid argument)
nl80211: Register frame match - hexdump(len=2): 05 03
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x55ab803500 match=0504
nl80211: Register frame command failed (type=208): ret=-22 (Invalid argument)
nl80211: Register frame match - hexdump(len=2): 05 04
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x55ab803500 match=06
nl80211: Register frame command failed (type=208): ret=-22 (Invalid argument)
nl80211: Register frame match - hexdump(len=1): 06
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x55ab803500 match=08
nl80211: Register frame command failed (type=208): ret=-22 (Invalid argument)
nl80211: Register frame match - hexdump(len=1): 08
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x55ab803500 match=09
nl80211: Register frame command failed (type=208): ret=-22 (Invalid argument)
nl80211: Register frame match - hexdump(len=1): 09
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x55ab803500 match=0a
nl80211: Register frame command failed (type=208): ret=-22 (Invalid argument)
nl80211: Register frame match - hexdump(len=1): 0a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x55ab803500 match=11
nl80211: Register frame command failed (type=208): ret=-22 (Invalid argument)
nl80211: Register frame match - hexdump(len=1): 11
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x55ab803500 match=12
nl80211: Register frame command failed (type=208): ret=-22 (Invalid argument)
nl80211: Register frame match - hexdump(len=1): 12
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x55ab803500 match=7f
nl80211: Register frame command failed (type=208): ret=-22 (Invalid argument)
nl80211: Register frame match - hexdump(len=1): 7f
nl80211: Failed to subscribe for mgmt frames from SME driver - trying to run without it
nl80211: Enable Probe Request reporting nl_preq=0x55ab803500
nl80211: Register frame type=0x40 (WLAN_FC_STYPE_PROBE_REQ) nl_handle=0x55ab803500 match=
nl80211: Register frame command failed (type=64): ret=-22 (Invalid argument)
nl80211: Register frame match - hexdump(len=0): [NULL]
nl80211: Failed to enable Probe Request frame reporting in AP mode
rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0
nl80211: Add own interface ifindex 3 (ifidx_reason -1)
nl80211: if_indices[16]: 3(-1)
phy: phy0
BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)
wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
Previous country code PL, new country code PL
nl80211: Regulatory information - country=PL (DFS-ETSI)
nl80211: 2402-2482 @ 40 MHz 20 mBm
nl80211: 5170-5250 @ 80 MHz 20 mBm
nl80211: 5250-5330 @ 80 MHz 20 mBm (DFS)
nl80211: 5490-5710 @ 160 MHz 27 mBm (DFS)
nl80211: 57000-66000 @ 2160 MHz 40 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: 10  Frequency: 2457 MHz
DFS 0 channels required radar detection
nl80211: Set freq 2457 (ht_enabled=1, vht_enabled=1, bandwidth=20 MHz, cf1=2457 MHz, cf2=0 MHz)
  * freq=2457
  * vht_enabled=1
  * ht_enabled=1
  * bandwidth=20
  * channel_width=1
  * center_freq1=2457
  * center_freq2=0
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=0x55ab8001c0 (wlan0), first=1)
wlan0: Flushing old station entries
nl80211: flush -> DEL_STATION wlan0 (all)
nl80211: Station flush failed: ret=-14 (Bad address)
wlan0: Could not connect to kernel driver
wlan0: Deauthenticate all stations
nl80211: sta_remove -> DEL_STATION wlan0 ff:ff:ff:ff:ff:ff --> 0 (Success)
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-22 Invalid argument)
Failed to clear default encryption keys (ifname=wlan0 keyidx=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
nl80211: set_key failed; err=-22 Invalid argument)
Failed to clear default encryption keys (ifname=wlan0 keyidx=2)
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-22 Invalid argument)
Failed to clear default encryption keys (ifname=wlan0 keyidx=3)
Using interface wlan0 with hwaddr b8:27:eb:33:13:42 and ssid "Astro-PI64"
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=61): 80 00 00 00 ff ff ff ff ff ff b8 27 eb 33 13 42 b8 27 eb 33 13 42 00 00 00 00 00 00 00 00 00 00 64 00 11 04 00 0a 41 73 74 72 6f 2d 50 49 36 34 01 08 82 84 8b 96 0c 12 18 24 03 01 0a
nl80211: Beacon tail - hexdump(len=148): 07 06 50 4c 20 01 0d 14 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 0c 00 2d 1a 0c 00 1f ff 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 3d 16 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7f 04 00 00 00 02 bf 0c 00 00 00 00 ff ff 00 00 ff ff 00 00 c0 05 00 00 00 fc ff c3 02 00 28 dd 18 00 50 f2 02 01 01 00 00 03 a4 00 00 27 a4 00 00 42 43 5e 00 62 32 2f 00
nl80211: ifindex=3
nl80211: beacon_int=100
nl80211: beacon_rate=0
nl80211: rate_type=0
nl80211: dtim_period=2
nl80211: ssid - hexdump_ascii(len=10):
     41 73 74 72 6f 2d 50 49 36 34                     Astro-PI64     
  * beacon_int=100
  * dtim_period=2
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=0x10
nl80211: group_cipher=0x10
nl80211: SMPS mode - off
nl80211: beacon_ies - hexdump(len=6): 7f 04 00 00 00 02
nl80211: proberesp_ies - hexdump(len=6): 7f 04 00 00 00 02
nl80211: assocresp_ies - hexdump(len=6): 7f 04 00 00 00 02
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=0x557b8a2fd0 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)
nl80211: TX queue param set: queue=0 aifs=1 cw_min=3 cw_max=7 burst_time=15 --> res=-95
Failed to set TX queue parameters for queue 0.
nl80211: TX queue param set: queue=1 aifs=1 cw_min=7 cw_max=15 burst_time=30 --> res=-95
Failed to set TX queue parameters for queue 1.
nl80211: TX queue param set: queue=2 aifs=3 cw_min=15 cw_max=63 burst_time=0 --> res=-95
Failed to set TX queue parameters for queue 2.
nl80211: TX queue param set: queue=3 aifs=7 cw_min=15 cw_max=1023 burst_time=0 --> res=-95
Failed to set TX queue parameters for queue 3.
wlan0: interface state COUNTRY_UPDATE->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=0x1003 ([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)

And after ifconfig and iw:
Code:

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether b8:27:eb:33:13:42  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 38  bytes 3956 (3.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Code:

iw wlan0 info
Interface wlan0
        ifindex 3
        wdev 0x1
        addr b8:27:eb:33:13:42
        ssid Astro-PI64
        type AP
        wiphy 0
        channel 10 (2457 MHz), width: 20 MHz, center1: 2457 MHz
        txpower 0.00 dBm

I don't know what I was missing. Which kernel module I should also install? Which network driver I need or don't need also in /etc/conf.d/net? Which services I need to disable on start?


Last edited by janbielanski on Thu Jul 25, 2019 3:50 pm; edited 1 time in total
Back to top
View user's profile Send private message
Sakaki
Guru
Guru


Joined: 21 May 2014
Posts: 409

PostPosted: Wed Jul 24, 2019 8:32 pm    Post subject: Reply with quote

Hi janbielanski,

sorry to hear you are having problems with this ><

As a first step, please note that to make it lawfully redistributable, the image has been created with the bindist USE flag set globally. This impacts many of the (encumbered) algos required for successful operation of e.g. hostapd.

So, if you try unsetting this flag globally (in /etc/portage/make.conf) and re-emerging, you may have better luck.
_________________
Regards,

sakaki
Back to top
View user's profile Send private message
janbielanski
n00b
n00b


Joined: 06 Jul 2019
Posts: 32
Location: Krakow

PostPosted: Thu Jul 25, 2019 3:50 pm    Post subject: Reply with quote

Problem has been solved. The source of problem was configuration file:
Code:

# DNS Domain
dns_domain_lo="astro-pi64.org"

# CONFIG eth0 [network access]
config_eth0="dhcp"

# WIFI ACCESS POINT
# ** network connection
#modules_wlan0="wpa_supplicant"
#config_wlan0="dhcp"
# ** access point
modules_wlan0="[b]!iw[/b] !iwconfig !wpa_supplicant"
config_wlan0="192.168.66.3/24 brd 192.168.66.0"
routes_wlan0="default via 192.168.66.1"
rc_net_wlan0_provide="!net"

I missed to exclude completely iw interface (!iwconfig is not enough, I have to exclude also !iw).
I had seen this mistake when I tried to setup AP on on computer for testing.
Back to top
View user's profile Send private message
necktwi
Apprentice
Apprentice


Joined: 24 Aug 2018
Posts: 171

PostPosted: Tue Feb 18, 2020 6:08 am    Post subject: Reply with quote

I wonder how you figured out to use !iw because we don't have to use it with x86_64 gentoo.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum