garywill / linux-router

Set Linux as router in one command. Support Internet sharing, redsocks, Wifi hotspot, IPv6. Can also be used for routing VM/containers 🛰️
GNU Lesser General Public License v2.1
1.73k stars 153 forks source link

ERROR: Hostapd failed #78

Open aleksejs-fomins opened 3 months ago

aleksejs-fomins commented 3 months ago

sudo ./lnxrouter --ap wlp1s0 MyAccessPoint -p MyPassPhrase --hostapd-debug 2

linux-router 0.7.6b (https://github.com/garywill/linux-router)
Released under LGPL, with no warranty. Use on your own risk.

PID: 22500
Target interface is wlp1s0 (14:ac:60:d8:2c:01) 
PCI: 0000:01:00.0
System-already-loaded driver: mt7921e
 Network controller [0280]: MEDIATEK Corp. Device [14c3:0616]

Use random LAN IPv4 address 192.168.200.1
wlp1s0 already working in channel 48 (5240 MHz)
Use wifi adapter current channel 48 as target channel
Creating a virtual WiFi interface... 
x0wlp1s0 created
Set x0wlp1s0 unmanaged by NetworkManager
Assigning MAC address 14:ac:60:d8:2c:0b to virtual interface x0wlp1s0 according to wlp1s0 ...

iptables v1.8.7 (nf_tables)
Notice: Not showing all operations done to iptables rules

haveged_watchdog PID: 22649

Starting hostapd
WARN: Low entropy detected. We recommend you to install `haveged'
hostapd PID: 22655
random: getrandom() support available
Configuration file: /dev/shm/lnxrouter_tmp/lnxrouter.wlp1s0.conf.8kWHhl/hostapd.conf
ctrl_interface_group=0
nl80211: TDLS supported
nl80211: TDLS external setup
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: Supported cipher 00-0f-ac:6
nl80211: Supported cipher 00-0f-ac:13
nl80211: Supported cipher 00-0f-ac:11
nl80211: Supported cipher 00-0f-ac:12
nl80211: Using driver-based off-channel TX
nl80211: Driver-advertised extended capabilities (default) - hexdump(len=8): 00 00 00 00 00 00 00 40
nl80211: Driver-advertised extended capabilities mask (default) - hexdump(len=8): 00 00 00 00 00 00 00 40
nl80211: Use separate P2P group interface (driver advertised support)
nl80211: Enable multi-channel concurrent (driver advertised support)
nl80211: key_mgmt=0x1ff0f enc=0xfef auth=0x7 flags=0x24003d10d35bfbe0 rrm_flags=0x30 probe_resp_offloads=0x0 max_stations=0 max_remain_on_chan=5000 max_scan_ssids=4
nl80211: interface x0wlp1s0 in phy phy0
nl80211: Set mode ifindex 8 iftype 3 (AP)
nl80211: Failed to set interface 8 to mode 3: -16 (Device or resource busy)
nl80211: Try mode change after setting interface down
nl80211: Set mode ifindex 8 iftype 3 (AP)
nl80211: Mode change succeeded while interface is down
nl80211: Setup AP(x0wlp1s0) - device_ap_sme=0 use_monitor=0
nl80211: Subscribe to mgmt frames with AP handle 0x62d7af12f420
nl80211: Register frame type=0xb0 (WLAN_FC_STYPE_AUTH) nl_handle=0x62d7af12f420 match= multicast=0
nl80211: Register frame type=0x0 (WLAN_FC_STYPE_ASSOC_REQ) nl_handle=0x62d7af12f420 match= multicast=0
nl80211: Register frame type=0x20 (WLAN_FC_STYPE_REASSOC_REQ) nl_handle=0x62d7af12f420 match= multicast=0
nl80211: Register frame type=0xa0 (WLAN_FC_STYPE_DISASSOC) nl_handle=0x62d7af12f420 match= multicast=0
nl80211: Register frame type=0xc0 (WLAN_FC_STYPE_DEAUTH) nl_handle=0x62d7af12f420 match= multicast=0
nl80211: Register frame type=0x40 (WLAN_FC_STYPE_PROBE_REQ) nl_handle=0x62d7af12f420 match= multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x62d7af12f420 match=04 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x62d7af12f420 match=0501 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x62d7af12f420 match=0503 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x62d7af12f420 match=0504 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x62d7af12f420 match=06 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x62d7af12f420 match=08 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x62d7af12f420 match=09 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x62d7af12f420 match=0a multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x62d7af12f420 match=11 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x62d7af12f420 match=12 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x62d7af12f420 match=7f multicast=0
rfkill: initial event: idx=1 type=1 op=0 soft=0 hard=0
nl80211: Add own interface ifindex 8 (ifidx_reason -1)
nl80211: if_indices[16]: 8(-1)
nl80211: Do not open EAPOL RX socket - using control port for RX
phy: phy0
BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)
nl80211: Regulatory information - country=CH (DFS-ETSI)
nl80211: 2400-2483 @ 40 MHz 20 mBm
nl80211: 5150-5250 @ 80 MHz 23 mBm (no outdoor)
nl80211: 5250-5350 @ 80 MHz 20 mBm (no outdoor) (DFS)
nl80211: 5470-5725 @ 160 MHz 26 mBm (DFS)
nl80211: 5725-5875 @ 80 MHz 13 mBm
nl80211: 57000-66000 @ 2160 MHz 40 mBm
nl80211: Added 802.11b mode based on 802.11g information
nl80211: Mode IEEE 802.11g: 2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472 2484[DISABLED][NO_IR]
nl80211: Mode IEEE 802.11a: 5180 5200 5220 5240 5260[RADAR] 5280[RADAR] 5300[RADAR] 5320[RADAR] 5500[RADAR] 5520[RADAR] 5540[RADAR] 5560[RADAR] 5580[RADAR] 5600[RADAR] 5620[RADAR] 5640[RADAR] 5660[RADAR] 5680[RADAR]
nl80211: Mode IEEE 802.11a: 5955[DISABLED] 5975[DISABLED] 5995[DISABLED] 6015[DISABLED] 6035[DISABLED] 6055[DISABLED] 6075[DISABLED] 6095[DISABLED] 6115[DISABLED] 6135[DISABLED] 6155[DISABLED] 6175[DISABLED] 6195[DISABLED]
nl80211: Mode IEEE 802.11b: 2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472 2484[DISABLED][NO_IR]
Allowed channel: mode=1 chan=1 freq=2412 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=2 freq=2417 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=3 freq=2422 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=4 freq=2427 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=5 freq=2432 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=6 freq=2437 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=7 freq=2442 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=8 freq=2447 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=9 freq=2452 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=10 freq=2457 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=11 freq=2462 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=12 freq=2467 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=13 freq=2472 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=36 freq=5180 MHz max_tx_power=23 dBm
Allowed channel: mode=2 chan=40 freq=5200 MHz max_tx_power=23 dBm
Allowed channel: mode=2 chan=44 freq=5220 MHz max_tx_power=23 dBm
Allowed channel: mode=2 chan=48 freq=5240 MHz max_tx_power=23 dBm
Allowed channel: mode=2 chan=149 freq=5745 MHz max_tx_power=13 dBm
Allowed channel: mode=2 chan=153 freq=5765 MHz max_tx_power=13 dBm
Allowed channel: mode=2 chan=157 freq=5785 MHz max_tx_power=13 dBm
Allowed channel: mode=2 chan=161 freq=5805 MHz max_tx_power=13 dBm
Allowed channel: mode=2 chan=165 freq=5825 MHz max_tx_power=13 dBm
Allowed channel: mode=2 chan=169 freq=5845 MHz max_tx_power=13 dBm
Allowed channel: mode=2 chan=173 freq=5865 MHz max_tx_power=13 dBm
Allowed channel: mode=0 chan=1 freq=2412 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=2 freq=2417 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=3 freq=2422 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=4 freq=2427 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=5 freq=2432 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=6 freq=2437 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=7 freq=2442 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=8 freq=2447 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=9 freq=2452 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=10 freq=2457 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=11 freq=2462 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=12 freq=2467 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=13 freq=2472 MHz max_tx_power=20 dBm
Could not determine operating frequency
x0wlp1s0: interface state UNINITIALIZED->DISABLED
x0wlp1s0: AP-DISABLED 
x0wlp1s0: Unable to setup interface.
hostapd_interface_deinit_free(0x62d7af129a50)
hostapd_interface_deinit_free: num_bss=1 conf->num_bss=1
hostapd_interface_deinit(0x62d7af129a50)
x0wlp1s0: interface state DISABLED->DISABLED
hostapd_bss_deinit: deinit bss x0wlp1s0
x0wlp1s0: 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 no_encrypt=0 fc=0xc0 (WLAN_FC_STYPE_DEAUTH) nlmode=3
nl80211: send_mlme - Use bss->freq=0
nl80211: send_mlme -> send_frame_cmd
nl80211: CMD_FRAME freq=0 wait=0 no_cck=0 no_ack=0 offchanok=0
CMD_FRAME - hexdump(len=26): c0 00 00 00 ff ff ff ff ff ff 14 ac 60 d8 2c 0b 14 ac 60 d8 2c 0b 00 00 03 00
nl80211: Frame command failed: ret=-22 (Invalid argument) (freq=0 wait=0)
x0wlp1s0: AP-DISABLED 
hostapd_cleanup(hapd=0x62d7af12b1e0 (x0wlp1s0))
x0wlp1s0: CTRL-EVENT-TERMINATING 
hostapd_free_hapd_data: Interface x0wlp1s0 wasn't started
hostapd_interface_deinit_free: driver=0x62d7ae51f980 drv_priv=0x62d7af12f8c0 -> hapd_deinit
nl80211: deinit ifname=x0wlp1s0 disabled_11b_rates=0
nl80211: Remove monitor interface: refcount=0
nl80211: Remove beacon (ifindex=8)
netlink: Operstate: ifindex=8 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
nl80211: Set mode ifindex 8 iftype 2 (STATION)
nl80211: Failed to set interface 8 to mode 2: -16 (Device or resource busy)
nl80211: Try mode change after setting interface down
nl80211: Set mode ifindex 8 iftype 2 (STATION)
nl80211: Mode change succeeded while interface is down
nl80211: Teardown AP(x0wlp1s0) - device_ap_sme=0 use_monitor=0
nl80211: Unsubscribe mgmt frames handle 0x8888ea5f279a7ca9 (AP teardown)
hostapd_interface_free(0x62d7af129a50)
hostapd_interface_free: free hapd 0x62d7af12b1e0
hostapd_cleanup_iface(0x62d7af129a50)
hostapd_cleanup_iface_partial(0x62d7af129a50)
hostapd_cleanup_iface: free iface=0x62d7af129a50

iptables: NAT 
MASQUERADE  all opt -- in * out !x0wlp1s0  192.168.200.0/24 !-> 192.168.200.0/24   /* lrt22500x0wlp1s0 */
ACCEPT  all opt -- in x0wlp1s0 out *  192.168.200.0/24  -> 0.0.0.0/0   /* lrt22500x0wlp1s0 */
ACCEPT  all opt -- in * out x0wlp1s0  0.0.0.0/0  -> 192.168.200.0/24   /* lrt22500x0wlp1s0 */
Loaded kernel module nf_nat_pptp

iptables: allow DNS
ACCEPT  tcp opt -- in x0wlp1s0 out *  192.168.200.0/24  -> 192.168.200.1   tcp dpt:53 /* lrt22500x0wlp1s0 */
ACCEPT  udp opt -- in x0wlp1s0 out *  192.168.200.0/24  -> 192.168.200.1   udp dpt:53 /* lrt22500x0wlp1s0 */

iptables: allow dhcp
ACCEPT  udp opt -- in x0wlp1s0 out *  0.0.0.0/0  -> 0.0.0.0/0   udp dpt:67 /* lrt22500x0wlp1s0 */

Starting dnsmasq
Jul  8 17:44:51 dnsmasq[22676]: started, version 2.90 cachesize 150
Jul  8 17:44:51 dnsmasq[22676]: compile time options: IPv6 GNU-getopt DBus no-UBus i18n IDN2 DHCP DHCPv6 no-Lua TFTP conntrack ipset no-nftset auth cryptohash DNSSEC loop-detect inotify dumpfile
Jul  8 17:44:51 dnsmasq-dhcp[22676]: DHCP, IP range 192.168.200.10 -- 192.168.200.250, lease time 1h
Jul  8 17:44:51 dnsmasq-dhcp[22676]: DHCP, sockets bound exclusively to interface x0wlp1s0
Jul  8 17:44:51 dnsmasq[22676]: reading /etc/resolv.conf
Jul  8 17:44:51 dnsmasq[22676]: using nameserver 127.0.0.53#53
Jul  8 17:44:51 dnsmasq[22676]: cleared cache
dnsmasq PID: 22676

== Setting up completed, now linux-router should be working ==
Error occured

ERROR: hostapd failed. (tip: try '--hostapd-debug' to get some debug info)

Error occured

Doing cleanup.. 
Jul  8 17:44:58 dnsmasq[22676]: exiting on receipt of SIGTERM
Killed dnsmasq.pid 22676 dnsmasq
Terminated
Killed haveged_watchdog.pid 22649 lnxrouter
Killed keep_running.pid 22699 bash
Undoing iptables changes ..
Exiting: This is the only running instance
Cleaning up done

Suggestions?