You are not logged in.

#1 2017-05-21 16:38:07

momokrono
Member
Registered: 2016-10-27
Posts: 54

hostapd troubles

Hi everyone,
i want to create an ap with a d-link usb adapter.
i've been using a pci wifi card with no problem for months, now i want to extend the wifi net using this other card. i've tested it with my other pc, running kali linux, and i've had no problem at all, now on arch i cannot start the ap.
running "#systemctl start hostapd" i get "failed", and i don't know why :\
thank you in advance!

Offline

#2 2017-05-21 17:06:46

ayekat
Member
Registered: 2011-01-17
Posts: 1,634

Re: hostapd troubles

For a start, please paste the output of these commands:

systemctl status hostapd
journalctl -u hostapd
cat /etc/hostapd/hostapd.conf

pkgs │ hacks │ cfg │ blag

Offline

#3 2017-05-21 21:14:03

momokrono
Member
Registered: 2016-10-27
Posts: 54

Re: hostapd troubles

systemctl status hostapd:

● hostapd.service - Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
   Loaded: loaded (/usr/lib/systemd/system/hostapd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2017-05-21 23:09:48 CEST; 2s ago
  Process: 6503 ExecStart=/usr/bin/hostapd /etc/hostapd/hostapd.conf (code=exited, status=1/FAILURE)
 Main PID: 6503 (code=exited, status=1/FAILURE)

May 21 23:09:48 1-desktop systemd[1]: Started Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator.
May 21 23:09:48 1-desktop hostapd[6503]: Configuration file: /etc/hostapd/hostapd.conf
May 21 23:09:48 1-desktop hostapd[6503]: Could not open configuration file '/etc/hostapd/hostapd.conf' for reading.
May 21 23:09:48 1-desktop hostapd[6503]: Failed to set up interface with /etc/hostapd/hostapd.conf
May 21 23:09:48 1-desktop hostapd[6503]: Failed to initialize interface
May 21 23:09:48 1-desktop systemd[1]: hostapd.service: Main process exited, code=exited, status=1/FAILURE
May 21 23:09:48 1-desktop systemd[1]: hostapd.service: Unit entered failed state.
May 21 23:09:48 1-desktop systemd[1]: hostapd.service: Failed with result 'exit-code'.
Failed to get journal cutoff time: Bad message

journalctl -u hostapd

May 21 23:09:48 1-desktop systemd[1]: Started Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator.
May 21 23:09:48 1-desktop hostapd[6503]: Configuration file: /etc/hostapd/hostapd.conf
May 21 23:09:48 1-desktop hostapd[6503]: Could not open configuration file '/etc/hostapd/hostapd.conf' for reading.
May 21 23:09:48 1-desktop hostapd[6503]: Failed to set up interface with /etc/hostapd/hostapd.conf
May 21 23:09:48 1-desktop hostapd[6503]: Failed to initialize interface
May 21 23:09:48 1-desktop systemd[1]: hostapd.service: Main process exited, code=exited, status=1/FAILURE
May 21 23:09:48 1-desktop systemd[1]: hostapd.service: Unit entered failed state.
May 21 23:09:48 1-desktop systemd[1]: hostapd.service: Failed with result 'exit-code'.

cat /etc/hostapd/hostapd.conf:

 No such file or directory

Offline

#4 2017-05-21 21:39:01

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: hostapd troubles

As the journal output states, you don't have a /etc/hostapd/hostapd.conf configuration file.

Copy it from /usr/share/doc/hostapd/hostapd.conf and edit it to your needs.

Last edited by Slithery (2017-05-21 21:40:36)


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#5 2017-05-21 21:55:22

momokrono
Member
Registered: 2016-10-27
Posts: 54

Re: hostapd troubles

i've cp that file into /etc/hostapd/hostapd.conf and changed the interface to wlp0s20f0u4. i tried to start it again but i get

● hostapd.service - Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
   Loaded: loaded (/usr/lib/systemd/system/hostapd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2017-05-21 23:51:41 CEST; 41s ago
  Process: 7653 ExecStart=/usr/bin/hostapd /etc/hostapd/hostapd.conf (code=exited, status=1/FAILURE)
 Main PID: 7653 (code=exited, status=1/FAILURE)

May 21 23:51:40 1-desktop hostapd[7653]: Configuration file: /etc/hostapd/hostapd.conf
May 21 23:51:41 1-desktop hostapd[7653]: nl80211: Could not configure driver mode
May 21 23:51:41 1-desktop hostapd[7653]: nl80211: deinit ifname=wlp0s20f0u4 disabled_11b_rates=0
May 21 23:51:41 1-desktop hostapd[7653]: nl80211 driver initialization failed.
May 21 23:51:41 1-desktop hostapd[7653]: wlp0s20f0u4: interface state UNINITIALIZED->DISABLED
May 21 23:51:41 1-desktop hostapd[7653]: wlp0s20f0u4: AP-DISABLED
May 21 23:51:41 1-desktop hostapd[7653]: hostapd_free_hapd_data: Interface wlp0s20f0u4 wasn't started
May 21 23:51:41 1-desktop systemd[1]: hostapd.service: Main process exited, code=exited, status=1/FAILURE
May 21 23:51:41 1-desktop systemd[1]: hostapd.service: Unit entered failed state.
May 21 23:51:41 1-desktop systemd[1]: hostapd.service: Failed with result 'exit-code'.

i've noticed "nl80211 driver initialization failed", maybe the problem is there?

Offline

#6 2017-05-21 22:09:43

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: hostapd troubles

What's the output of...

iw list

No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#7 2017-05-21 22:18:08

momokrono
Member
Registered: 2016-10-27
Posts: 54

Re: hostapd troubles

iw list:

Wiphy phy3
	max # scan SSIDs: 4
	max scan IEs length: 2257 bytes
	max # sched scan SSIDs: 0
	max # match sets: 0
	max # scan plans: 1
	max scan plan interval: -1
	max scan plan iterations: 0
	Retry short limit: 7
	Retry long limit: 4
	Coverage class: 0 (up to 0m)
	Device supports RSN-IBSS.
	Supported Ciphers:
		* WEP40 (00-0f-ac:1)
		* WEP104 (00-0f-ac:5)
		* TKIP (00-0f-ac:2)
		* CCMP-128 (00-0f-ac:4)
		* CCMP-256 (00-0f-ac:10)
		* GCMP-128 (00-0f-ac:8)
		* GCMP-256 (00-0f-ac:9)
	Available Antennas: TX 0 RX 0
	Supported interface modes:
		 * IBSS
		 * managed
		 * AP
		 * AP/VLAN
		 * monitor
		 * mesh point
	Band 1:
		Capabilities: 0x2fe
			HT20/HT40
			SM Power Save disabled
			RX Greenfield
			RX HT20 SGI
			RX HT40 SGI
			TX STBC
			RX STBC 2-streams
			Max AMSDU length: 3839 bytes
			No DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 2 usec (0x04)
		HT TX/RX MCS rate indexes supported: 0-15, 32
		Bitrates (non-HT):
			* 1.0 Mbps
			* 2.0 Mbps (short preamble supported)
			* 5.5 Mbps (short preamble supported)
			* 11.0 Mbps (short preamble supported)
			* 6.0 Mbps
			* 9.0 Mbps
			* 12.0 Mbps
			* 18.0 Mbps
			* 24.0 Mbps
			* 36.0 Mbps
			* 48.0 Mbps
			* 54.0 Mbps
		Frequencies:
			* 2412 MHz [1] (20.0 dBm)
			* 2417 MHz [2] (20.0 dBm)
			* 2422 MHz [3] (20.0 dBm)
			* 2427 MHz [4] (20.0 dBm)
			* 2432 MHz [5] (20.0 dBm)
			* 2437 MHz [6] (20.0 dBm)
			* 2442 MHz [7] (20.0 dBm)
			* 2447 MHz [8] (20.0 dBm)
			* 2452 MHz [9] (20.0 dBm)
			* 2457 MHz [10] (20.0 dBm)
			* 2462 MHz [11] (20.0 dBm)
			* 2467 MHz [12] (20.0 dBm)
			* 2472 MHz [13] (20.0 dBm) (no IR)
			* 2484 MHz [14] (20.0 dBm) (no IR)
	Supported commands:
		 * new_interface
		 * set_interface
		 * new_key
		 * start_ap
		 * new_station
		 * new_mpath
		 * set_mesh_config
		 * set_bss
		 * authenticate
		 * associate
		 * deauthenticate
		 * disassociate
		 * join_ibss
		 * join_mesh
		 * set_tx_bitrate_mask
		 * frame
		 * frame_wait_cancel
		 * set_wiphy_netns
		 * set_channel
		 * set_wds_peer
		 * probe_client
		 * set_noack_map
		 * register_beacons
		 * start_p2p_device
		 * set_mcast_rate
		 * connect
		 * disconnect
		 * set_qos_map
	Supported TX frame types:
		 * IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * mesh point: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * P2P-device: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
	Supported RX frame types:
		 * IBSS: 0x40 0xb0 0xc0 0xd0
		 * managed: 0x40 0xd0
		 * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * mesh point: 0xb0 0xc0 0xd0
		 * P2P-client: 0x40 0xd0
		 * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * P2P-device: 0x40 0xd0
	software interface modes (can always be added):
		 * AP/VLAN
		 * monitor
	valid interface combinations:
		 * #{ AP, mesh point } <= 8,
		   total <= 8, #channels <= 1
	HT Capability overrides:
		 * MCS: ff ff ff ff ff ff ff ff ff ff
		 * maximum A-MSDU length
		 * supported channel width
		 * short GI for 40 MHz
		 * max A-MPDU length exponent
		 * min MPDU start spacing
	Device supports TX status socket option.
	Device supports HT-IBSS.
	Device supports SAE with AUTHENTICATE command
	Device supports low priority scan.
	Device supports scan flush.
	Device supports AP scan.
	Device supports per-vif TX power setting
	Driver supports full state transitions for AP/GO clients
	Driver supports a userspace MPM
	Device supports configuring vdev MAC-addr on create.
Wiphy phy1
	max # scan SSIDs: 4
	max scan IEs length: 2257 bytes
	max # sched scan SSIDs: 0
	max # match sets: 0
	max # scan plans: 1
	max scan plan interval: -1
	max scan plan iterations: 0
	Retry short limit: 7
	Retry long limit: 4
	Coverage class: 0 (up to 0m)
	Device supports RSN-IBSS.
	Device supports AP-side u-APSD.
	Device supports T-DLS.
	Supported Ciphers:
		* WEP40 (00-0f-ac:1)
		* WEP104 (00-0f-ac:5)
		* TKIP (00-0f-ac:2)
		* CCMP-128 (00-0f-ac:4)
		* CCMP-256 (00-0f-ac:10)
		* GCMP-128 (00-0f-ac:8)
		* GCMP-256 (00-0f-ac:9)
		* CMAC (00-0f-ac:6)
		* CMAC-256 (00-0f-ac:13)
		* GMAC-128 (00-0f-ac:11)
		* GMAC-256 (00-0f-ac:12)
	Available Antennas: TX 0x3 RX 0x3
	Configured Antennas: TX 0x3 RX 0x3
	Supported interface modes:
		 * IBSS
		 * managed
		 * AP
		 * AP/VLAN
		 * monitor
		 * mesh point
		 * P2P-client
		 * P2P-GO
		 * outside context of a BSS
	Band 1:
		Capabilities: 0x11ee
			HT20/HT40
			SM Power Save disabled
			RX HT20 SGI
			RX HT40 SGI
			TX STBC
			RX STBC 1-stream
			Max AMSDU length: 3839 bytes
			DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 8 usec (0x06)
		HT TX/RX MCS rate indexes supported: 0-15
		Bitrates (non-HT):
			* 1.0 Mbps
			* 2.0 Mbps (short preamble supported)
			* 5.5 Mbps (short preamble supported)
			* 11.0 Mbps (short preamble supported)
			* 6.0 Mbps
			* 9.0 Mbps
			* 12.0 Mbps
			* 18.0 Mbps
			* 24.0 Mbps
			* 36.0 Mbps
			* 48.0 Mbps
			* 54.0 Mbps
		Frequencies:
			* 2412 MHz [1] (16.0 dBm)
			* 2417 MHz [2] (16.0 dBm)
			* 2422 MHz [3] (16.0 dBm)
			* 2427 MHz [4] (16.0 dBm)
			* 2432 MHz [5] (16.0 dBm)
			* 2437 MHz [6] (16.0 dBm)
			* 2442 MHz [7] (16.0 dBm)
			* 2447 MHz [8] (16.0 dBm)
			* 2452 MHz [9] (16.0 dBm)
			* 2457 MHz [10] (16.0 dBm)
			* 2462 MHz [11] (16.0 dBm)
			* 2467 MHz [12] (16.0 dBm)
			* 2472 MHz [13] (disabled)
			* 2484 MHz [14] (disabled)
	Supported commands:
		 * new_interface
		 * set_interface
		 * new_key
		 * start_ap
		 * new_station
		 * new_mpath
		 * set_mesh_config
		 * set_bss
		 * authenticate
		 * associate
		 * deauthenticate
		 * disassociate
		 * join_ibss
		 * join_mesh
		 * remain_on_channel
		 * set_tx_bitrate_mask
		 * frame
		 * frame_wait_cancel
		 * set_wiphy_netns
		 * set_channel
		 * set_wds_peer
		 * tdls_mgmt
		 * tdls_oper
		 * probe_client
		 * set_noack_map
		 * register_beacons
		 * start_p2p_device
		 * set_mcast_rate
		 * connect
		 * disconnect
		 * channel_switch
		 * set_qos_map
	Supported TX frame types:
		 * IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * mesh point: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * P2P-device: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
	Supported RX frame types:
		 * IBSS: 0x40 0xb0 0xc0 0xd0
		 * managed: 0x40 0xd0
		 * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * mesh point: 0xb0 0xc0 0xd0
		 * P2P-client: 0x40 0xd0
		 * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * P2P-device: 0x40 0xd0
	software interface modes (can always be added):
		 * AP/VLAN
		 * monitor
	valid interface combinations:
		 * #{ managed } <= 2048, #{ AP, mesh point } <= 8, #{ P2P-client, P2P-GO } <= 1,
		   total <= 2048, #channels <= 1, STA/AP BI must match
	HT Capability overrides:
		 * MCS: ff ff ff ff ff ff ff ff ff ff
		 * maximum A-MSDU length
		 * supported channel width
		 * short GI for 40 MHz
		 * max A-MPDU length exponent
		 * min MPDU start spacing
	Device supports TX status socket option.
	Device supports HT-IBSS.
	Device supports SAE with AUTHENTICATE command
	Device supports low priority scan.
	Device supports scan flush.
	Device supports AP scan.
	Device supports per-vif TX power setting
	P2P GO supports CT window setting
	Driver supports full state transitions for AP/GO clients
	Driver supports a userspace MPM
	Device supports active monitor (which will ACK incoming frames)
	Driver/device bandwidth changes during BSS lifetime (AP/GO mode)
	Device supports configuring vdev MAC-addr on create.

Offline

#8 2017-05-21 22:24:35

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: hostapd troubles

Did you bring up the interface before starting hostapd?

https://wiki.archlinux.org/index.php/So … figuration


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#9 2017-05-22 07:26:14

momokrono
Member
Registered: 2016-10-27
Posts: 54

Re: hostapd troubles

i've added to the hostapd.conf file these lines:

ssid=myname
wpa_passphrase=mypasswd
interface=wlp0s20f0u4
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

then

ip link set dev wlp0s20f0u4 up

i started hostapd but it still failed.

maybe networkmanager is interfering?

Last edited by momokrono (2017-05-22 07:27:55)

Offline

#10 2017-05-22 10:03:24

tom.ty89
Member
Registered: 2012-11-15
Posts: 897

Re: hostapd troubles

Maybe you can start from as less lines as possible. For example:

interface=wlp0s20f0u4
ssid=myname

And maybe with some or some combinations of this:

channel=7
driver=nl80211
hw_mode=g

hw_mode and channel can be especially tricky. I remember I had an adapter that can start in AP mode on the first channel or so. And you might need different specific channel number for different hw_mode. And of course a hw_mode that your adapter can start on in AP mode.

Last edited by tom.ty89 (2017-05-22 10:04:04)

Offline

#11 2017-05-24 07:40:36

momokrono
Member
Registered: 2016-10-27
Posts: 54

Re: hostapd troubles

i tried but none of the combinations worked...
i've downloaded create_ap to check if the problem is solved but it's stucked at "creating virtual ap", and looking at the available connections from the pc i can see the virtual APs created but not from my phone :\

Offline

#12 2017-05-27 14:40:22

momokrono
Member
Registered: 2016-10-27
Posts: 54

Re: hostapd troubles

i tried to troubleshoot but i cannot figure out why it's not working, any other advice?

Last edited by momokrono (2017-05-27 14:42:35)

Offline

#13 2019-07-09 21:35:38

cone
Guest

Re: hostapd troubles

Could be an issue with your installed version of hostapd.
E.g. a 2:2.4 version should work, where a 2:2.6 does not.

Try

$ sudo su
# apt-cache madison hostapd
   hostapd | 2:2.6-21~bpo9~rpt1 | http://archive.raspberrypi.org/debian stretch/main armhf Packages
   hostapd | 2:2.4-1+deb9u2 | http://raspbian.raspberrypi.org/raspbian stretch/main armhf Packages
# apt-get install hostapd=2:2.4-1+deb9u2 -V

... and that's it !

If you would like to prevent future update with:

apt-mark hold hostapd

you can remove the directive later with:

apt-mark unhold hostapd

Source: https://www.raspberrypi.org/forums/view … p?t=235145

#14 2019-07-09 21:52:04

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: hostapd troubles

cone wrote:
apt-mark hold hostapd

You regsitered just to necrobump a thread with an irrelevant command for a package manager that Arch doesn't use...

Closing


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB